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
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Fri Sep 24, 2010 10:17 pm   

Local Variable with Prompt
 
I looked at the documentation and it doesn't say you can't use a local variable with the prompt. Should we be able to? I really don't want to have a global variable used because I am going to throw it away when I'm done.

Example:
Code:
#MENU 10 Add Character{#PR Name "Enter the name of the character"
#addkey friends @Name %selected} Identify



I would like to be able to do this:

Code:
#MENU 10 Add Character{#local $Name #PR $Name "Enter the name of the character"
#addkey friends $Name %selected} Identify
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Sep 27, 2010 12:12 am   
 
Yes, I believe you can, but you have to put semicolons between command statements:
Code:
#MENU 10 Add Character{#local $Name;#PR $Name "Enter the name of the character";#addkey friends $Name %selected} Identify
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Sep 27, 2010 3:31 am   
 
Nope. I didn't put the semi-colons in the example because it was like the following in the script text:
Code:

#local $Name
#$pr $Name "Enter in the name of the character:"
#addkey friends $Name %selected
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Sep 27, 2010 4:48 pm   
 
That's correct, it could show up that way in your package editor. But it you put all the commands onto a single line (as you do if you are putting them all in the braces in your #MENU command), you must replace the carriage returns with semicolons.
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Sep 27, 2010 4:55 pm   
 
Anyways.. We aren't talking about the syntax. The local variable doesn't work with #PROMPT command. This thread should be moved to the Beta Forum.
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Sep 27, 2010 8:27 pm   
 
Ah, you didn't explicitly say that you had actually tried it with the correct syntax, which is why I was telling you to do so.

Actually, you post your code as:
Code:
#local $Name
#$pr $Name "Enter in the name of the character:"
#addkey friends $Name %selected

If that is your code, you have an error. #$pr should be #pr.

Yes, if you are using version 3.xx, this should be in the Beta forum.
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