Thread Tools Display Modes
11-23-06, 09:18 PM   #1
slymm
A Murloc Raider
Join Date: Sep 2005
Posts: 8
Requires reloading ui

My apologies if this has been covered before, but I didn't see anything off hand.

First, Code Knowledge. While I'm a novice of XML and LUA code, I'm quite adept at LPC which is somewhat similar, so I'm at least able to decipher the code.

Now, I'm working on a PlayerFrame that resembles the one from W3. I've got many things working that I didn't think I'd be able to figure out, like a 3D model of the current character and stats listed on the widget. My problem lies in that when I first log in, the portrait is empty and the stats/level are set to 0. Only after I reload the ui does the 3d portrait show and the stats and level update to the current values.

I have tried running the Portrait and stats through OnLoad and OnShow with each pointing to:
function UpdatePortrait()
Set3DPortrait(PlayerWindow_PortraitFrame_Portrait3D, "player")
end

function Set_Strings()
NameText:SetText(UnitName("player"));
LevelText:SetText(format(TEXT(PLAYER_LEVEL),UnitLevel("player"), UnitRace("player"), UnitClass("player")));
Get_Stats()
end
The Player name and stat labels show up just fine, it's just the numerical data and the portrait that aren't loading.

Any suggestions on where I might look for getting the data to load correctly?
  Reply With Quote
11-24-06, 05:38 PM   #2
Karrion
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 23
If you're calling that in OnLoad, much of the information is not available to the UI yet. Try calling it through OnEvent where event==PLAYER_LOGIN.

Don't forget you'll need to catch any other events that might change the stats and update your display, eg PLAYER_LEVEL_UP ;-)
  Reply With Quote
11-25-06, 01:39 AM   #3
slymm
A Murloc Raider
Join Date: Sep 2005
Posts: 8
Thanks

Thank you for that, I'll change up the code and see if it works better. And yeah, I have it checking for other events so that the stats and everything get changed if I level or add/remove armor. Thanks again.
  Reply With Quote
11-25-06, 01:45 AM   #4
slymm
A Murloc Raider
Join Date: Sep 2005
Posts: 8
It worked

Well look at that, set it to trigger off of PLAYER_ENTERING_WORLD and it works like a charm... now if I can just figure out health/mana bars I'll be rocking.

Thank you again, again. And one more time.
  Reply With Quote
11-25-06, 11:13 AM   #5
sarf
A Cyclonian
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 47
If you mean updating health/mana bars:

Use the events UNIT_MANA and UNIT_HEALTH (check so that arg1 == "player" ) and update them at those events.

Sarf
  Reply With Quote
11-26-06, 05:33 PM   #6
Karrion
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 23
Originally Posted by sarf
Use the events UNIT_MANA and UNIT_HEALTH (check so that arg1 == "player" ) and update them at those events.
And UNIT_RAGE and UNIT_ENERGY for us non-mana-users ;-)
  Reply With Quote
11-26-06, 05:40 PM   #7
sarf
A Cyclonian
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 47
Pfah, just stuff it and and spam Sunder Armor / Sinister Strike.

Sarf
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Requires reloading ui


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