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


Joined: 09 Oct 2008
Posts: 7

PostPosted: Thu Oct 09, 2008 4:59 am   

#LOOP
 
Trying to figure out the #LOOP command...

I have a book with 150 pages. I am able to use a command -> book copy page <X> to <randomplayer>, which would copy page X to randomplayer's book.

(the book copy command is a builtin mud command)

What I would like to do is use the #loop command to copy all pages of my book to the other player similar to::


book copy page 1 to joe
book copy page 2 to joe
book copy page 3 to joe
...
book copy page 150 to joe

Also, I'd like an alias so i could type bc 10 20 joe which would result in output to the mud of:

book copy page 10 to joe
book copy page 11 to joe
...
book copy page 20 to joe

Many thanks!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Oct 09, 2008 7:55 am   
 
#alias bc {#loop %1,%2 {book copy page %i to %3}}

Usage:

bc 1 150 joe
bc 10 20 joe
bc 50 100 joe

Bear in mind that this will spam the commands all at once. If you want them to be stepped, this is one of the few times when adding a #wait command would be okay.

#alias bc {#loop %1,%2 {book copy page %i to %3;#wait 500}}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
TimTam
Newbie


Joined: 09 Oct 2008
Posts: 7

PostPosted: Thu Oct 09, 2008 8:18 am   
 
Thanks! works perfectly 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