Skip to content

OnScreenChange

One of the game’s player screens opened, the player switched to another, or they closed.

The player’s own key or tab, OpenScreen, CloseScreens or the server’s word. "other" is another of the game’s screens of that kind (crafting, a horse’s saddlebags).

function OnScreenChange(screen, previous)
-- ...
end
Parameter Type
screen string|nil "inventory", "character", "map", "codex", "journal" or "other"; nil = closed
previous string|nil the one before (nil = none was open)

nothing

function OnScreenChange(screen, previous)
SetUiVisible("compass_hint", screen == nil) -- the script's own hint only over the world
end

GetOpenScreen · OpenScreen · the The game’s screens group of the index