 |
erique Newbie
Joined: 09 Jan 2004 Posts: 2 Location: China
|
Posted: Fri Jan 09, 2004 4:29 am
help how to excute a variable |
For example,i got a variable in this way:#va str {kick;jump}
how to excute str.
By the way,version of zmud i used was 4.62 |
|
|
|
 |
Danlo Magician

Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Fri Jan 09, 2004 11:24 am |
Try: #forall %replace(@str,;,|) {%i}
I'm not sure if #forall is in 4.62, but could be. |
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jan 09, 2004 7:17 pm |
Use an alias. They are designed for sending commands. Variables aren't.
#AL str {kick;jump} |
|
|
|
 |
erique Newbie
Joined: 09 Jan 2004 Posts: 2 Location: China
|
Posted: Sat Jan 10, 2004 5:56 pm |
Thank for your replys.But the answer above can't resolver my problem.
Let me explain the problem i got.
I got a alias like this ->#alias cmds {east;east;south;south;south;west;west;north;north}
But for some reason I want excute part of this alias.
In another word,not all of the commands in this alias should be excuted.
For example i need excute cmd "east;south;south;south" in this alias.
So using %alias(cmds) and other functions ,i got the string #va str {east south south south}
Now I need excute this string.
Of course #exec {@str} is wrong way because #exec can only execute one commands at one time.
So I have to use #loop and #exec
The most important this is point:
First the commands i want to execute is only only be calcuted dynamicly.
Second #exec can only execute one commands at one time.
Third using #loop and #exec together is low effecient (For number of the cmds is very big)
Sorry I don't know weather U can andstander me,cause English is not my mother language. |
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Jan 10, 2004 6:47 pm |
Unfortunately, I have no real idea of what commands and functions were available in v4.62. If you have a solution which works, you are probably best to just continue using it.
You probably don't need the #EXEC command. MUD commands are just text and #LOOP will send text to the MUD without any need to execute it.
#AL cmds {east;east;south;south;south;west;west;north;north}
#LOOP 2,5 {%word( %alias( cmds), %i, ";")
You should only need #EXEC for zMUD commands such as #VARIABLE or #TRIGGER. Also, the #EXEC command will execute multiple commands in v6.62. |
|
|
|
 |
|
|
|