Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-30-05, 08:10 PM   #1
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
WoW API so called events -> need help

I'm slowlly starting to run out of patience (and options)...

Today when i was programing pet xp bar addon i encountered another problem with WoW API events.

I was programing part responsible for showing hiding exp bar and seting proper exp values in status bar. So first i looked for events which fire when player summons pet and when pet exp changes. I found two such events "PLAYER_PET_CHANGED" and "UNIT_PET_EXPERIENCE".

Then i programed proper functions and everything was looking perfectly fine, but actually wasn't even half fine. After few tests and tons of relogs i learned that:

"PLAYER_PET_CHANGED" event fires like 5 times when you log to game (and your pet is curently with you). Which is fine, _but_ every time when i get "PLAYER_PET_CHANGED" event and i check for exp values using:

Onevent function fragment:

if (event == "PLAYER_PET_CHANGED") then
		if ( UnitExists("pet") ) then
PetXPBarAddon_Update function fragment:

currXP, nextXP = GetPetExperience();
both currXP, nextXP are equal 0

so basicaly there is pet but it has no exp...

Well so i said ok... maybe it was bad event to use... so i checked "UNIT_PET_EXPERIENCE"

Now most funny thing... it also fires few times when you log (with your pet) but again every time xp values are equal 0 ... But if i check for exp manualy (using proper test function) sec after everything is loaded i get good xp values...

Now... i understand that there is some problem with timings, but can anyone explain me why those events fire so many times when loading/loging but actually they seem to be false informing you that pet already is loaded, and that pet exp was already set on proper values...

And 2nd request, anyone have idea how to do it properly? (ie show pet exp bar same sec when ui is loaded and user already see his pet frame) By properly i mean using events bacause i already found indirect way (i show/update pet exp bar when pet action bar shows and it seem working fine for now but i don't think it is the way it should be...)

Anny help will be appreciated

BTW sorry for my funny english... i hope it is understandable
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » WoW API so called events -> need help

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