Thread Tools Display Modes
11-02-10, 07:02 PM   #1
Krag72
A Deviate Faerie Dragon
Join Date: Sep 2008
Posts: 14
Registering frame events

I've never really gotten comfortable with tags (and yes, I really should just look at a few layouts and learn it) so I still use update functions for pretty much everything.

One thing I always run into is registering the name update event. Right now I do something like this (which I'm sure isn't quite the way to do go) to get it to work
Code:
	self.UNIT_NAME_UPDATE = UpdateName
	table.insert(self.__elements, UpdateName)
So I was wondering if there's a better/easier/more correct way to do stuff like this (apart from just using the tags already of course)?
  Reply With Quote
11-02-10, 08:22 PM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Just use tags, really. It's clean and easy.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
11-03-10, 12:40 AM   #3
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Registering events:
Code:
self:RegisterEvent('EVENT', function)
Do note that oUF doesn't unregister events when you register the same event twice (to different functions). oUF will call myFunction and myOtherFunction when UNIT_AURA triggers.
Code:
self:RegisterEvent('UNIT_AURA', myFunction)
self:RegisterEvent('UNIT_AURA', myOtherFunction)
You might also want to know that:
Code:
table.insert(self.__elements, UpdateName)
Isn't directly related to events. It's how we can piggyback on the elements system to force updates of our function when oUF does a full update cycle.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
11-03-10, 09:34 AM   #4
Krag72
A Deviate Faerie Dragon
Join Date: Sep 2008
Posts: 14
Thanks for the explanation. It ended up with my mistakes stemming from the notion that UNIT_NAME_UPDATE was getting fired when I changed targets, when in fact it pretty much never gets fired at all (I need to find some regular mob that changes names so I can test that part of my frames) and thus "needing" to run on full updates for anything to happen.

I registered PLAYER_TARGET_CHANGED in addition now and after a little fiddling everything is just peachy
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Registering frame events


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