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


Joined: 17 Feb 2002
Posts: 18
Location: Hong Kong

PostPosted: Mon May 13, 2002 2:27 pm   

Problem on expanding variables
 
I have declared the following variables in my script :

#var cstep 1
#var room@cstep %roomexit /* with the room exits string be "n|s|e|h", so there will be a variable <room1 = "n|s|e|h"> */

However, when I enter

#show %pop(room@cstep)

it doesn't show up with the expected "n", but a blank line instead. I know it will show up as expected if I enter
#show %pop(room1)

but the problem is that, the variable @cstep will change with time so that I need to retrieve the directions from e.g, @room1, @room2, @room3, .... etc.

How can I solve the problem ?

P.S. I am using 6.21
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 13, 2002 2:51 pm   
 
This is a beta function (so this should have been on the beta forum) which I can't test, however this is what would work in other functions:
#SHOW %pop(@{room@cstep})

LightBulb
Vague questions get vague answers
Reply with quote
Godfrey123456
Beginner


Joined: 17 Feb 2002
Posts: 18
Location: Hong Kong

PostPosted: Mon May 13, 2002 3:01 pm   
 
I have tried this also
it behaves the same and doesn't solve the problem
Reply with quote
Pega
Magician


Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Mon May 13, 2002 3:52 pm   
 
I guess there is no way to expand what's in the brackets in.
#show %pop(room@cstep)


Here's a way to go around it...
#var List1 {a|b|c}

#var List2 {1|2|3}
#var List3 {x|y|z}
#var pop "%if(%isnumber(%1),%case(%1,%pop(List1),%pop(List2),%pop(List3)))"

You can reassign the pop variable to extend the number of lists.

Hope this helps.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon May 13, 2002 5:42 pm   
 
If variable expansion doesn't work properly in the %pop function of BETA version 6.21, then since you are a beta tester, you should probably upgrade to the beta version that's currently under test. It's quite likely that this bug has already been identified and corrected. However, if it still exists in beta version 6.26, then please report it in the BETA forum so that Zugg will be aware of it and can correct it. This is why he offers the beta versions for testing, so that he can be informed of bugs he might not encounter in his own testing.

LightBulb
Vague questions get vague answers
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Wed May 15, 2002 5:21 pm   
 
%pop expects a varable name, and doesn't expand it, if it's a name with nested variables, or an array.
I'm not even sure if it's expected to do so.

Definitly a question for the beta forum - it's much more likely to get a good answer there.

Note:
You CAN force expansion by using #EXECUTE
#EXEC {"#show %pop(room"@cstep")"}
but that's rather a 'last resort', then a good solution.
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