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 ➜ VBscript ➜ repeat command trigger?

repeat command trigger?

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


Posted by Grug   (15 posts)  Bio
Date Wed 25 May 2011 07:06 PM (UTC)
Message
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)
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 25 May 2011 10:16 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Grug   (15 posts)  Bio
Date Reply #2 on Thu 26 May 2011 07:55 AM (UTC)

Amended on Thu 26 May 2011 08:06 AM (UTC) by Grug

Message
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
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 26 May 2011 10:37 AM (UTC)

Amended on Thu 26 May 2011 10:38 AM (UTC) by Nick Gammon

Message
The very last entry suggested this:


'
' Get most recent command
'

  Send GetCommandList (1) (0)


That should do it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Grug   (15 posts)  Bio
Date Reply #4 on Thu 26 May 2011 10:57 AM (UTC)
Message
D'oh... that's... much simpler, thank you. :)
Top

Posted by Grug   (15 posts)  Bio
Date Reply #5 on Thu 26 May 2011 11:05 AM (UTC)
Message
Oh, one more thing, is there a way to have it send to execute rather than the world?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #6 on Thu 26 May 2011 09:54 PM (UTC)
Message
Replace the word Send by world.Execute.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Grug   (15 posts)  Bio
Date Reply #7 on Thu 26 May 2011 11:17 PM (UTC)
Message
Thank you muchly!
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.


29,429 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.