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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  A command loop maybe??
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

A command loop maybe??

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


Posted by UnderStriker   (7 posts)  [Biography] bio
Date Fri 02 Apr 2004 07:59 PM (UTC)
Message
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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,378 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 02 Apr 2004 11:32 PM (UTC)
Message
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>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #2 on Sat 03 Apr 2004 03:37 AM (UTC)
Message
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

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 UnderStriker   (7 posts)  [Biography] bio
Date Reply #3 on Tue 06 Apr 2004 02:00 PM (UTC)
Message
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..
[Go to top] top

Posted by Ked   Russia  (524 posts)  [Biography] bio
Date Reply #4 on Tue 06 Apr 2004 02:37 PM (UTC)
Message
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.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Wed 07 Apr 2004 02:51 AM (UTC)
Message
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.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[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.


5,624 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]