Thread Tools Display Modes
02-12-11, 10:30 AM   #1
hank
A Murloc Raider
 
hank's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 9
Add timer via OmniCC + 2 other small Questions

Hey there,

i write an small Strength of Soul (+ slowimmun buff 4-piece pvp set) oUF Plugin but ive no idea how to add a Timer like OmniCC do for Actionbuttons - may u can help me there? (btw there IS a timer but i would be better to see this overlay u know?)

Code (3files):
http://pastebin.com/fxnH93Gd
(CreatePanel, CreateShadow and Point are Tukui functions btw)

and the other 2 small question that came in my mind:
1.
Does
Code:
do
   stuff
   stuff
   stuff
end
make any sense? I mean the "do" without something like "for .. do" ?
Cause i saw code like this many times.

2.
Does this makes sense:
Code:
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function()
  stuff
  f:UnregisterEvent("PLAYER_ENTERING_WORLD")
end)
PLAYER_ENTERING_WORLD only occurs 1 time after /rl, correct? So why should I unregister this event? It just get loaded again after the next /rl?

Thanks in advance
hank
__________________
„Just avoid holding it that way“

Last edited by hank : 02-12-11 at 10:33 AM.
  Reply With Quote
02-12-11, 10:41 AM   #2
yssaril
A Warpwood Thunder Caller
 
yssaril's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 96
as far as the overlay goes i have no idea (check OmniCCs code)

question 1:
do ... end simply defines a chunk/block in the code anything local to that chunk can only be accessed from within the chunk as such it can be used to separate out code see http://www.lua.org/pil/1.1.html and http://www.lua.org/manual/5.1/manual.html#2.4.2 for more details

question 2:
PLAYER_ENTERING_WORLD fires every time you see a loading screen so if you use it to initialize some settings on login then you should unregister it after first use
  Reply With Quote
02-12-11, 11:09 AM   #3
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
OmniCC automatically adds timers to the widget-type Cooldown (unless told not to more or less), so if you want for OmniCC to provide the timer just add a Cooldown-frame.

http://wowprogramming.com/docs/widgets/Cooldown
__________________
Oh, the simulated horror!
  Reply With Quote
02-12-11, 11:54 AM   #4
hank
A Murloc Raider
 
hank's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 9
Thanks u both

Problem with the Cooldownframe is, that it resets everytime UNIT_AURA occures and ive no idea how to stop it.

I created a sos.cd frame now +
Code:
if sos.cd then
	sos.cd:SetCooldown(GetTime(), duration)
end
the duration is correct but yeah as I said...
i tried to add sos.cd:UnregisterEvent("UNIT_AURA") when its shown but that doesnt helped.
__________________
„Just avoid holding it that way“
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Add timer via OmniCC + 2 other small Questions


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