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


Joined: 01 Dec 2000
Posts: 27

PostPosted: Thu Feb 26, 2004 2:54 am   

String list variable usage
 
How do you cause a value from a string list variable to be used as an alias? For example lets say the 3rd element of a string list named spells is fireball, and there exists and alias named fireball that casts fireball (this is obviously a simplified example). If i use #ECHO @spells.3 it will show me the correct alias, but I don't know how to make zmud execute the alias.

thanks in advance,
Kalus
Reply with quote
DeReP
Adept


Joined: 14 Jun 2003
Posts: 222
Location: Chile

PostPosted: Thu Feb 26, 2004 3:19 am   
 
You can use the %item function
eg:
#VAR spells "armor|bless|fireball"
#ALIAS cast {cast %item(@spells,%1)}
so typing cast 3 would cast fireball, 2 bless and 1 armor
Reply with quote
Kalus
Beginner


Joined: 01 Dec 2000
Posts: 27

PostPosted: Thu Feb 26, 2004 4:41 am   
 
I'm sorry I didn't explain what i'm trying to do very well, the string list is made up of alias names, i used spells just as an example. What i'm hoping to be able to do is access an item in the list, and have the alias execute. I feel like that should be some easy way to do that, but I can't seem to figure it out.
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Thu Feb 26, 2004 6:45 am   
 
Have you tried
#EXEC {@spells.3}
Reply with quote
Kalus
Beginner


Joined: 01 Dec 2000
Posts: 27

PostPosted: Thu Feb 26, 2004 2:34 pm   
 
That works, thanks!
Reply with quote
Kalus
Beginner


Joined: 01 Dec 2000
Posts: 27

PostPosted: Thu Feb 26, 2004 2:39 pm   
 
Just one more thing, lets say I want to use a variable to pick which element of the list I'm accessing. Using my earlier example if i wanted to access the third element of the string list spells, and I had a variable named placeholder who's value was 3, could I do something similar to #EXEC @spells.@placeholder? That doesn't work, but it seems like there should be a way to do it.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Feb 26, 2004 5:02 pm   
 
I believe something along the lines of

#exec %item(@spells,@placeholder)
Reply with quote
Kalus
Beginner


Joined: 01 Dec 2000
Posts: 27

PostPosted: Thu Feb 26, 2004 6:53 pm   
 
thank you so much, that works perfectly!
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