| Message |
DoAfter() sets a timer with the delay you specify, and immediately continues with the script. That means that in this script, "hi" is shown first:
DoAfter(0.1, "lol")
DoAfter(0.2, "rofl")
print("hi")
And then as time passes, MUSHclient runs the timers as they're fired, so "lol" would come after 0.1 seconds, and 0.1 seconds after that (i.e. 0.2 seconds from being created) "rofl" would show up.
I'd suggest doing this:
function a(delay)
DoAfter(delay, "e")
end
function b()
DoAfter(0.1, "hp")
a(1.1)
DoAter(1.2, "l")
end
You could also try using the "wait.lua" module, which uses coroutines to give you a pause mechanism closer to what you expect.
require "wait"
function a()
Send("e")
end
wait.make(function()
wait.time(0.1)
Send("hp")
wait.time(1)
a()
wait.time(0.1)
Send("l")
end)
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | top |
|