Thread Tools Display Modes
04-23-05, 06:49 PM   #1
Inokis
EQInterface Staff
 
Inokis's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 156
Help with PetFrame 'pet experience bar'

I'm trying to add a pet experience bar to my PetFrame xml, however so far I can only get it to display after visiting the Stable Master. I'm not sure what i'm doing wrong but perhaps someone can help me out here:

LUA:
Code:
function PetFrame_OnLoad()
      this:RegisterEvent("UNIT_PET_EXPERIENCE");
      PetFrameExpBar_Update();
end

function PetFrame_Update()
      PetFrameExpBar_Update();
end

function PetFrame_OnEvent(event)
      UnitFrame_OnEvent(event);
      	if ( event == "UNIT_PET_EXPERIENCE" ) then
		PetFrameExpBar_Update();
	end
end

function PetFrameExpBar_Update()
	local currXP, nextXP = GetPetExperience();
	PetFrameExpBar:SetMinMaxValues(min(0, currXP), nextXP);
	PetFrameExpBar:SetValue(currXP);
end
XML:
Code:
<StatusBar name="PetFrameExpBar" inherits="TextStatusBar">
     <Size>
	<AbsDimension x="122" y="3"/>
     </Size>
	<Anchors>
   	     <Anchor point="TOPLEFT">
		<Offset>
			<AbsDimension x="-5" y="-18"/>
		</Offset>
	    </Anchor>
	</Anchors>
	<Scripts>
		<OnLoad>
			PetFrameExpBar_Update();
			TextStatusBar_Initialize();
			this:Show();
		</OnLoad>
		<OnEvent>
			PetFrameExpBar_Update();
		</OnEvent>
	</Scripts>
	<BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
		<BarColor r="1.0" g=".32" b="1.0"/>
</StatusBar>
__________________
If not yourself, who can you count on...

Last edited by Inokis : 04-23-05 at 06:51 PM.
  Reply With Quote
04-24-05, 02:09 AM   #2
Inokis
EQInterface Staff
 
Inokis's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 156
I finally got it to work:

this:RegisterEvent("PET_BAR_UPDATE");
__________________
If not yourself, who can you count on...
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with PetFrame 'pet experience bar'

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