Scripts
#1
Post your scripts here (with a short explanation what it does).

"Credit goes to original autor"

To use this scripts copy&paste them in your "autoexec.cfg" you can find it in the "config"-section of you Assaultcube.


1. Quick knife script:
alias quickknife [
  if (!= (curweapon) 6) [melee]
  attack
  onrelease [ sleep 1 [ if (= (curweapon) 0) [weapon (prevweapon)] ] ]
]
bind Q quickknife
To activate this script you have to press and hold "q" ingame. You will draw your knife and attack. When you stop pressing "q" you'll automaticly change back to your previous weapon.


2. Knifeattack script:
alias knifeattack [
if (= (currentprimary) (curweapon)) [
weapon 0
] [
primary
]
]
bind Q knifeattack
This script will make you change to kinfe/primary weapon everytime you press "q"


3. Zoom script by stef:
//zoom script by stef with fog 1024 trick added, a must for a sniper
alias adjustsens [
scopefov 40
scopesensscale = (divf $scopefov $fov)
]
alias altaction_4 [ alias oldfog $fog;fog 1024
adjustsens; domodifier 1; zoom 1;
onrelease [ zoom 0; adjustsens; fog $oldfog ]
]
alias delta_game_0 [
if (= $arg1 1) [
  if (> $scopefov 5) [scopefov (- $scopefov 5) ]
][
  if (< $scopefov 60) [scopefov (+ $scopefov 5) ]
];
sensitivity (divf (*f (*f $oldsens $scopesensscale) $scopefov) 40)
]
With this script you can zoom with your sniper. Just scroll with your scrollwheel while you scope.


4. Out of ammo script:
// out of ammo -> pistol
alias noprimammo [
if (= curweapon [currentprimary]) [sleep 100 [if (= (magcontent (currentprimary)) 0)[ weapon 1]]]]
bind MOUSE1 [attack;noprimammo]
With this script you will automaticly change to the pistol when your primary weapon is out of ammo. (To use it with the SMG/AR you may have to set "autoreload" off or press the mousebutton again when you are out of ammo)


5. Teamchange script:
alias swapteams [sleep 100 [autoteam 0]; sleep 200 [forceteam 0]; sleep 300 [forceteam 1]; sleep 400 [forceteam 2]; sleep 500 [forceteam 3]; sleep 600 [forceteam 4]; sleep 700 [forceteam 5]; sleep 800 [forceteam 6]; sleep 900 [forceteam 7]; sleep 1000 [forceteam 8]; sleep 1100 [forceteam 9]; sleep 1200 [forceteam 10]; sleep 1300 [forceteam 11]; sleep 1400 [forceteam 12]; sleep 1500 [forceteam 13]; sleep 1600 [autoteam 1]]
You need to be admin for this script.
When you type "/swapteams" ingame (or bind it to a key/in a menu) every player will change the team.
(For some reason it doesn't work properly for me. If the author of this script could have a look at this and tell me if it's wrong or something, I'd be very happy :) )


6. "Get rid of suckers" - script aka force script
alias force_cn -1;
alias forceloop_o [
  callvote 5 $force_cn;
  sleep 5000 forceloop;
]
alias forceloop [];
alias start_force [
  alias forceloop $forceloop_o;
  forceloop;
]
alias stop_force [
  alias forceloop [];
]
alias force [
  if (< $numargs 1) [
      echo "Error: FORCE needs a ClientNumber!";
  ] [
      alias force_cn $arg1;
      start_force;
  ]
]
bind F8 [ stop_force;echo "Force Stopped!" ]
You need to be admin for this script.
When you type "/force cn" ingame the player with the choosen cn will get changed to the enemy team ever 5 second or something, till you press F8 or he leaves.
This is a nice altanative to kick/ban :)

Mod Edit: Upgraded [noparse][code] tags to [code][/noparse] tags
Thanks given by:
#2
I'm the author of the teamchange script and it works well for me and some other people.
I don't know what problem you encounter.
Thanks given by:
#3
7. AFK Script
//AFK Script
//by CiD
//TODO: make a settings menu
//User Settings
//This is what will be added to your name when you are AFK.
afkstr = "|afk"

//If set to 1, it will display a message to other players when you go AFK. Set to 0 to disable.
afkshowmessage = 1

