kgPanels
Create panels for customizing your UI, sucessor to eePanels
OnClick now provides a pressed and released variable you can check for.
if pressed then -- do mouse down actions elseif released then -- do mouse up actions end
This means your script will get called twice when someone clicks the panel.
Here is a youtube link to a video Tutorial
Ive created an Example Texture Pack.
This example pack is just a template. If you want to use it as a storage spot for your art, look at the read me file for directions on usage.
Excellent! If those scripts work, then you should be able to do something based on whether you enter or exit a vehicle (arg1 == "player"), and ignore those events where someone else enters or exits a vehicle (arg1 == "partyN" or arg1 == "raidN" where N is a number representing a particular member of the party).
Here is a slightly modified script to respond to those events by printing a simple chat message.
http://lua-users.org/wiki/StringsTutorial is a good resource for manipulating strings in lua. I would recommend playing around with them. If you want to respond to a particular party member by name, class, level, etc, you can query their attributes by passing arg1 to those respective functions, UnitName, UnitClass, UnitLevel. You can use the SendChatMessage API to even communicate with other members based on these attributes.
http://wowprogramming.com/docs/api/SendChatMessage
If this works, you should be able to replace the chat messages with sound effects if you wish. It should be something similar to the following.
You can find paths to the wow sounds here.
http://www.wowwiki.com/API_PlaySoundFile http://www.wowwiki.com/Category:Macros\Sounds
Give these scripts a try and see if they do what you expect. Then, if you can get these working, see if you can replace the appropriate lines with hiding and showing the frames you want.
All seems to be working okay.
On the first test i do get the following messages on chat frame.
UNIT_ENTERED_VEHICLE
UNIT_ENTERING_VEHICLE
when entering... and...
UNIT_EXITED_VEHICLE
UNIT_EXITING_VEHICLE
when exiting.
So that works fine.
On the second test i get the same from above but i get a 3th line message "player" or "party#".
example:
UNIT_ENTERED_VEHICLE
UNIT_ENTERING_VEHICLE
player or party1
Tell me more ;)
Alright, let's start simple. Registering all the events for getting in and out of a vehicle as far as I know.
The above panel should print the registered events when you enter and exit vehicles. See if you can get that working first.
(The arg1 parameter is what is passed along with the event to the OnEvent handler. For example, the UNIT_HEALTH event has an arg1 that represents the unit id. This can be player, target, party1, etc. This is what I'm hoping is the arg1 of the vehicle events up above. Again, I'm unable to play with vehicles yet or otherwise I would be able to do the testing)
http://www.wowwiki.com/Events/Unit_Info
Then try to use this and see if it will print arg1 for the following events.
It should print the unit id of the person entering or exiting the vehicle. For yourself, it should be "player". For other people, it may be party1, party2, etc...
Let me know if this works at all for you.
Damn... this is starting to get a bit too much for me...
I tried the <OnEvent> code but it didnt work... cause it gets "stuck" on the arg1 "parts".
Can you explain better what you mean with that arg1 parameter is?
...and what you mean by these:
Try to print arg1 if it existsShould work if UNIT_ENTERED_VEHICLE and UNIT_EXITED_VEHICLE eventshave an arg1 parameter that is a unit id.The best is to example me what to put on the arg1 part of the code.
My english isn't the best... it blows my mind when i try to understand some parts of what you're saying.
Thanks again ;)
Hmmm,
With respect to the party vehicle problem, I can surmise that you are getting events for party members in addition to yourself. Unfortunately, the documentation for the event is not clear. I can guess that it has an arg1 parameter that is the unit id, but I can't verify it. The documentation for it on wow programming site doesn't document it.
http://wowprogramming.com/docs/events/UNIT_ENTERED_VEHICLE
However, many of the other UNIT_* events have the first parameter as the unit id, so assuming that arg1 is the unit should be a reasonable assumption.
For the second question, I forgot to add a ClearAllPoints call. This resets all the anchor points. The SetPoint is all relative to the current anchor points, so changing anchors with SetPoint usually requires a previous ClearAllPoints.
http://www.wowwiki.com/API_Region_ClearAllPoints
As far as moving the actual minimap frame instead of a decoration depends on whether you can find it with the frame finder. Some addons manipulate the actual Minimap from WoW, and from looking at the BasciMinimap code, that is what it does. So using Minimap is the proper frame. There is also a border frame that is used as well from this CreateFrame call.
local border = CreateFrame("Frame", "BasicMinimapBorder", Minimap)
The name of the border is "BasicMinimapBorder", and uses the Minimap frame as its parent. There is also a MinimapCluster frame that I think collects all the minimap children frames. This means that you still use the Minimap (or maybe MinimapCluster) frame to alter its coordinates. In other minimap mods, they create an entirely new minimap frame and hide the original like Minimap:Hide().
To render the code fragments, it consists of either highlighting a section of text and clicking the gear icon on the toolbar's far right, using lua as the default argument, or you can use '<<' and '>>' brackets with 'code lua' and '/code' (which is what the gear icon does for you).
Looking forward to hear if this works for ya.
First, the following code does hide the frames when i enter any vehicle...
<OnLoad> self:RegisterEvent ("UNIT_ENTERED_VEHICLE") self:RegisterEvent ("UNIT_EXITED_VEHICLE")
<OnEvent> if event == "UNIT_ENTERED_VEHICLE" then self:Hide() elseif event == "UNIT_EXITED_VEHICLE" then self:Show() end
But now I have another weird problem...
Its also hides my frames when someone from my party enters a vehicle. What can be really annoying.
Now about the minimap question... I parented/anchored a decorative frame i have to the Minimap and i tried to set the following code on it:
<OnLoad> self:RegisterEvent ("UNIT_ENTERED_VEHICLE") self:RegisterEvent ("UNIT_EXITED_VEHICLE")
<OnEvent> if event == "UNIT_ENTERED_VEHICLE" then Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 0, 0 ) elseif event == "UNIT_EXITED_VEHICLE" then Minimap:SetPoint( "CENTER", "UIParent", "CENTER", 100, 100 ) end
...and it does move my minimap when i enter a vehicle. I also tried changing the coordenates of the code but it doesnt return to the starting coordenates when i exit a vehicle.
I use an addon named BasicMinimap. Is there a way to use that code on the Minimap itself instead of on my decorative frame around it?
Once again,
Thank you very much ;)
PS: sorry the way the code turned out in the post... dunno how to make it look like on your posts.
I've not done any vehicle based stuff, but I can make a guess.
To hide all the unitframes, you would need to invoke Hide() on all the respective global references to those frames. For Pitbull3, this can be something akin to
Use the frame finder to create a list of unit frames you want to hide and add them to the OnEvent of your kgpanel. If you have kgpanel decorations to those frames, they should hide as well if they are parented properly.
For changing the minimap location, you need to again find its frame name, and you can move it using the SetPoint command.
http://www.wowwiki.com/API_Region_SetPoint
You can use UIParent as the relative frame and "CENTER" as the relative point to center it on screen, and use ofsx and ofsy to position it. You should be able to anchor it to any corner using some combination of "TOP", "LEFT", "BOTTOM", and "RIGHT".
If you're using the regular blizzard minimap frame, I think its name is just Minimap, so you could do something like this.
If you use a minimap addon, you'll have to use a different name. Again use the frame finder.
As far as individual vehicle frame names, I do not know. There is a UnitInVehicle API function to determine whether a unit is in a vehicle, like UnitInVehicle( 'player' ), but nothing specific to vehicle name that I could find after a 5 min google search. Getting the vehicle name could be implemented in an addon somewhere, but I currently don't know how to do it.
http://wowprogramming.com/utils/xmlbrowser is a good resource to look up how to do things as well if you get stuck and you have time to browse for vehicle name. If you get something working, it would be nice to post back to further the kgpanel script kiddies.
Good luck!
Is there a way to see the vehicles frame name?
Do they all have the same frame name? or is there a specific name for each one of them? (i mean.. the diferent type of vehicles... wintergrasp cannons, argent tournament lance mounts, etc...)
Anyway... How do I make all my UI Frames Hide when i enter a vehicle?
and...
Is there a script for changing my minimap place (x,y) in the screen when i enter a vehicle?
Thanks in advance ;)
Finished trying it... works 100% :D
It wasnt the case sensitive problem... I accidently had a <space> in the end of the Pitbull4_Frames_targettarget XD
Anyway... once again..
Ty very much! ;)
Are you still having issues arturo? You have to be careful that the case of the letters in the name is exact.
For Pitbull4 I used: Anchor = Pitbull4_Frames_targettarget Parent = Pitbull4_Frames_targettarget
Dont capitalize Targettarget. It is cap sensitive. targettarget is the correct way :)
hmm... i think im doing it all correctly but the frame doesnt load when the Pitbull4_Frames_Targettarget shows. (yes, im using pitbull4)
i think im parenting it well...
im setting "PitBull4_Frames_targettarget" on both Parent Frame and Anchor Frame. They're both set to Center.
so... am i missing somethin? :x
thanks once again ;)
If these panels are decorations, then it should be as simple as using the frame finder to find the name of the Pitbull Frame, and then just set the parent of your kgpanel to that frame.
I.E. for Pitbull3, the TargetOfTarget frame should be PitBullUnitFrame3, so that would be the name you would enter as the parent of your kgpanel.
Use the frame finder on the pet frame and parent it to that and you should be set.
Hi again! :)
Now i have two doubts...
I just need to keep a panel hidden when my pet isnt active. (when players pet is visible, frame shows, if not it hides)
I mean.. when my warlocks pet is summoned the panel opens up, and when it dies or isnt summoned the panel hides.
and
Pretty much the same thing has above but now it shows/hides when my target has a target or not. (when targets target frame is visible, frame shows, if not it hides)
PS: I use pitbull for portraits frames and bars. Please explain it well cause im not into code thing. :P
Thanks in advance ;)
Hi, Love this addon. I have been working on using this to skin a Druid UI. I am attempting to use it to change the borders of most of the target, player, focus, focus target, chat, targettarget, buffs, and many other frames. I am running into a problem with getting the Chat, and Minimap frame. I am using the parrent setting to show only when I have a buff active. It works until I log out. Once I log out and back in, those 2 panels decide to not show any more. I have tried to change the transpariency setting, with no luck. If anyone can help that would be awsome.
Thanks again for all your time, and input. That code worked perfectly,I now have working,and dragable on screen Target :HP/MP/Combo Point boxes.
Farside
I got on WoW and did some testing, you can also try this. The self.text:SetText( "" ) didn't work as I saw the "Target" text also, so I went to LibDogTags documenation and found a RemoveFontString. This should also work for you.
You can also do this for the focus using PLAYER_FOCUS_CHANGED a la
Thanks again, I reworked this code:
OnLoad
self:RegisterEvent("UNIT_TARGET")
self:Hide()
OnEvent:
if UnitExists("target") == nil then
self:Hide()
return
else
self:Show()
return
LibStub("LibDogTag-3.0"):AddFontString(self.text, kgPanels, [thickoutline][( [IsPlayer ? Name:ClassColor ! IsPet ? Name:ClassColor ! IsEnemy ? Name:HostileColor ! PvP ? Name:HostileColor ! Name:ClassColor] )], "Unit", { unit = "target"})
end
This works great. I appreciate all your help.
Glad to hear it's working for you!
The issue you are describing is because the unit does not exist and DogTags still gives you a text string. You can combine your dogtag line with my kgpanel script below to set the text to "" when the unit does not exist.