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


Joined: 13 Mar 2007
Posts: 5

PostPosted: Tue Mar 13, 2007 7:35 pm   

forall syntax question
 
ok ... here's another easy question that I am struggling with ... I would like to pass an alias and list of values in one line and have the alias iterate through my list:



#ALIAS cf {cast spell} %1


list="values passed at command line"

#FORALL @list {cf %i}


between each casting of the spell I need to pause until I recover my equilibrium (a great movie btw).


something like this

foreach %1
do something
wait for specific condition
next %1

I can't find all the syntax I need in the help files ...


signed with love,

an idiot!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Mar 13, 2007 7:48 pm   
 
Firstly, your alias should probably look like this:

#alias cf {cast spell %1}

to ensure that the %1 is properly added.

Secondly, #forall probably isn't the right way to do this. The easiest way would be just to use #wait:

#forall @list {cf %i;#wait 2000}

but #wait can cause problems. A better way would probably be something like this:

#var Equilibrium 1
#trig {You have recovered equilibrium} {#var Equilibrium 1}
#trig {@Equilibrium=1} {cf %pop(@list);#var Equilibrium 0} "" {exp}
Reply with quote
bcglassman
Newbie


Joined: 13 Mar 2007
Posts: 5

PostPosted: Tue Mar 13, 2007 8:14 pm   
 
Fang Xianfu wrote:

#var Equilibrium 1
#trig {You have recovered equilibrium} {#var Equilibrium 1}
#trig {@Equilibrium=1} {cf %pop(@list);#var Equilibrium 0} "" {exp}


perfect ... I used

#alias cf {abjure cosmicfire %1}
#var Equilibrium 1
#trig {You have recovered equilibrium} {#var Equilibrium 1}
#trig {@Equilibrium=1} {
cf %pop( @list)
#var Equilibrium 0
} "" {exp}

and it iterates beautifully ... THANK YOU Very Happy Very Happy
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