API:ActionButtonGroupSetTimer
From RoR Wiki
UI Lua API · ActionButtonGroup functions
Version: WAR 1.4.8
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
totaland the time at which the cooldown ends (now +remaining) and updates the button's countdown text at once. - If
totalor the time left is 0 or less, the timer is cleared and the countdown text is emptied. The stock UI passes0, 0to 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.
buttonIndexmust 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 existError in function call 'ActionButtonGroupSetTimer': Window %s is not a ActionButtonGroupError 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
