Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:SetHotbarData

From RoR Wiki

UI Lua API · Hotbar functions
Version: WAR 1.4.8

Puts an action into a hotbar slot, or clears the slot.

SetHotbarData(slot, actionType, actionId)

Arguments

slot
number – Hotbar slot, 1 to 132 (GameData.HOTBAR_TOTAL_SLOT_COUNT). A value of 0 or less places the action in the first empty slot; the stock UI uses -1.
actionType
number – Type of the action, a GameData.PlayerActions value. 0 together with actionId 0 clears the slot.
actionId
number – Id of the action (ability id, item id, macro slot, …).

Returns

Nothing.

Details

  • Before writing, the client checks the slot and the ability against the player's hotbar state and does nothing if the check fails.
  • If the slot already holds the same action, nothing changes.
  • When the slot changes, the client sends the change to the server for slots that the server stores, and notifies the UI for every hotbar slot that shows this entry.
  • If no slot is empty when slot is 0 or less, nothing is stored.
  • For a slot above 132 the error below is logged (not raised as a Lua error) and nothing changes.

Errors

  • Error in function call 'SetHotbarData': slot must be less than GameData.HOTBAR_TOTAL_SLOT_COUNT. (logged)
  • The generic Invalid Parameters message when an argument is not a number.

Example

Placing an ability in the first free slot, from ea_abilitieswindow/source/abilitieswindow.lua:

SetHotbarData( -1, GameData.PlayerActions.DO_ABILITY, abilityData.id )

Clearing a slot, from ea_actionbars/source/actionbutton.lua:

SetHotbarData (self:GetSlot (), 0, 0)

See also