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


Joined: 09 Jan 2004
Posts: 2
Location: China

PostPosted: 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
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: 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.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jan 09, 2004 7:17 pm   
 
Use an alias. They are designed for sending commands. Variables aren't.

#AL str {kick;jump}
Reply with quote
erique
Newbie


Joined: 09 Jan 2004
Posts: 2
Location: China

PostPosted: 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.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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.
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