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
Matthew
Beginner


Joined: 22 May 2003
Posts: 18
Location: Germany

PostPosted: Fri Apr 30, 2004 12:29 pm   

Boolean Variable
 
Hi,

I wanna make a little training alias using a boolean variable to control it.
Therefor I thought of a while loop with a boolean variable. But my little test alias below isn't working correctly.
It runs even when the variable is set to false.

#VAR A 10
#WHILE (@wtrain) {
#SHOW @A
#ADD A -1
#wait 3000
}

Can you help me?

Matthew
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 30, 2004 6:08 pm   
 
When you put the string "false" in a variable, it is simply a string and not a boolean value. Since it's not a null string, the string "false" evaluates to true.

Use 0 when you want to put a false value into a variable.

An ALARM would probably be a much better choice than a WHILE and WAIT.
#VAR A 10
#VAR wtrain 1
#ALA *3 {#IF (@wtrain) {#SHOW @A;#ADD A -1}}
Reply with quote
Matthew
Beginner


Joined: 22 May 2003
Posts: 18
Location: Germany

PostPosted: Sat May 01, 2004 4:18 pm   
 
Thanks for the help.
Working with 1 and 0 is doing it.
Only the alarm idea doesn't fit in my concept.
But thanks anyway. Perhaps I'll need it sometimes.

Matthew
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