A command loop maybe??

Posted by UnderStriker on Fri 02 Apr 2004 07:59 PM — 6 posts, 27,719 views.

#0
heh, was wondering if this client could have a command called like.. $loop 20 *command*

Would be cool so spamming, or making triggers for the certain task isn't always required..

Peace.
Australia Forum Administrator #1
This has been covered fairly recently. Someone wrote an example alias that would do it. Also, you could use speedwalking to do it.

For example, if your speedwalk prefix is ! (you can configure this in the "commands" configuration) then typing:

!5(say hello)

Sends "say hello" 5 times to the MUD.

If you don't want to type the brackets you can make an alias to do it for you. For example, this alias would do your exact suggested syntax:


<aliases>
  <alias
   match="^\$loop (\d{1,2}) (.*?)$"
   enabled="y"
   regexp="y"
   send_to="11"
   sequence="100"
  >
  <send>%1(%2)</send>
  </alias>
</aliases>

Canada #2
Here's my version of the alias. The way it works, you start the alias with # followed by digits indicating how many times you would like to repeat the rest of the line. If there are # characters in the rest of the line, they are replaced with the iteration number.
<aliases>
  <alias
   match="^#(\d*) (.*?)$"
   enabled="y"
   expand_variables="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>StringToRepeat = &quot;%2&quot;
For x = 1 to %1
  StringToSend = Replace(StringToRepeat, &quot;#&quot;, x, 1, -1, 1)
  World.Execute StringToSend
Next</send>
  </alias>
</aliases>
So, for example, you could:

#5 look monster

which would:

look monster
look monster
look monster
look monster
look monster

or you could:

#5 look monster #

which would:

look monster 1
look monster 2
look monster 3
look monster 4
look monster 5
#3
Do you happen to know how that could be done within the program itself? Since whenever i seem to try to add it, it gives me bad format for it :(

I'm not sure why its doing this, i copied it exactly how it is up here..
Russia #4
It works for me just fine. Make sure you copy only the alias - everything between and including the <aliases></aliases> tags. Make sure you are pasteing it in the Aliases dialogue, not the Triggers one. Make sure that scripting is enabled, and the script language is set to vbscript.
USA #5
You might also be having problems if your client doest support send to script, its has been around for a while. If youre not using the most recent version, you should think about upgrading.