|
TimTam Newbie
Joined: 09 Oct 2008 Posts: 7
|
Posted: 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! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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}} |
|
|
|
TimTam Newbie
Joined: 09 Oct 2008 Posts: 7
|
Posted: Thu Oct 09, 2008 8:18 am |
Thanks! works perfectly
|
|
|
|
|
|