Rapid fire Alias

Posted by Zeno on Sat 27 Sep 2003 08:43 PM — 14 posts, 49,236 views.

USA #0
I don't know how to explain what I want very well, but I was wondering how you would do something like this:
#5 kick
That would fire off 5 "kick" commands. Is there an option like this, or do I have to create an alias/scipt? Argh, its probably easy to do, I'm just not sure how to.
Canada #1

<aliases>
  <alias
   match="^#(\d*) (.*?)$"
   enabled="y"
   expand_variables="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>For x = 1 to %1
  World.LogSend &quot;%2&quot;
Next</send>
  </alias>
</aliases>

You will need to have scripting enabled, and this is VB script embedded in the alias. Just go into the world configuration, and set those appropriately under the scripting section of the configuration interface.
Canada #2
Hmm, here's an even better version:

<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.LogSend StringToSend
Next</send>
  </alias>
</aliases>

If you put more # symbols on your line, each subsequent one after the first will be replaced with the iteration number. For example:

#2 look at sword #

Would send:

look at sword 1
look at sword 2
USA #3
Ah, cool, works exactly like I wanted it too, thanks.
Greece #4
Or use the speedwalker, just change the speedwalk char to # and then type like #15n 3e 2s w n e, etc... or #5 (kick)...
Australia Forum Administrator #5
The speedwalk idea is probably the simplest, and doesn't involve scripting.

What you could do is make an alias that does the speedwalk idea, but puts in the brackets for you (send to "execute" to do this - or send to "speedwalk").
Australia Forum Administrator #6
What I mean is something like this:


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


What this will do is match on #(number) (command)

It then sends it to "speedwalk" after putting the command into brackets, so it works for any command.

eg.

#4 sigh



Russia #7
There one slight problem with this example - its impossible to repeat an alias a given number of times this way, since it send to speedwalk, and not to execute. SO ill stick with Jscript loop version.
Australia Forum Administrator #8
Yes, good point, however the earlier version did a world.LogSend which also would not evaluate aliases. However changing it to world.Execute would indeed do what you want.
Australia Forum Administrator #9
However this variant will work, but it needs the correct script language (this one is for VBscript), or to be slightly amended:


<aliases>
  <alias
   match="^#(\d+) (.*?)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.Execute EvaluateSpeedwalk ("%1 (%2)")</send>
  </alias>
</aliases>
Australia #10
One thing I noticed about using custom commands in speedwalks is that you can't use /, as it's a special character to signify the "reverse". Maybe there should be a way to escape this character somehow? In your example, "#5 hello men and/or women!" wouldn't work.
Australia Forum Administrator #11
Ah yes, well it is expanding speedwalks into areas for which they were not initially designed, I must admit.

I had thought myself that using the ")" character would not work either.

The simple example will work for simple things like:

#10 kick kobold

However if you are planning to do things like:

#20 say Hello men/women everywhere (whoever you may be)

Then it will fail because of the slash and the bracket.

In that case, use the version with the loop and bypass speedwalks.
#12
ok anyone know how I could add some sort of delay between the commands repeating
Australia Forum Administrator #13
Change the speedwalk delay, or make a script that does a "DoAfter" with an appropriately increasing delay for each command.