WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Help with Scripting - kgPanels (https://www.wowinterface.com/forums/showthread.php?t=37101)

.SkyBreaker 11-27-10 10:00 AM

Help with Scripting - kgPanels
 
Hey all out there,

I think I need some help with scripting for the addon kgPanels...

For my interface I want to set up kgPanels for in and out vehicle use.
I want to show up a specific Panel if you're not in a vehicle, and another panel if you're in one.

For now, the script I use... work... sometimes. That suck... Looks like this now:

OnLoad (Panel 1 and 2):
self:RegisterEvent ("UNIT_ENTERED_VEHICLE")
self:RegisterEvent ("UNIT_EXITED_VEHICLE")


OnEvent (Panel 1):
if event == "UNIT_ENTERED_VEHICLE" then
self:Hide()
elseif event == "UNIT_EXITED_VEHICLE" then
self:Show()
end


OnEvent (Panel 2):
if event == "UNIT_ENTERED_VEHICLE" then
self:Show()
elseif event == "UNIT_EXITED_VEHICLE" then
self:Hide()
end


Sometimes it's just inversed... Or just switch in mid fight in Battlegrounds (when someone else uses a vehicle?)
I was thinking about something about "in" or "not in" vehilce instead of "entered" or "exited" or something that only counts for my self... Don't know, but I don't find anything related to that.

Maybe you know something about that... :confused:

Waky 11-27-10 10:34 AM

Try this out:

Code:

--OnEvent (Panel 1):
if event == "UNIT_ENTERED_VEHICLE" then
        if (CanExitVehicle()==1) then
                self:Hide()
        end
elseif event == "UNIT_EXITED_VEHICLE" then
        if (CanExitVehicle()==nil) then
                self:Show()
        end
end

--OnEvent (Panel 2):
if event == "UNIT_ENTERED_VEHICLE" then
    if (CanExitVehicle()==1) then
                self:Show()
        end
elseif event == "UNIT_EXITED_VEHICLE" then
    if (CanExitVehicle()==nil) then
                self:Hide()
        end
end

To my understanding it's exactly what you said would be wrong, that event listens for anyone to enter/leave a vehicle so it'd be going crazy on and off without you.

Lemme know if this works!

.SkyBreaker 11-27-10 11:27 AM

Hey Waky...

I have tried that out what you've posted but doesn't work. Now it shows me up both panels when in and when out of vehicle :/

Edit: Ok works how it should! My fault, just forgot to add the OnLoad Script >.<

Thanks

/cheer

Waky 11-27-10 12:49 PM

Quote:

Originally Posted by .SkyBreaker (Post 220096)
Hey Waky...

I have tried that out what you've posted but doesn't work. Now it shows me up both panels when in and when out of vehicle :/

Edit: Ok works how it should! My fault, just forgot to add the OnLoad Script >.<

Thanks

/cheer

Lol sorry about not posting that, I didn't make a change to it so I assumed I didn't have to post it :P

I'm glad it worked!


All times are GMT -6. The time now is 06:32 PM.

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