Thread Tools Display Modes
01-01-17, 02:27 AM   #1
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Seeking help with cooldowns

Hi all

I am looking for a bit of help with a cooldown button.
Here is my current code.
Code:
local testIconButton = CreateFrame("Button","testIconButton",UIParent)
testIconButton:SetSize(50,50)
testIconButton:ClearAllPoints()
testIconButton:SetPoint("CENTER")
testIconButton:SetNormalTexture("Interface\\Buttons\\UI-GroupLoot-DE-Up")
testIconButton:SetDisabledTexture("Interface\\Buttons\\UI-GroupLoot-DE-Highlight")
testIconButton:SetMovable(true)
testIconButton:SetClampedToScreen(true)
testIconButton:RegisterForDrag("RightButton")
testIconButton:SetScript("OnDragStart",testIconButton.StartMoving)
testIconButton:SetScript("OnDragStop",testIconButton.StopMovingOrSizing)
testIconButton:SetToplevel(true)
testIconButton:SetScript("OnClick",function(self)
      testIconButton:Disable()
      testIconButtonCooldown:SetCooldown(GetTime(),10)
      C_Timer.After(10,function()
            testIconButton:Enable()
      end)
end)

local testIconButtonCooldown = CreateFrame("Cooldown","testIconButtonCooldown",testIconButton,"CooldownFrameTemplate")
Here the current result.


What I want is to have the cooldown text to display seconds instead of milliseconds, and have either a cooldown that masks to the non-alpha or a round round cooldown instead of the square.

Any help will be great.
  Reply With Quote
01-01-17, 08:26 AM   #2
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
According to the API, http://wowprogramming.com/docs/api/GetTime returns seconds with milliseconds precision. Can you just change the formatting to meet your needs?

Not sure about the second part.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
01-02-17, 12:20 AM   #3
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Originally Posted by Walkerbo View Post
Here the current result.


What I want is to have the cooldown text to display seconds instead of milliseconds, and have either a cooldown that masks to the non-alpha or a round round cooldown instead of the square.

Any help will be great.
I was unable too to find a way to make the GCD rounded so I ended up in removing leaving only the numbers.

You have to use the frames names you need to change.

Lua Code:
  1. -- actionbar spiralcooldown, globalcd etc etc
  2. -- to enable set it to false
  3. -- to disable set it to true
  4. local disablecooldown = true
  5.  
  6. if disablecooldown then
  7.     for i,v in ipairs{"Action","MultiBarBottomLeft","MultiBarBottomRight","MultiBarRight","MultiBarLeft"} do
  8.      
  9.         for i = 1, 12 do
  10.             local cooldown = _G[v .. 'Button' .. i .. 'Cooldown']
  11.             cooldown:SetDrawBling(false)
  12.             cooldown:SetDrawSwipe(false)
  13.             cooldown:SetDrawEdge(false)
  14.             cooldown:SetSwipeColor(0, 0, 0, 0)
  15.         end
  16.     end
  17. end

If you instead find the way of make them rounded pls let me know
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.

Last edited by gmarco : 01-02-17 at 12:23 AM.
  Reply With Quote
01-02-17, 01:16 AM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Wrap GetTime() in ceil() to remove the milliseconds.

ceil(GetTime())
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Seeking help with cooldowns


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off