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 ➜ If last command was [this], then..

If last command was [this], then..

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


Posted by Zirnitra   (8 posts)  Bio
Date Wed 06 Jan 2010 02:16 PM (UTC)
Message
I'm aliasing navigational inputs but I want a basic solution to "you must swim in that direction". I was thinking a trigger could just add "swim" before the last command and send it again. How can I do that?
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Wed 06 Jan 2010 03:43 PM (UTC)

Amended on Wed 06 Jan 2010 03:46 PM (UTC) by Twisol

Message
-- GetCommandList(1) returns an array, but we're only interested in the first element.
local lastCommand = GetCommandList(1)[1]

SendNoEcho("swim " .. lastCommand(


EDIT: Unfortunately it's really not that simple, because you might have sent multiple commands at once (i.e. Send("east\nnorth\nup") or ctrl+Enter in the input box to add a newline), or (depending on what game you play) someone might have "illusioned" that line (causing you to execute whatever you last entered, but with swim before it).

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #2 on Wed 06 Jan 2010 04:36 PM (UTC)
Message
I think the easiest method would be a match all alias that keeps evaluating. If it is a directional command or a special directional command, it will store it in a variable. Then have a trigger that triggers on that message, and it will read that variable and send it with 'swim' prepended.

-Onoitsu2
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.


12,947 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.