Jump to content

  • Curse Sites
Help

CastingBar Issue


  • Please log in to reply
1 reply to this topic

#1 Syncrow

Syncrow
  • Premium
  • Curse Premium
  • Posts: 182

Posted 05 January 2013 - 02:04 PM

Hi, i'm working on my lil CastingBar Addon but one thing seems not want to work...

CastingBar = CreateFrame("StatusBar")
CastingBar:SetStatusBarTexture(1,0,1)
CastingBar:GetStatusBarTexture():SetHorizTile(false)
CastingBar:SetReverseFill(true)
CastingBar:SetWidth(100)
CastingBar:SetHeight(15)
CastingBar:SetPoint("CENTER",UIParent,0,0)
local function OnUpdate(self)
local spell, _, _, _, startTime, endTime = UnitCastingInfo("player")
if spell then
  --ChatFrame1:AddMessage(spell .. ' will be finished casting in ' .. endTime/1000 - GetTime() .. ' seconds.')
  CastingBar:SetMinMaxValues(0, startTime)
  CastingBar:SetValue(endTime/1000 - GetTime())
else
  CastingBar:SetValue(0)
end
end
CastingBar:SetScript("OnUpdate", OnUpdate)

CastingBar:SetMinMaxValues(0, startTime) seems to work with a number like:
CastingBar:SetMinMaxValues(0, 10)
but don't know how to get the whole castingtime to set the MaxValue...

#2 Syncrow

Syncrow
  • Premium
  • Curse Premium
  • Posts: 182

Posted 05 January 2013 - 02:56 PM

solved it by myself ;)
CastingBar:SetMinMaxValues(0, (endTime/1000) - (startTime/1000))





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

<