API:SetEquippedItemVisible
From RoR Wiki
UI Lua API · Item functions
Version: WAR 1.4.8
Shows or hides the player's helm or cloak.
SetEquippedItemVisible(slotNumber, visible)
Arguments
- slotNumber
number–GameData.EquipSlots.HELMorGameData.EquipSlots.BACK.- visible
boolean–trueto show the item,falseto hide it.
Returns
Nothing.
Details
- Only
HELMandBACKdo anything. Any other slot is ignored. - If the requested state is already the current one, nothing is sent. Otherwise the client issues its helm or cloak toggle command.
- If there is no player object, or the client has no appearance data for the player, nothing happens.
visiblemust be a real boolean. Passingnilor a number raises an Invalid Parameters error.- The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument has the wrong type.
Example
From default/ea_characterwindow/source/characterwindow.lua:
function CharacterWindow.ShowHelm()
local showHelm = ButtonGetPressedFlag("CharacterWindowContentsEquipmentShowHelm")
SetEquippedItemVisible(GameData.EquipSlots.HELM, showHelm)
end
function CharacterWindow.ShowCloak()
local showCloak = ButtonGetPressedFlag("CharacterWindowContentsEquipmentShowCloak")
SetEquippedItemVisible(GameData.EquipSlots.BACK, showCloak)