//This will be placed after your name and sent to other players.
afkmessage = "is no longer available."

//This is how long (in seconds) the script will wait if you are idle before changeing you to AFK.
timeuntilafk = 20

//DO NOT EDIT BELOW HERE
curafk = 0
afktime = 0
alias afk [
if $arg1 [
if (= $curafk 0) [
oldname = $curname
name (concatword $oldname $afkstr)
curafk = 1
echo "You are now set to: AFK"
if $afkshowmessage [say (concat "AFKScript:" $oldname $afkmessage )]
]
] [
if $curafk [
name $oldname
curafk = 0
echo "You are now set to: ONLINE"
]
]
]
alias notafk [
if (= $afktime 0) [afkcheck]
afktime = 0
if (= $curafk 1) [afk 0]
]
alias afkcheck [
afktime = (+ $afktime 5)
if (= 2 (+ (> $afktime (* $timeuntilafk 1000)) (= $curafk 0))) [afk 1]
sleep 5 afkcheck
]
bind w [forward;notafk]
bind a [left;notafk]
bind s [backward;notafk]
bind d [right;notafk]
//END of AFK Script
It automatically changes your nickname from "nickname" to "afk|nickname" after some inactivity period.
Thanks given by:
#4
Improved swapteams script by Cid:
//fixed up swapteams script
//usage: /swapteams MAXCLIENTS - MAXCLIENTS being the maximum number of clients on the server, assumes 20
      alias swapteams [
              alias _numclients $arg1;
              if (= $_numclients 0) [
                      alias _numclients 20 //no num specified, assume 20
              ]
              alias _curnum 0;
              loop i $_numclients [
                      sleep (* 100 $i) [
                              forceteam $_curnum;

                              _curnum = (+ $_curnum 1);
                       ]
               ]
       ]
Thanks given by:
#5
"AUTOEXEC Me" - Auto-applied dynamic mode specific settings...
Thanks given by:
#6
by grenadier
Quote:// scrolling with use mouse in output console
alias konsola 0
bind "F11" [ toggleconsole; if (= $konsola 0) [alias konsola 1] [alias konsola 0; conskip -1000] ]
bind "MOUSE4" [ if (= $konsola 0) [universaldelta 1] [conskip 3] ]
bind "MOUSE5" [ if (= $konsola 0) [universaldelta -1] [conskip -3] ]

have anyone script for write team message with my healts/armor/ammo ?
Thanks given by:
#7
Yes me.
But I had to modify my client to do that... :/
There is a script that says your current weapon, ammo and clips to your teammates at the AcWiki.
Thanks given by:
#8
1. Quick knife script:
Code:
alias quickknife [
if (!= (curweapon) 6) [melee]
attack
onrelease [ sleep 1 [ if (= (curweapon) 0) [weapon (prevweapon)] ] ]
]
bind Q quickknife
To activate this script you have to press and hold "q" ingame. You will draw your knife and attack. When you stop pressing "q" you'll automaticly change back to your previous weapon.

-> about that, there is not something for when i press q, it just take the knife, ataack and come back? i mean, no need to hold, just press. thx
Thanks given by:
#9
"AUTOEXEC Me v2.0" - Auto-applied dynamic mode AND map specific settings...

Worth the update. :P
Thanks given by:
#10
a slow old man: you ripped some of my scripts i posted on the old forum, it would've been kind to mention the autor, but np
Thanks given by:
#11
bind f [ if $editing [solid 1] [quicknadethrow]]
bind q [ if $editing [ domodifier 1 ] [melee; attack]]
bind MOUSE3 [if (= (curweapon) 7) [attack] [secondary; attack]]
bind MOUSE1 [primary; attack]
bind MOUSE2 [ if $editing [ showmenu editing ] [ altaction ] ]
All-in-one weapon script. Original by Vi, modified by GeneralDisarray and I. ^^
Make the 2 key switch to Akimbo by default:
bind 2 [ if $editing [ domodifier 7 ] [weapon 7; secondary] ]
A useless script that calculates cylinder volume. V-Man's exponent script is included.
//Volume script, "cylvol radius height"
//By Gibstick
pi = 3.1415926535897932384626433832795028841971693993751058209
alias cylvol [
alias rsq (exp $arg1 $arg1);
alias carea (*f $rsq $pi);
alias volume (*f $carea $arg2);
echo $volume
echo Make sure you put the radius before the height.
]

