Skip to content

Events

events are fired when the action is triggered

RegisterEvent

Registers a new event

Args

It depends of the event

RegisterEvent(eventname, function(args)
    print("Hi event!")
end)

Events list

IsInGame

Fires when the player is in a save

RegisterEvent("IsInGame", function()
    print("Joined")
end)


OnJoinGame

Fires when the player loads a save

RegisterEvent("OnJoinGame", function()
    print("Joined")
end)


OnAsteroidDestroyed

Fires when the player destroy an asteroid

Args

count returns the number of asteroids destroyed since the save was created

RegisterEvent("OnAsteroidDestroyed", function(count)
    wait(1)
    print("Asteroids destroyed : " .. count)
end)

OnEnemieKilled

Fires when an enemie has been killed by the player

Args

count returns the number of enemies killed since the save was created

RegisterEvent("OnEnemieKilled", function(count)
    wait(1)
    print("Enemies killed : " .. count)
end)

OnCargoChanged

Fires when the player cargo changed

Args

count returns the current cargo that the player hold

RegisterEvent("OnCargoChanged", function(count)
    wait(1)
    print("Current cargo : " .. count)
end)

OnStationChanged

Fires when the player travels to a different station

Args

id returns the current station id

RegisterEvent("OnStationChanged", function(id)
    wait(1)
    print("Station id is " .. id)
end)

OnStationDocked

Fires when the player docked in a station

RegisterEvent("OnStationDocked", function()
    wait(1)
    print("You docked in this station " .. station.name)
end)


IsInMainMenu

Fires when the player is in the main menu

RegisterEvent("IsInMainMenu", function()
    print("Main menu")
end)


OnMoneyChanged

Fires when the player money changed

Args

money returns the current player money

RegisterEvent("OnMoneyChanged", function(money)
    print("Current money : " .. money)
end)

OnSystemChanged

Fires when the player travels to a different system

Args

id returns the current system id

RegisterEvent("OnSystemChanged", function(id)
    wait(1)
    print("System id : " .. id)
end)

OnUpdate

Fires every ticks

RegisterEvent("OnUpdate", function()
    print("Update!")
end)


EarlyInit

Warning

This event isn't async, wait() does not work here

Args

This event is mandatory if you want to create new contents in the game such as custom ships, custom items and more

RegisterEvent("EarlyInit", function()
    print("Early init")
end)