Command repeater....

Posted by LupusFatalis on Tue 05 May 2009 11:15 PM — 3 posts, 14,446 views.

#0
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.
#1
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.
#2
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.