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
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Sat Sep 28, 2002 8:31 pm   

Booleans in #If statement
 
I have this condition that is always true. Does anyone know why this is happening?

#IF (@VFirstword = (a | an | some)) {Do something when true} {Do something when false}
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Sep 28, 2002 8:53 pm   
 
It happens because of incorrect syntax. Try this instead:
#IF ((@VFirstword = "a") or (@VFirstword = "an") or (@VFirstword = "some")) {Do something when true} {Do something when false}

Also, an alternative, shorter way of doing it is:
#IF ((@VFirstword =~ "{a|an|some}")) {Do something when true} {Do something when false}

Kjata
Reply with quote
Oracle
Apprentice


Joined: 29 May 2002
Posts: 121

PostPosted: Sat Sep 28, 2002 9:40 pm   
 
Thank you, that works great.
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