 |
Kalus Beginner
Joined: 01 Dec 2000 Posts: 27
|
Posted: 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 |
|
|
|
 |
DeReP Adept
Joined: 14 Jun 2003 Posts: 222 Location: Chile
|
Posted: 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 |
|
|
|
 |
Kalus Beginner
Joined: 01 Dec 2000 Posts: 27
|
Posted: 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.
|
|
|
|
 |
Serentus Apprentice
Joined: 28 Sep 2001 Posts: 103 Location: USA
|
Posted: Thu Feb 26, 2004 6:45 am |
Have you tried
#EXEC {@spells.3} |
|
|
|
 |
Kalus Beginner
Joined: 01 Dec 2000 Posts: 27
|
Posted: Thu Feb 26, 2004 2:34 pm |
That works, thanks!
|
|
|
|
 |
Kalus Beginner
Joined: 01 Dec 2000 Posts: 27
|
Posted: 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.
|
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Feb 26, 2004 5:02 pm |
I believe something along the lines of
#exec %item(@spells,@placeholder) |
|
|
|
 |
Kalus Beginner
Joined: 01 Dec 2000 Posts: 27
|
Posted: Thu Feb 26, 2004 6:53 pm |
thank you so much, that works perfectly!
|
|
|
|
 |
|
|
|