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
ZooMetropolis
Newbie


Joined: 29 Mar 2003
Posts: 7

PostPosted: Sun Sep 21, 2003 1:51 am   

Pop from string lists
 
I'm breaking my head with this, i know it's an easy question, but i can't work it out.

How do i pop a value from a string list variable to another variable?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 21, 2003 2:27 am   
 
#VAR astringlistvariable {item1|item2|item3}
#VAR anothervariable {%pop( astringlistvariable)}
Reply with quote
ZooMetropolis
Newbie


Joined: 29 Mar 2003
Posts: 7

PostPosted: Sun Sep 21, 2003 8:19 am   
 
The problem I have with this is that when the second #VAR command is executed, the value on anothervariable is %pop( astringlistvariable). Meaning that i don't get the value item1 that i want.
Reply with quote
ZooMetropolis
Newbie


Joined: 29 Mar 2003
Posts: 7

PostPosted: Sun Sep 21, 2003 8:34 am   
 
I got it to work using %item and #DELN.. not the most elegant solution, but at least works :)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Sep 21, 2003 12:50 pm   
 
There's nothing wrong with %item and #DELN. That is the method you would use on older versions which don't have %pop, and does precisely the same thing. If the snippet I posted above doesn't work, you probably have one of those older versions.

#VAR anothervariable %item( @astringlistvariable, 1)
#DELN astringlistvariable 1
Reply with quote
Anabasis
Wanderer


Joined: 26 Jan 2001
Posts: 74

PostPosted: Mon Sep 22, 2003 2:48 pm   
 
quote:
The problem I have with this is that when the second #VAR command is executed, the value on anothervariable is %pop( astringlistvariable).


I had a similar problem in some of my variable hand offs. I ended up solving it by putting brackets around the command to make sure it expands before assigning the value to the second variable, like so...

#VAR anothervariable {[%pop( astringlistvariable)]}

Ana
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