If last command was [this], then..

Posted by Zirnitra on Wed 06 Jan 2010 02:16 PM — 3 posts, 16,458 views.

#0
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?
USA #1
-- 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).
Amended on Wed 06 Jan 2010 03:46 PM by Twisol
USA #2
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