Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
ma77g
Newbie


Joined: 14 Aug 2002
Posts: 3

PostPosted: 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.
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Sun May 30, 2004 10:08 pm   
 
#if (@var = "on") {defense off;var = "off"} {defense on;var = "on"}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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 {
Reply with quote
Spartacus
Wanderer


Joined: 23 Apr 2001
Posts: 53
Location: USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net