 |
ma77g Newbie
Joined: 14 Aug 2002 Posts: 3
|
Posted: Sun May 30, 2004 8:33 pm
if statement with multiple actions |
Ive tried to figure this out but i cant.
I want a macro to be like a toggle macro:
If (@var = on) {defense off;@var = off}{defense on;@var = on}
Im missing something with the syntax as I cant get the 'defense off mud command AND the variable reset to happen. |
|
|
 |
user0101 Apprentice
Joined: 01 Aug 2003 Posts: 100 Location: USA
|
Posted: Sun May 30, 2004 10:08 pm |
#if (@var = "on") {defense off;var = "off"} {defense on;var = "on"}
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun May 30, 2004 10:27 pm |
In case you missed it, you are missing three things:
1. The # before IF
2. Double-quotes around on, so that it will be treated as a string rather than a boolean value, which is necessary because the variable will be treated as a string rather than a boolean value
3. The space between } and { |
|
|
 |
Spartacus Wanderer
Joined: 23 Apr 2001 Posts: 53 Location: USA
|
Posted: Sun Jun 06, 2004 3:27 pm |
You also had @ before a variable assignment, which is not needed and doesn't do what you wanted. The @ sign is only required when referencing the variable's value. Leave it off in assignments.
|
|
|
 |
|
|