[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Rapid fire Alias
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Rapid fire Alias

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Sat 27 Sep 2003 08:43 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Sat 27 Sep 2003 11:51 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Sun 28 Sep 2003 12:27 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by Zeno   USA  (2,776 posts)  [Biography] bio
Date Sun 28 Sep 2003 01:22 AM (UTC)  quote  ]
Message
Ah, cool, works exactly like I wanted it too, thanks.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Sun 28 Sep 2003 03:07 AM (UTC)  quote  ]
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!
[Go to top] top

Posted by Nick Gammon   Australia  (15,683 posts)  [Biography] bio
Date Wed 21 Jan 2004 08:39 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (15,683 posts)  [Biography] bio
Date Wed 21 Jan 2004 08:49 AM (UTC)  quote  ]
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
[Go to top] top

Posted by Drauk   Russia  (7 posts)  [Biography] bio
Date Sun 25 Jan 2004 07:41 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (15,683 posts)  [Biography] bio
Date Sun 25 Jan 2004 09:59 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (15,683 posts)  [Biography] bio
Date Sun 25 Jan 2004 10:01 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Dave   Australia  (93 posts)  [Biography] bio
Date Tue 27 Jan 2004 09:52 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Nick Gammon   Australia  (15,683 posts)  [Biography] bio
Date Tue 27 Jan 2004 09:57 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Ashlog   (1 post)  [Biography] bio
Date Wed 23 Mar 2005 08:53 PM (UTC)  quote  ]
Message
ok anyone know how I could add some sort of delay between the commands repeating
[Go to top] top

Posted by Nick Gammon   Australia  (15,683 posts)  [Biography] bio
Date Thu 07 Apr 2005 04:46 AM (UTC)  quote  ]
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
[Go to top] 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.


2,689 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]