repeat command trigger?

Posted by Grug on Wed 25 May 2011 07:06 PM — 8 posts, 38,954 views.

#0
Sorry if this has been covered somewhere else, I couldn't find it.

Can someone help me write up a trigger that repeats the last command?

Like when the world says "you're ready!", it repeats the last command? (in a ctrl+r fashion)
Australia Forum Administrator #1
In VBscript?

See:

http://www.gammon.com.au/scripts/doc.php?function=GetCommandList

Near the bottom of that is a suggested way of getting back the last command (send it rather than note it). Just make a trigger that matches what you want, do "send to script", grab the last command and send it.
#2
Thank you, that's exactly what I needed. Works, but did I get it right?


Quote:

dim commandList
dim iCount

'
' resend last command
'
commandList = world.GetCommandList (1)

If Not IsEmpty (commandList) Then
For Each command In commandList
world.send command
Next
End If
Amended on Thu 26 May 2011 08:06 AM by Grug
Australia Forum Administrator #3
The very last entry suggested this:


'
' Get most recent command
'

  Send GetCommandList (1) (0)


That should do it.
Amended on Thu 26 May 2011 10:38 AM by Nick Gammon
#4
D'oh... that's... much simpler, thank you. :)
#5
Oh, one more thing, is there a way to have it send to execute rather than the world?
Australia Forum Administrator #6
Replace the word Send by world.Execute.
#7
Thank you muchly!