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.
I have this code working:
OnLoad:
self:RegisterEvent("PLAYER_TARGET_CHANGED")
OnEvent:
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"})
Works great!,but one problem when I don't have any target I get this text in the center of the box. "Target" without the ""
Thank you, Farside
There isn't a whole lot out there for glueing DogTags and kgpanels together. I did find this in a WoW forum, so you may be able to get something going.
http://forums.worldofwarcraft.com/thread.html?topicId=15443286681&sid=1
First see if this works for displaying player info in a kgpanel (at work so can't try it out). Make sure DogTags or Pitbull3 is installed since it comes with DogTags.
The self.text field is a FontString created by kgpanels that is assigned to that frame.
If that works, the next step is to try to see if you can get the target name. Guessing at the parameters, try this out.
If this displays the name of the target and updates when you change targets, you should have enough to get the rest of your dogtag in place. If you parent the frame to the target frame, it should show and hide with that frame. For Pitbull3, the target frame should be PitBullUnitFrame3 (spelling must be exact!).
If the DogTag code doesn't work, then try the pitbull3 or dogtag forums. If you're interested in using the WoW API to setup the text, then I might be able to help you figure it out, i.e.
(not tested)
I was hoping someone could help me with a script to add dog tags into a kgpanel,
Example:
(text only shows when I have a target)
[Level:DifficultyColor] [Name:ClassColor] [Guild:Cyan]
Note: I would like to be able to input any dog tag code in there,and make ToT or Pet the Unit.
So basicly I need the script and where to put the parts of the script into the kgpanels.
Thank You, Farside
/run print(GetMouseFocus():GetName())
That will print the window name under the mouse to your chat window. Then go into kgpanels and change both the Parent Frame and Anchor Frame to the name you got from the output. Change your anchor points to Center.
Then just resize the panel around your pet bar. When the pet bar disappears so will the panel.
Thanks for the kudos. I think your kgpanels addon is awesome, and it's been great tool to learn basic WoW UI programming. I only wish I had the artistic talent to make my own animations. I would so create a welding spark like animation that I can display when I take damage on my unitframe art.
I've been playing with some other animation ideas, but I'm still working it out.
Very nice.
I took the animation from NugComboBar and made a kgpanel out of it.
First, make the width 30, and height 45 which is the size used by NugComboPanels.
I modified the counter to be a little slower than NugComboBar (0.06). You can set the color of the flame with self.bg:SetVertexColor.
The way the animation works is that the texture is made up of several pics of a flame in order from left to right. Every time the elapsed time exceeds the 0.10 threshold, the TexCoordinates are shifted to the next animation frame to the right. The value 0.083333 (1/12) is used because the fireballanimation1.tga image is split into 12 different fire frames.
With this model, you can create your own animations given enough patience, and you can incorporate your own OnEvent handler to display it under certain conditions.
Have fun!
If you just want to decorate the castbar, you can parent and anchor your kgpanel to the ecasting bar frame. You should be able to use the kgpanel frame finder if you use the keybind while hovering over the castbar while doing a long spell like using your hearthstone. If that doesn't work, you can try digging for the name of the castbar frame from the lua.
I.E. for Quartz, the frame finder finds QuartzCastBar, so you would parent and anchor your panel to that frame. I changed the Panel Width and Height to 100% (make sure to add a literal percent character '%'), and set the Parent and Anchor to QuartzCastBar. It would be much easier than using that script.
If you want it to hide when your cast bar is shown, you can register for the UNIT_SPELLCAST_? events, and do something like this in your panel. Again using the Quartz player cast bar example.
OMG!
i thought it was some really simple script...
I was building this interface and i was intending to use a few addons only:
KGPanels | ecastingbar | Pitbull
I already had Quartz but i kinda felt it was too much for what i was looking for... so i tried ecasting bar and it was perfect for what i needed.
Is there a way do it without using Quartz?
Anyway i'm a designer and not a "code guy"... but I'll definitly try what you told me ;)
Thank'ya VERY much ;)
Hmm, for the cast bar stuff, a good place to start would be to look at quartz addon code. I'll give some background, and hopefully should be enough for you to pick up and get your panel working.
The events you want to listen for have the prefix UNIT_SPELLCAST_?. To get acquainted with what events are being sent, I would create a kgpanel that listens to all of these events and prints a message in the chatframe. Then, observe the events by casting different spells and see what happens. You might need a buddy or go in a battleground to interrupt you to test the interrupt event.
This should print a little text of the events being fired if you register for them.
There are three different categories of spells, instants, casting, and channeling.
Instants - These are sent to the server via UNIT_SPELLCAST_SENT. The server will take your spell and either accept or reject it. You get either a UNIT_SPELLCAST_SUCCEEDED if the server accepted it, or a UNIT_SPELLCAST_FAILED if it didn't. An instant cast can fail if you try to use a spell that is currently on cooldown for instance.
Casting - These are spells that have a specific cast time before they are sent to the server. They are sent to the server using UNIT_SPELLCAST_SENT and a UNIT_SPELLCAST_START. If everything goes well, you will send a UNIT_SPELLCAST_STOP at the end of your cast time, and the server will respond with either a UNIT_SPELLCAST_SUCCEEDED or UNIT_SPELLCAST_FAILED. However, if you get interrupted, you may receive a UNIT_SPELLCAST_INTERRUPTED if your spell was interrupted. If you get hit, your cast time will lengthen, these are updated via UNIT_SPELLCAST_DELAYED.
Channeling - These are different from casting spells. Casting spells are like instants that have a required cast time. Once the cast time is done, the server responds to it like an instant. A channeling spell is something that works over time. Applying a bandage to yourself is probably the most accessible channeling spell. Each tick applies a health buff to your character. These have different events that are applied. The channeling spell starts with a UNIT_SPELLCAST_CHANNEL_START and end with a UNIT_SPELLCAST_CHANNEL_STOP. They can also be interrupted so you can receive a UNIT_SPELLCAST_INTERRUPTED.
This is the basic background needed to build a kgpanel that does what you require. Now comes the tricky part, putting it together.
Using the model from Quartz, they have two boolean flags that they keep track of called 'casting' and 'channeling' that are set to true or nil based on the events that fire. You can adapt this to an OnEvent handler and use those booleans to determine whether to show or hide the panel. The first step is to create the OnLoad script handler. This will declare the booleans, and register for all the appropriate events.
Now comes the OnEvent handler. This function will maintain the casting and channeling boolean flags to determine whether or not your are in the middle of casting or channeling a spell. One small modification is that I'm doing this for the player unit. Each event arguments are accessed via arg1, arg2, arg3, etc... for the parameters used by the event. From the WoWWiki, all of the arg1 represent the unit id of the spell being cast. For our purposes, this will be player, so we'll ignore any spells that are not cast by the player.
Now we need to look at how to know when we're casting or channeling. Thankfully, quartz has handled most of the logic for us, so we can adapt it to our kgpanel. We just observe how they change these states when these events fire.
The UNIT_SPELLCAST_SENT event does not signal a casting spell or a channeling spell. It is sent everytime that you send a spell event to the server by clicking a spell icon or using a spell keybind.
The UNIT_SPELLCAST_START event does signal that we are casting a spell. If you look at quartz code, the line 'self.casting = true' means that you are "casting" a spell. This is not the same as channeling, so it is set to nil.
For UNIT_SPELLCAST_CHANNEL_START, you should be able to get that it marks the start of a channeling spell, but not a casting spell.
For UNIT_SPELLCAST_STOP, this signals that the casting spell has ended. The self.channeling isn't involved at this point.
And the same for UNIT_SPELLCAST_CHANNEL_STOP.
If the spell succeeded, it will be preceded by a UNIT_SPELLCAST_STOP or a UNIT_SPELLCAST_CHANNEL_STOP event, so there is no need to modify the boolean state variables.
The spell can fail, which can trigger from you moving while casting the spell to end it before you finished. This means that both the casting and channeling spells are stopped.
In the same vein as a spell failing, an interrupted spell has the same result.
The UNIT_SPELLCAST_DELAYED and UNIT_SPELLCAST_CHANNEL_UPDATE have more to do when your are hit while casting, but it is not enough to stop the spell. You are still casting in this event, so no change is made to the state variables.
Put all of that together and you have the following OnEvent.
Finally, you can use the casting and channeling boolean flags to change the visibility of the panel.
I didn't have WoW in front of me when I wrote this, so there may be some typos. It should be enough to get your panel to work though. Good luck!
First of all thanks for the example scripts on this post... helped me a lot! ;)
But now i have a doubt...
Is there a way to create a panel that hides when im casting something? (when i say casting i mean... when the "cast" bar appears)
Thanks in advance ;)
I make a texture of 512x256,insert this in the game with KGpanels and when resize in the addon (512x256) leaves much larger than it is!
Thought I'd see what size that is creating the KGpanels my screen (my actual resolution is 1280x1024). Then I take the texture and put it in the addon size (width and height) 100% x 100% to fill the screen, then the pixels KGpanels said that the total width is 1066, is smaller than the resolution real! O_o
I tried to do the conversion as my decision whatever it says the addon (W 1066):
If 1280 is 1066
512 are 426.4
But there is to do well at all (a little larger or smaller) and I do not fit the adjacent textures.
Anyone else happens to get a texture that will leave the largest size you have?
Where are the 214 missing pixels?
Is it possible to flip one of them around so that the solid part of the panel starts at either side of the screen and fades towards the middle?
I've tried using the Flip functions aswell as the Rotate function but it doesn't seem to work.
i got an image which i wanna parent to Pitbull4_Frames_target but when i do so, the image simply disappears from the screen, no matter what i do
This frame shows the level number of a target when a target is selected. If the level is skull, the skull icon is displayed.
You can customize the panel size to control the size of the icon, and the font parameters to control the level text size and font. Have fun!
To lilgulps
To make a panel show up when not in combat, and only to show up in a party or raid can be made by combining two of the sample scripts.
Not tested!