A hard return performs the same punctuation function as a semicolon (so ending a line with a semicolon is redundant).
You'll want the alias definitions, at least the starting brackets, to be on the same line to show the engine that you're explicitly beginning a new argument. After you open an argument, you can put whatever you want in it, including hard returns, without actually ending that particular argument (in other words, arguments can have multiple arguments within them; brackets group them as one). In general, the arguments of commands need to start on the same line as the argument before it.
So, for your script:
[cubescript]
alias slow 0 //0 = normal speed 1 = slo_mo
alias toggle_slo_mo [
if ( = $slow 0 ) [ //if slow is off
push slow 1; //turn slow on
gamespeed 10] [ //slow-mo
// else...
pop slow; //turn slow off
gamespeed 100 //normal-speed
]
echo $slow //debug
]
bind LALT toggle_slo_mo //no minimap for you
[/cubescript]
Note that closing brackets can come after any number of hard returns, as long as they are there (but the game does try to parse all white space, so you'll want only enough to make the script readable).
I didn't test the script, so I'm not sure how it'll work. XD
Think of an alias as a container. It only has what you tell it to have in it.
[cubescript]
alias examplealias 3
alias examplealias (- 5 2) // this will be calculated and stored when "alias" is run
examplealias = [- 5 2] // this will be stored as a function that finds "- 5 2" each time "examplealias" is run
// I see you found push and pop as well.
push examplealias (div 6 2)
pop examplealias
[/cubescript]
Almost forgot some other modifying commands:
[cubescript]
+= examplealias 2
-=f examplealias 2
*=f examplealias (divf $examplealias 3)
add2alias examplealias "bottles of beer on the wall"
[/cubescript]
(and there are some nice ones in tools.cfg as well.)
A nice note:
The "if" command's first argument, the evaluation, needs only a 1 or a 0. Thus, you can have for the evaluation something that will either be 1 or 0 (for example, $slow in your script). Then you'll want to swap the other two arguments:
[cubescript]
alias slow 0 / /0 = normal speed 1 = slo_mo
alias toggle_slo_mo [
if $slow [pop slow; gamespeed 100] [push slow 1; gamespeed 10]
echo $slow]
bind LALT toggle_slo_mo //no minimap for you
[/cubescript]
You'll want the alias definitions, at least the starting brackets, to be on the same line to show the engine that you're explicitly beginning a new argument. After you open an argument, you can put whatever you want in it, including hard returns, without actually ending that particular argument (in other words, arguments can have multiple arguments within them; brackets group them as one). In general, the arguments of commands need to start on the same line as the argument before it.
So, for your script:
[cubescript]
alias slow 0 //0 = normal speed 1 = slo_mo
alias toggle_slo_mo [
if ( = $slow 0 ) [ //if slow is off
push slow 1; //turn slow on
gamespeed 10] [ //slow-mo
// else...
pop slow; //turn slow off
gamespeed 100 //normal-speed
]
echo $slow //debug
]
bind LALT toggle_slo_mo //no minimap for you
[/cubescript]
Note that closing brackets can come after any number of hard returns, as long as they are there (but the game does try to parse all white space, so you'll want only enough to make the script readable).
I didn't test the script, so I'm not sure how it'll work. XD
Think of an alias as a container. It only has what you tell it to have in it.
[cubescript]
alias examplealias 3
alias examplealias (- 5 2) // this will be calculated and stored when "alias" is run
examplealias = [- 5 2] // this will be stored as a function that finds "- 5 2" each time "examplealias" is run
// I see you found push and pop as well.
push examplealias (div 6 2)
pop examplealias
[/cubescript]
Almost forgot some other modifying commands:
[cubescript]
+= examplealias 2
-=f examplealias 2
*=f examplealias (divf $examplealias 3)
add2alias examplealias "bottles of beer on the wall"
[/cubescript]
(and there are some nice ones in tools.cfg as well.)
A nice note:
The "if" command's first argument, the evaluation, needs only a 1 or a 0. Thus, you can have for the evaluation something that will either be 1 or 0 (for example, $slow in your script). Then you'll want to swap the other two arguments:
[cubescript]
alias slow 0 / /0 = normal speed 1 = slo_mo
alias toggle_slo_mo [
if $slow [pop slow; gamespeed 100] [push slow 1; gamespeed 10]
echo $slow]
bind LALT toggle_slo_mo //no minimap for you
[/cubescript]