|
XonDK Apprentice
Joined: 01 Dec 2006 Posts: 178
|
Posted: 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. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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
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! |
|
|
|
XonDK Apprentice
Joined: 01 Dec 2006 Posts: 178
|
Posted: Sat Jul 26, 2008 1:22 pm |
ah....interesting. Thank you.
Though I would have thought that #PR with a local var should work? |
|
|
|
|
|