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 ➜ Command repeater....

Command repeater....

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


Posted by LupusFatalis   (154 posts)  Bio
Date Tue 05 May 2009 11:15 PM (UTC)
Message
I remember seeing a while back a question about how to repeat commands in mushclient... I know nick was using the speedwalk in his solution... here is my simple script:
def Repeat(AliasName, alias_line, wildcards):

	sTimes = int(wildcards[0])
	sActions = wildcards[1].split(',')

	for i in range(0, sTimes):
		for j in range(0, len(sActions)):
			world.Send(str(sActions[j]))
And the associated alias:
<aliases>
  <alias
   script="Repeat"
   match="^#(\d+) (.+)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  </alias>
</aliases>
You can make a plugin out of it I suppose. But I hope this helps someone.
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #1 on Tue 05 May 2009 11:18 PM (UTC)
Message
So... For example
#3 Boo
would send the following to the world:
Boo
Boo
Boo


and
#3 foo,bar
would send the world the following:
foo
bar
foo
bar
foo
bar
you can change the the deliminator to something other then ',' if you want. But I found that convenient.
Top

Posted by LupusFatalis   (154 posts)  Bio
Date Reply #2 on Wed 06 May 2009 11:29 PM (UTC)
Message
As an aside... it may be worthwhile to change
			world.Send(str(sActions[j]))

to
			world.Execute(str(sActions[j]))

if you are considering using this to work with aliases.
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.


11,360 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.