WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   "If Death Knight"; If Pet Alive... (https://www.wowinterface.com/forums/showthread.php?t=30705)

Nytalgia 02-16-10 03:51 AM

"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)

Vrul 02-16-10 01:25 PM

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)


Nytalgia 02-16-10 03:00 PM

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? :<

sacrife 02-16-10 03:49 PM

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.

Seerah 02-16-10 07:18 PM

You don't even need to do that. Just reset the size of the panels to what you wish them to be.

Nytalgia 02-16-10 08:08 PM

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"??

Seerah 02-16-10 08:23 PM

I'm assuming one of those numbers in the CreatePanel function is for height and another is for width?

Nytalgia 02-16-10 08:43 PM

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..

Seerah 02-16-10 11:04 PM

Children frames inherit the scale of their parents.

Nytalgia 02-20-10 06:54 AM

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? :\

Nytalgia 03-02-10 09:27 PM

Noone got an idea? Please help me =(

Vrul 03-03-10 10:55 AM

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.


All times are GMT -6. The time now is 07:55 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI