Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ActionButtonGroupSetTimer

From RoR Wiki

Starts or clears the cooldown timer on one button of an ActionButtonGroup.

ActionButtonGroupSetTimer(groupName, buttonIndex, total, remaining)

Arguments

groupName
string – Name of an ActionButtonGroup window.
buttonIndex
number – Button number, starting at 1.
total
number – Full length of the cooldown in seconds.
remaining
number – Seconds of cooldown left.

Returns

Nothing.

Details

  • The client stores total and the time at which the cooldown ends (now + remaining) and updates the button's countdown text at once.
  • If total or the time left is 0 or less, the timer is cleared and the countdown text is emptied. The stock UI passes 0, 0 to clear a timer.
  • The countdown text shows:
    • under 2.5 seconds left: the seconds with one decimal;
    • up to 90 seconds left: whole seconds;
    • more than 90 seconds left: whole minutes.
It is followed by the seconds or minutes abbreviation set with ActionButtonGroupSetTimeAbbreviations, if one is set.
  • buttonIndex must be between 1 and the number of buttons; otherwise the not a valid ButtonIndex error is raised. Fractions are dropped.

Errors

  • Error in function call 'ActionButtonGroupSetTimer': Window %s does not exist
  • Error in function call 'ActionButtonGroupSetTimer': Window %s is not a ActionButtonGroup
  • Error in function call 'ActionButtonGroupSetTimer': '%d' is not a valid ButtonIndex. (NumButtons = '%d')

Example

An item cooldown, from ea_backpackwindow/source/backpackiconview.lua:

local cooldownTimeLeft, totalCooldownTime = EA_Window_Backpack.GetItemCooldownTimers( itemData )
if( cooldownTimeLeft ~= nil )
then
    ActionButtonGroupSetTimer( buttonGroupName, buttonIndex, totalCooldownTime, cooldownTimeLeft )
else
    ActionButtonGroupSetTimer( buttonGroupName, buttonIndex, 0, 0 )
end

See also