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
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Fri Jan 23, 2004 12:13 am   

Use of () and {}
 
Ok, I'm starting to fine tune my script for Imperian and would like to know the difference, if any between () and {} and when to use them.

Currently here is a snip of the code where I use them.

#if (@salvebalance AND NOT @asleep AND NOT @aeon AND NOT @stunned) {
#if {@anorexia AND @Salvebalance} {
salvebalance = 0
apply epidermal
}


Also, by putting a second check for salvebalance redundant or is it necessary? I try to make it so I only eat/drink/etc when I have the necessary balance. So far it works, but would like to have the code clean and as short as possible.

thanks in advance.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jan 23, 2004 12:15 am   
 
()'s are generally used to group expressions, while {} are generally used to group commands or functions. Thus, an #IF command typically looks like:
#IF (expression) {commands}
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Fri Jan 23, 2004 12:48 am   
 
Thanks
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jan 23, 2004 4:57 am   
 
The second check for @Salvebalance is redundant.
Reply with quote
Dagnimaer
Wanderer


Joined: 05 Apr 2003
Posts: 60
Location: USA

PostPosted: Fri Jan 23, 2004 8:28 pm   
 
*nods* thought so.
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