//Exponent script "exp 5 2" = 5^2
alias powerloop [
    (alias product (*f $base $product));
    (alias power (+f $power 1));
    (if (<f $power $pow) [powerloop] [result $product])]

alias exp [
(alias product 1);
(alias power 0);
(alias base $arg1);
(alias pow $arg2);
(powerloop base pow)]
Thanks given by:
#12
(21 Jun 10, 08:19AM)Kirin Wrote: a slow old man: you ripped some of my scripts i posted on the old forum, it would've been kind to mention the autor, but np

Sure, just tell me which are yours. I just skipped through my autoexec.cfg and when there is no "//made by Kirin" or something idk who made it ^^
Thanks given by:
#13
the quick knife is mine
and the zoom script is the modified version i made (the original version of the script was of stef)
and the Out of ammo script

those are all fairly simple that's why i didnt add credits, but when posrting them
ah "Credit goes to original autor" would have been more than enough
Thanks given by:
#14
lol copyright....
and yes there is a such script that says your gun and ammo to your teammate. i used it before and then i lost it xD.
Thanks given by:
#15
Meh, humble GeneralDisarray doesn't care if his name shows in my scripts. Neither does V-Man.
Thanks given by:
#16
infact i didnt want to be mentioned...
but it's rude to let ppl intend you made them :)
Thanks given by:
#17
I really don't like that "force"-script. It isn't just annoying to the player targeted but to the whole match in progress - especially if the targeted player isn't too well versed in AC you'll start seeing a lot of TKs, just because he notices too late he was switched.
This is, in fact, one thing I'm going to try and improve on - making such a switch be more prominent, so's you don't become a TK in the heat of battle because upon spawn you happen to see an old opponent and your reflexes make you hit attack.

A potential option here would be to send an offending player to the spectator "team" - of course, only possible once 1.1 is released - but until then I'd really urge you to kick players instead of messing with the ongoing match any more than they already are.
Thanks given by:
#18
Right now I'm working on a "bedtime" script. My problem so far is letting the system continuously check timestring, which causes AC to crash. If anyone has any creative ideas on how to get around this please say so.

Basically I can get the game to let you insert a bedtime, but I run into trouble when executing the command, i,e, AC crashes and sometimes the entire computer.

I might have crashed idis 8010 last night, lol, by "saying" instead of echoing. XD
It crashed my computer.

edit: I'm currently using the while command and having an arg for bedtime which is checked to the time.
Thanks given by:
#19
So you want a script where you put the time your bedtime is so AC quits at that time?
Thanks given by:
#20
I'm sure it'd be easier to find a program to just shut off your computer at your 'bedtime' :P
Thanks given by:
#21
Well basically you put in your bedtime and at the time you put in, the console echos:

GO TO SLEEP!!!!!!!!!
GO TO SLEEP!!!!!!!!!
GO TO SLEEP!!!!!!!!!
Thanks given by:
#22
lol, tell me when the script is done. I'd like that, cause i often lose track of time playing ac
Thanks given by:
#23
(25 Jun 10, 02:26PM)Viper Wrote: Well basically you put in your bedtime and at the time you put in, the console echos:

GO TO SLEEP!!!!!!!!!
GO TO SLEEP!!!!!!!!!
GO TO SLEEP!!!!!!!!!

I'm not familiar with CubeScript, so I'm no help in actually writing a script,
but...

Why not have it ask for a length of time to play? (Its 9 now and I want to be in bed by 1, so I'll give it 4 hours)

Then it's just a matter of a counter and when it hits 4 hours, GO TO BED!!!
Thanks given by:
#24
alias aban [ // Take admin, force fail existing votes, whois,
//           // screenshot, and ban an offender with /aban cn.
//           // Also reminds you to download the demo on the
//           // start of the next map.
        if (&& (> (listlen $arg1) 0)(= $connected 1))[
        tmp_admin_victim = $arg1
              if (= (currole) 0) [
                claimadmin
                sleep 150 [whois $tmp_admin_victim]
                sleep 300 [vote 2; toggleconsole]
                sleep 600 [screenshot; ban $tmp_admin_victim]
                sleep 1500 [setadmin 0; toggleconsole]
                ][
                sleep 150 [whois $tmp_admin_victim; vote 2; toggleconsole]
                sleep 500 [screenshot; ban $tmp_admin_victim]
                sleep 900 [toggleconsole]
                ]
        sleep 1200 [alias mapstartonce [sleep 5000 [echo "Don't forget to download demo!"]]]
        ]
]

Epic ban script - requires grenadier's claimadmin script, also this is a modded version of grenadiers original aban script, modded by myself and GeneralDisarray.

Enjoy. :)
Thanks given by:
#25
...Don't get anything...
Thanks given by:
#26
Hey can you show me were to make these? I tried typing /bind q [quickknife] but it doesn't work.
Thanks given by:
#27
The scrips you see here should be copied and pasted into your autoexec.cfg in the "config" folder of your AC installation. Open it with a text editor (notepad will do), paste, save. Enjoy.

