Basic Cubescript: Variables
#2
alias is weird compared to more normal languages.

It can be thought of like a container (like a box, nothing computer-science related), you can put anything in it. You can put methods (definitions, functions), variables (strings, numbers), or anything else in it.

Look at the scripts thread: http://forum.cubers.net/thread-38-post-199.html#pid199

Look at the quickknife script. I'll copy it here:
[cubescript]
alias quickknife [
if (!= (curweapon) 6) [melee]
attack
onrelease [ sleep 1 [ if (= (curweapon) 0) [weapon (prevweapon)] ] ]
]
bind Q quickknife
[/cubescript]

The main alias here is quickknife. It gets executed whenever you hit Q. However, you can make this alias, and then do:
[cubescript]
echo $quickknife
[/cubescript]
and then it will print out the script to the screen. You can think of an alias as a container that gets parsed whenever it gets executed by () or other execution methods.

If you aren't scared away from cubescript by now, check out some guides made by some of the best: http://cubescripts.tk/forums_smf2/index.php?board=7.0

You can also join the IRC to ask some questions. irc.gamesurge.net #cubescript
Thanks given by:


Messages In This Thread
RE: Basic Cubescript: Variables - by Ronald_Reagan - 28 Nov 11, 12:06AM
RE: Basic Cubescript: Variables - by V-Man - 28 Nov 11, 10:38AM
RE: Basic Cubescript: Variables - by V-Man - 28 Nov 11, 09:06PM
RE: Basic Cubescript: Variables - by V-Man - 29 Nov 11, 12:44AM
RE: Basic Cubescript: Variables - by V-Man - 29 Nov 11, 05:41AM
RE: Basic Cubescript: Variables - by V-Man - 30 Nov 11, 05:30PM
RE: Basic Cubescript: Variables - by V-Man - 01 Dec 11, 03:50AM
RE: Basic Cubescript: Variables - by tempest - 01 Dec 11, 03:17PM
RE: Basic Cubescript: Variables - by V-Man - 02 Dec 11, 12:55PM
RE: Basic Cubescript: Variables - by V-Man - 03 Dec 11, 07:37AM
RE: Basic Cubescript: Variables - by Bukz - 03 Dec 11, 01:11PM
RE: Basic Cubescript: Variables - by V-Man - 04 Dec 11, 06:43AM
RE: Basic Cubescript: Variables - by V-Man - 04 Dec 11, 11:21PM
RE: Basic Cubescript: Variables - by V-Man - 05 Dec 11, 10:37AM
RE: Basic Cubescript: Variables - by V-Man - 12 Dec 11, 10:27PM