Difference between revisions of "Useful functions"
Zonkmachine (talk | contribs) (Link to Timer in codedoc) |
Zonkmachine (talk | contribs) (Fixup) |
||
Line 12: | Line 12: | ||
Timer:CallAt(Game.time+10, function () | Timer:CallAt(Game.time+10, function () | ||
− | Comms.Message("This one will be shown | + | Comms.Message("This one last will be shown", "Yoda") |
end) | end) | ||
Timer:CallAt(Game.time+6, function () | Timer:CallAt(Game.time+6, function () | ||
− | Comms.Message("This one will be shown in the middle", " | + | Comms.Message("This one will be shown in the middle", "Obi-Wan") |
end) | end) | ||
Timer:CallAt(Game.time+2, function () | Timer:CallAt(Game.time+2, function () | ||
− | Comms.Message("This one will be shown first", " | + | Comms.Message("This one will be shown first", "Obi Wan") |
end) | end) | ||
end | end |
Revision as of 19:56, 10 September 2022
Timer: Defined in src/lua/LuaTimer.cpp and documented in https://pioneerspacesim.net/codedoc/files/lua/LuaTimer-cpp.html.
local Comms = require 'Comms' local Game = require 'Game' local Event = require 'Event' local ui = require 'pigui' local Timer = require 'Timer' local onShipDocked = function (ship, station) if not ship:IsPlayer() then return end Timer:CallAt(Game.time+10, function () Comms.Message("This one last will be shown", "Yoda") end) Timer:CallAt(Game.time+6, function () Comms.Message("This one will be shown in the middle", "Obi-Wan") end) Timer:CallAt(Game.time+2, function () Comms.Message("This one will be shown first", "Obi Wan") end) end Event.Register("onShipDocked", onShipDocked)