NOTE: Not *all* scripts work only from the autoexec.cfg, sometimes they come with special installation instructions that you should always carefully read and follow - to avoid problems.
Thanks given by:
#28
I decided this "CHECK BEDTIME" script would be a nice demonstration-piece.
It actually exposed a minor bug in AC 1.0.4 to me -
this makes the script a little less fire-and-forget, since you need to manually trigger it to run once the engine has started up. (KP_PERIOD is used by default for that)
It's not completely fool-proof - for example you could hit KP_PERIOD multiple times - but that doesn't change it's effects, just wastes CPU cycles ;-P

Get CHECK BEDTIME here and put it into your AssaultCube Home and put the following line into your config/autoexec.cfg:
exec send2bed.cfg
Thanks given by:
#29
(26 Jun 10, 04:40AM)Bukz Wrote: Epic ban script - requires grenadier's claimadmin script, also this is a modded version of grenadiers original aban script, modded by myself and GeneralDisarray.

where is grenadiers claimadmin script?
Thanks given by:
#30
exec config/admin_passwords_list.cfg
alias adminpasswordposition -1
alias claimadmin [
if ( && (= $connected 1) (= (currole) 0) ) [
if (> (listlen $adminpasswordslist) 0)[
alias adminpasswordposition [ findlist $adminpasswordslist (curserver 1) ]
if (!= (adminpasswordposition) -1)[
setadmin 1 ( at $adminpasswordslist (+ (adminpasswordposition) 1) )
][
alias adminpasswordposition [ findlist $adminpasswordslist (concatword (curserver 1) : (curserver 3)) ]
if (!= (adminpasswordposition) -1)[
setadmin 1 ( at $adminpasswordslist (+ (adminpasswordposition) 1) )
][
alias gn_curservername (curserver 2)
alias adminpasswordposition [ findlist $adminpasswordslist $gn_curservername ]
if (!= (adminpasswordposition) -1)[
setadmin 1 ( at $adminpasswordslist (+ (adminpasswordposition) 1) )
][
alias adminpasswordposition [ findlist $adminpasswordslist (concatword $gn_curservername : (curserver 3)) ]
if (!= (adminpasswordposition) -1)[
setadmin 1 ( at $adminpasswordslist (+ (adminpasswordposition) 1) )
][
echo "Cannot find an admin password for this server in your configuration"
]
]
]
]
][
echo "Admin passwords list is empty"
]
][
setadmin 0
]
]

// By grenadier
  1. Copy and paste the above code into your autoexec.cfg
  2. Make a new text file named admin_passwords_list.cfg
  3. Fill the file with server IP's and/or ports with the corresponding admin passwords for that server. (See example below.)
alias adminpasswordslist [
SERVER1IPHERE PASSWORDHERE // works for all servers running on that IP - assuming you have the same password for all of them
SERVER2IP2HERE:PORTHERE PASSWORDHERE // works for the specific server running on the port that you specify
SERVER3IPHERE PASSWORDHERE
SERVER4IPHERE:PORTHERE PASSWORDHERE ]

Important: Each server IP and password should be on it's own line within admin_passwords_list.cfg - On windows there MUST be a space after every password, otherwise the script will not work correctly.

From now on, /claimadmin will take admin status on any servers listed in admin_passwords_list.cfg - for ease of use, I recommend binding it to a key like so:

bind "KEY" [claimadmin]

Tip: Pressing your claimadmin keybind a second time, or typing /claimadmin a second time, will drop admin status.
Thanks given by: