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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Wed Oct 14, 2009 11:15 pm   

#YESNO and local variables
 
Why when I put some code like:
Code:
$tmp = 0
#YESNO ("Yes or no") {$tmp = 1} {$tmp = 2}
#SA Tmp $tmp

I always get output "Tmp 0"?
Shouldn't it depends on my decision and the action inside the #YESNO brackets?

Best regards
Yodous
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Oct 15, 2009 4:33 am   
 
The #YESNO commands actually predates local variables and currently are not compatible with local variables.
_________________
Asati di tempari!
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu Oct 15, 2009 1:20 pm   
 
If you want to use local variables, do it this way.

Code:
$tmp = 0
#if (%yesno("Yes or no?")) {$tmp = 1} {$tmp = 2}
#print {The value of tmp is $tmp}
$tmp = %prompt("","Enter a value for tmp:")
#print {The value of tmp is $tmp}
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Oct 21, 2009 2:01 am   
 
I went ahead and udpated the help documentation for YESNO.
_________________
Asati di tempari!
Reply with quote
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Wed Oct 21, 2009 10:11 pm   
 
Thx :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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