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


Joined: 01 Dec 2006
Posts: 178

PostPosted: Fri Jul 25, 2008 5:40 am   

[2.33] BUG: Local variables do not work with #PROMPT
 
Very simple

#LOCAL $var
#PR $var "what?"
#SAY $var

Blank line, and #PROMPT doesn't even prompt.

Random example of usage.

#LOCAL $var
#PR $var "what?"
#ADDITEM whatever {%expand($var,1)}

for example making a list of stuff or adding something to a stringlist you have, instead of using an alias and %1 and so on (even though that'd work just as well I suppose) using #PR and reminding the user of what they actually are inputting.
Reply with quote
Tech
GURU


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

PostPosted: Fri Jul 25, 2008 8:58 am   
 
This isn't so much of a bug as it is a feature request. According to the documentation
Quote:
Displays a dialog box to prompt you for the value of the specified varname. Do not specify the @ in front of the variable name. The optional caption is displayed as the question for the prompt. The optional EchoChar is used to echo the characters that are typed. Use a EchoChar of * for standard password prompts.


W?hat's happening is that CMUD is evaluating the local variable $var and since it's empty, doing nothing because there is no variable to store to. Consider the following example
Code:
#LOCAL $var
$var=foo
#PR $var "what?"
#SAY @{"$var"}  $var  {"$var"}  @{$var}


Which results in
Code:
@$var foo $var bat
if you entered 'bat' at the prompt.

Now with that said, what you're trying to do can be easily accomplished with the %prompt function. This should work along the lines you're expecting.
Code:
#LOCAL $var
$var = %prompt(500,"How many to sell?")
#show $var
_________________
Asati di tempari!
Reply with quote
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Sat Jul 26, 2008 1:22 pm   
 
ah....interesting. Thank you.

Though I would have thought that #PR with a local var should work?
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