Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Rapid fire Alias

Rapid fire Alias

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Zeno   USA  (2,871 posts)  Bio
Date Sat 27 Sep 2003 08:43 PM (UTC)
Message
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.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Sat 27 Sep 2003 11:51 PM (UTC)
Message

<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.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #2 on Sun 28 Sep 2003 12:27 AM (UTC)
Message
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

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Sun 28 Sep 2003 01:22 AM (UTC)
Message
Ah, cool, works exactly like I wanted it too, thanks.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #4 on Sun 28 Sep 2003 03:07 AM (UTC)
Message
Or use the speedwalker, just change the speedwalk char to # and then type like #15n 3e 2s w n e, etc... or #5 (kick)...

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 21 Jan 2004 08:39 AM (UTC)
Message
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").

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Wed 21 Jan 2004 08:49 AM (UTC)
Message
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




- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Drauk   Russia  (7 posts)  Bio
Date Reply #7 on Sun 25 Jan 2004 07:41 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #8 on Sun 25 Jan 2004 09:59 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #9 on Sun 25 Jan 2004 10:01 PM (UTC)
Message
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>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Dave   Australia  (93 posts)  Bio
Date Reply #10 on Tue 27 Jan 2004 09:52 PM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #11 on Tue 27 Jan 2004 09:57 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ashlog   (1 post)  Bio
Date Reply #12 on Wed 23 Mar 2005 08:53 PM (UTC)
Message
ok anyone know how I could add some sort of delay between the commands repeating
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #13 on Thu 07 Apr 2005 04:46 AM (UTC)
Message
Change the speedwalk delay, or make a script that does a "DoAfter" with an appropriately increasing delay for each command.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


36,227 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.