Thread Tools Display Modes
02-05-11, 06:31 PM   #1
kneeki
A Flamescale Wyrmkin
 
kneeki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 134
LibCandyBar and starting the bar at a given point

I'd like to know if it's possible using LibCandyBar to say, start a bar with a total of 30 seconds, but start it at any given second point I like.

So something like:
Code:
bar:SetMaxDuration(maxDuration)
bar:SetDuration(format("%.2f", expires - GetTime()))
  Reply With Quote
02-05-11, 07:31 PM   #2
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
With LibCandyBar-3.0, you should be able to adjust the start time like this:
Code:
local Progress, Max = 10, 30; -- Start 10 seconds into the 30 second timer.
Bar:SetDuration( Max );
Bar:Start(); -- Must be started before you adjust "exp"
Bar.exp = Bar.exp - Progress;

Last edited by Saiket : 02-05-11 at 07:37 PM.
  Reply With Quote
02-05-11, 07:36 PM   #3
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Code:
-- Set the time left for a bar.
-- Args: name - the candybar name
--	   time - time left on the bar
-- returns true if succesful

CandyBar:SetTimeLeft(name,
could be what you're looking for.

[Edit]
Took that from 2.0. Don't know if 3.0 has a SetTimerLeft method.

Last edited by Duugu : 02-05-11 at 07:39 PM.
  Reply With Quote
02-05-11, 07:41 PM   #4
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
Originally Posted by Duugu View Post
Took that from 2.0. Don't know if 3.0 has a SetTimerLeft method.
I couldn't find one for 3.0. Seems like the only way to set it is by modifying that exp variable directly. One would think a method like that would be worth keeping in a bar library...
  Reply With Quote
02-05-11, 08:02 PM   #5
kneeki
A Flamescale Wyrmkin
 
kneeki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 134
bar.exp is exactly what I needed, thanks!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LibCandyBar and starting the bar at a given point

Thread Tools
Display Modes

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