Schedule

Registers a function to be called after a certain timeout in milliseconds.

Prototypes
schedule(timeout, callback)
Parameters
    • timeout: the time in milliseconds after which the function is called.
    • callback: the function being called.
Usage
macro(10000, "Anti Kick",  function()
  local oldDir = direction()
  turn((oldDir + 1) % 4)
  schedule(1000, function() -- Schedule a function after 1000 milliseconds.
    turn(oldDir)
  end)
end)
singlehotkey("ctrl+1", "buy300Manas", function()
  NPC.say("hi")
  schedule(100, function() NPC.say("trade") end)
  schedule(200, function() NPC.buy(268, 100) end)
  schedule(300, function() NPC.buy(268, 100) end)
  schedule(400, function() NPC.buy(268, 100) end)
  schedule(500, function() NPC.say("bye") end)  
end)