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
myddrun
Wanderer


Joined: 31 Mar 2005
Posts: 58

PostPosted: Wed Feb 10, 2010 1:57 pm   

Selecting a variable which has the same name as a value in another variable.
 
I think I've found a problem I can't solve on my own. *grins*

I have string list variables for each online player that holds both their race and guild.
eg Myddrun = Elf|Wizard (but this could be any combination of race and guild)

I also have lists of names contained in variables for each race and guild.
eg

Elf: name1|name2|name3|Myddrun
Wizard: name4|name5|Myddrun|name6

What I'm trying to do is delete a player that logs out from their coresponding race and guild lists.

In psuedo code speak

Code:
Trigger ~[Myddrun leaves the Realms of the Dragon~]

Delete the name "Myddrun" from the 2 different lists who's names are stored as values in the variable called "Myddrun".


I've tried various combo of #var, #delitem, %pop, %delitem but nothing seems to work.

In short I'm stuck. Any body have any ideas?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Feb 10, 2010 2:48 pm   
 
make another string list containing all the varnames for race/guild

#TR { (%w) leaves the Realms of the Dragon} {#FORALL @varNameList {#DELITEM %i %1}}
_________________
Discord: Shalimarwildcat
Reply with quote
myddrun
Wanderer


Joined: 31 Mar 2005
Posts: 58

PostPosted: Wed Feb 10, 2010 5:08 pm   
 
Hehe, trust me to make life complicated. That's a far more elegant solution!

Thanks Shalimar!

*tips hat and sends the virtual beer round*
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Wed Feb 10, 2010 10:08 pm   
 
Actually, now that i see you have a var for each player as well you could change that to:
#FORALL @{%1} {#DELITEM %i %1}
_________________
Discord: Shalimarwildcat
Reply with quote
myddrun
Wanderer


Joined: 31 Mar 2005
Posts: 58

PostPosted: Thu Feb 11, 2010 3:45 pm   
 
It's a moot point now as I've already changed my code :)

I'll continue tol use your first suggestion as it ultimately cuts down the number of variables I have to store. Thanks any way though.
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