View Single Post
02/22/14, 10:53 PM   #2
Lyeos
 
Lyeos's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 6
Originally Posted by Capadillo View Post
EDIT: I am assuming that "EVENT_POWER_UPDATE" will return all of the information for updating the individual powers as well, so we would only need to use "GetUnitPower" to force an update, or during login?
Yes, exactly

First you have your event:
EVENT_POWER_UPDATE (string unitTag, luaindex powerIndex, integer powerType, integer powerValue, integer powerMax, integer powerEffectiveMax)

You have to register it before using it like this:
Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("YOUR_ADDON_NAME", EVENT_POWER_UPDATE, eventUpdatePower)
You can see a line like this at the beginning of almost every addon.

Then your first function will be:
Lua Code:
  1. local function eventUpdatePower(eventCode, unit, powerIndex, powerType, powerCurrent, powerMax)
  2. ...

For what remains I think you are pretty much right.
You need more things (Controls, Anchor, etc...) but you are in the good way

Last edited by Lyeos : 02/22/14 at 10:57 PM.
  Reply With Quote