Messager
Variables
Update
Messager.Update
Is called every frame.
Example
self.RegisterListener(Messager.Update,MyFunction)
SlowUpdate
Messager.SlowUpdate
Is called every 20 frames.
Example
self.RegisterListener(Messager.SlowUpdate,MyFunction)
StartGameUI
Messager.StartGameUI
Is called when the main gameplay menu gets initialized.
Example
self.RegisterListener(Messager.StartGameUI,MyFunction)
EventAdded
Messager.EventAdded
Is called when an event gets added to the game state.
Example
self.RegisterListener(Messager.EventAdded,MyFunction)
DayStarted
Messager.DayStarted
Is called when the day is starting. It can also be called when you're changing islands.
Example
self.RegisterListener(Messager.DayStarted,MyFunction)
SceneStarted
Messager.SceneStarted
Is called when a new scene is started. It will be called when you first load into the game scene or when you change scenes to a new scene or to the dungeon. It will pass the scene's name as a parameter.
Example
self.RegisterListener(Messager.SceneStarted,MyFunction)
MainSceneStarted
Messager.MainSceneStarted
Is called when the main scene is started. It will be called when you first load into the game scene or when you go back to the main scene from another island or the dungeon.
Example
self.RegisterListener(Messager.MainSceneStarted,MyFunction)
DayEnded
Messager.DayEnded
Is called when the day is ending.
Example
self.RegisterListener(Messager.DayEnded,MyFunction)
FiveSecondsIntoDay
Messager.FiveSecondsIntoDay
Is called 5 seconds after the day started. (Or 5 seconds after you've changed islands)
Example
self.RegisterListener(Messager.FiveSecondsIntoDay,MyFunction)
PlayerConnected
Messager.PlayerConnected
Is called when a new player connected to the server. Player ID (int) is passed as a parameter.
Example
self.RegisterListener(Messager.PlayerConnected,MyFunction)
PlayerDisconnected
Messager.PlayerDisconnected
Is called when a new player disconnected to the server. Player ID (int) is passed as a parameter.
Example
self.RegisterListener(Messager.PlayerDisconnected,MyFunction)
OwnChatMessage
Messager.OwnChatMessage
Is called when the local player sends a message to chat. The message is sent as a parameter to the function registered.
Example
self.RegisterListener(Messager.OwnChatMessage,MyFunction)
AnyChatMessage
Messager.AnyChatMessage
Is called when any chat message is received. The message is sent as a parameter to the function registered. This can also be a message sent by the local player.
Example
self.RegisterListener(Messager.AnyChatMessage,MyFunction)
PausedGame
Messager.PausedGame
Is called when the game is paused and the pause menu is shown.
Example
self.RegisterListener(Messager.PausedGame,MyFunction)
UnpausedGame
Messager.UnpausedGame
Is called when the game was paused and it gets unpaused.
Example
self.RegisterListener(Messager.UnpausedGame,MyFunction)
TimePassed
Messager.TimePassed
Is called when time has passed in the game.
Example
self.RegisterListener(Messager.TimePassed,MyFunction)
HourPassed
Messager.HourPassed
Is called when an hour has passed in the game.
Example
self.RegisterListener(Messager.HourPassed,MyFunction)
LocalUpdate
Messager.LocalUpdate
Is called every frame the entity is active. Used for entities only.
Example
self.RegisterListener(Messager.LocalUpdate,MyFunction)
OnEnable
Messager.OnEnable
Is called a frame after the entity is enabled. Entity only.
Example
self.RegisterListener(Messager.OnEnable,MyFunction)
OnItemShifted
Messager.OnItemShifted
Is called when the entity is item shifted using the item shifter. Entity only.
Example
self.RegisterListener(Messager.OnItemShifted,MyFunction)
OnDisable
Messager.OnDisable
Is called the frame the entity is disabled. Entity only.
Example
self.RegisterListener(Messager.OnDisable,MyFunction)
UsableUpdate
Messager.UsableUpdate
Is called every frame a UsableLua usable is selected in the hotbar.
Example
self.RegisterListener(Messager.UsableUpdate,MyFunction)
UsableStarted
Messager.UsableStarted
Is called the first frame a UsableLua usable is selected in the hotbar. It will pass a parameter string with the item id selected so you can check for a specific usable in your code.
Example
self.RegisterListener(Messager.UsableStarted,MyFunction)
UsableEnded
Messager.UsableEnded
Is called the frame a UsableLua usable that was selected is no longer selected in the hotbar. Useful for cleanup.
Example
self.RegisterListener(Messager.UsableEnded,MyFunction)
UsableInteract
Messager.UsableInteract
Is called the frame the interact button is pressed while a UsableLua usable is selected.
Example
self.RegisterListener(Messager.UsableInteract,MyFunction)
UsableMouseClick
Messager.UsableMouseClick
Is called the frame the mouse click is pressed while a UsableLua usable is selected.
Example
self.RegisterListener(Messager.UsableMouseClick,MyFunction)