Thread Tools Display Modes
02-16-10, 03:51 AM   #1
Nytalgia
A Murloc Raider
Join Date: Feb 2010
Posts: 6
"If Death Knight"; If Pet Alive...

I've got a simple Problem at my interface..

I created some panels like in alekk ui, but one of them should only be activated if the character's pet is alive and the other should only be activated if the character got a stance bar with variable size...

How can i tell wow: "If Character is Druid, do panel druid stance bar", and so on?
How to: "If pet is alive, create pet panel, if pet is dismissed or dead, erase pet panel"

The Bars inside the panels are from Bartender.

I post the 2 postitions and my lua code for them:



--PetBar
CreatePanel("aPanels_PetBar01",0,0,218,31,background,border,"BOTTOMRIGHT","TOPRIGHT","aPanels_MButtons01",UIParent)
CreatePanel("aPanels_PetBar02",0,0,218,31,background,border,"BOTTOMRIGHT","TOPRIGHT","aPanels_MButtons01",UIParent)
--DruidStanceBar
CreatePanel("aPanels_StanceBar01",0,0,114,31,background,border,"BOTTOMLEFT","TOPLEFT","aPanels_MButtons01",UIParent)
CreatePanel("aPanels_StanceBar02",0,0,114,31,background,border,"BOTTOMLEFT","TOPLEFT","aPanels_MButtons01",UIParent)
  Reply With Quote
02-16-10, 01:25 PM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
You would want to make the parent of your panels the frames that they should hide/show with. That said, I'm not familiar with that UI but assuming the UIParent in those function calls is the parent being passed:

Code:
--PetBar
CreatePanel("aPanels_PetBar01",0,0,218,31,background,border,"BOTTOMRIGHT","TOPRIGHT","aPanels_MButtons01",PetActionBarFrame)
CreatePanel("aPanels_PetBar02",0,0,218,31,background,border,"BOTTOMRIGHT","TOPRIGHT","aPanels_MButtons01",PetActionBarFrame)
--DruidStanceBar
CreatePanel("aPanels_StanceBar01",0,0,114,31,background,border,"BOTTOMLEFT","TOPLEFT","aPanels_MButtons01",ShapeshiftBarFrame)
CreatePanel("aPanels_StanceBar02",0,0,114,31,background,border,"BOTTOMLEFT","TOPLEFT","aPanels_MButtons01",ShapeshiftBarFrame)
  Reply With Quote
02-16-10, 03:00 PM   #3
Nytalgia
A Murloc Raider
Join Date: Feb 2010
Posts: 6
Fine, it isnt perfect now, but your hint was good.

I changed the line for the pet frame into:

--PetBar
CreatePanel("aPanels_PetBar01",0,0,218,31,background,border,"BOTTOMRIGHT","TOPRIGHT","aPanels_MButtons01",BT4BarPetBar)
CreatePanel("aPanels_PetBar02",0,0,218,31,background,border,"BOTTOMRIGHT","TOPRIGHT","aPanels_MButtons01",BT4BarPetBar)

The Result: The Panel appears when i call a pet and disappears when i dismiss my pet, but the panel got the wrong size now :<




The Pet Bar in Bartender is scaled 0.65 - I think that's the reason why the panel scales down too? How can i fix this? :<

Last edited by Nytalgia : 02-16-10 at 03:15 PM.
  Reply With Quote
02-16-10, 03:49 PM   #4
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
Just multiply the sizes with a number to make the scale seem as 1.
Try different numbers untill you get what you want. 218*1.35 for an example.
__________________

  Reply With Quote
02-16-10, 07:18 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You don't even need to do that. Just reset the size of the panels to what you wish them to be.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-16-10, 08:08 PM   #6
Nytalgia
A Murloc Raider
Join Date: Feb 2010
Posts: 6
I did it now with the scale, this works, but i'm interested in the last post, how to resize them? :>

Last question in this thread: It finally worked with the petbar, but not with the stancebar, because a druid got 5 stances, a DK only 3 and so on.

Is it possible to build in something like "if DK then panel a, if druide then panel b"??
  Reply With Quote
02-16-10, 08:23 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I'm assuming one of those numbers in the CreatePanel function is for height and another is for width?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-16-10, 08:43 PM   #8
Nytalgia
A Murloc Raider
Join Date: Feb 2010
Posts: 6
Sure, but the pet bar is scaled down with 0.65 and the panel is scaled down too with the same 0.65, I dont know why... becasue of that i'd scaled up this panel by 1,538 to match the right size..
  Reply With Quote
02-16-10, 11:04 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Children frames inherit the scale of their parents.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-20-10, 06:54 AM   #10
Nytalgia
A Murloc Raider
Join Date: Feb 2010
Posts: 6
petbar is fine now, a lot of thanks!

but how should i handle the problem with the stancebar?

at the moment, i gave the stancebar a fix width, but when i'm playing a druid instead of my dk, the stancebar is much longer than the panel... any ideas? :\
  Reply With Quote
03-02-10, 09:27 PM   #11
Nytalgia
A Murloc Raider
Join Date: Feb 2010
Posts: 6
Noone got an idea? Please help me =(
  Reply With Quote
03-03-10, 10:55 AM   #12
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Code:
--StanceBar
local _, class = UnitClass('player')
local width
if class == 'DEATHKNIGHT' then
	width = 114
elseif class == 'DRUID' then
	width = 114
end
if width then
	CreatePanel("aPanels_StanceBar01",0,0,width,31,background,border,"BOTTOMLEFT","TOPLEFT","aPanels_MButtons01",ShapeshiftBarFrame)
	CreatePanel("aPanels_StanceBar02",0,0,width,31,background,border,"BOTTOMLEFT","TOPLEFT","aPanels_MButtons01",ShapeshiftBarFrame)
end
Change the width for each class until it fits the way you want.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » "If Death Knight"; If Pet Alive...


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