Skip to main content

Game Events

Built in game events that you can listen

  • KeyPressed -> (key: string)
  • KeyReleased -> (key: string)
  • ScriptLoaded -> (scriptName: string)
  • ScriptUnloaded -> (scriptName: string)
  • AxiomPresetLoaded -> (presetId: string)
  • ScenePresetLoaded -> (presetId: string)

Examples​

--key is UPPERCASE
local cb = function(key: string)
print(`[KeyEvent]={key}`)
end
_event.Bind("KeyPressed", cb)
_event.Bind("KeyReleased", cb)
local cb = function(name: string)
print(`[ScriptEvent]={name}`)
end
_event.Bind("ScriptLoaded", cb)
_event.Bind("ScriptUnloaded", cb)
-- Wait for a specific axiom preset to be loaded
_event.Bind("AxiomPresetLoaded", function(id)
if id ~= "MyCustomMap" then return end
-- ... do smth
end)