Kgpanels script for mouseover + select
Hi there!
What I'm looking for is some kind of script that will make a panel in Kgpanels visible if a frame is either has my mouse hovering over it or selected. These are party frames, so i want this little panel to appear next to the party members when they are either selected or have my mouse hovering over them. I'm not sure how to do this. Any help? Thanks a bunch. |
Assuming you are using the default party frames:
OnLoad Code:
-- Change this value for each frame to match the party unit ID: Code:
self:SetShown(self:IsMouseOver() or UnitIsUnit("target", self.unit)) |
Heya! Thanks for the reply. I'm using STUF unit frames for my party. Would that code still be applicable and if so how might I have to change it?
|
You need to figure out what the names of the Stuf party frames are, and change the code accordingly. Specifically, this part:
Code:
self.frame = _G["PartyFrame"..self.id] Code:
self.frame = _G["StufParty"..self.id] You will still need to set the id appropriately (1, 2, 3, 4) for each of the 4 panels. |
Hi there! Sorry for the late reply, been distracted by Pokemon. Thanks so much for the help! I've put in the script and put in the name of the frame and whatnot. I haven't tested it in a real party for the select thing but I can't even get the hover over part to work, ahah.
I think I must've not edited it properly. What was I supposed to do. Code:
-- Change this value for each frame to match the party unit ID: Did I make a mistake? The unit frame name thing for the party was 'stuf.units.party1', 'stuf.units.party2' etc.etc. so I assumed I was supposed to write stuf.units.party. Thanks so much. |
Code:
self.frame = _G["stuf.units.party"..self.id] (1) Type "/fstack" and move your cursor over a party frame to find out what its name is, and change your code accordingly. For example, if the name is "stufomglolcatsandlasersharkstrexparty3", then your script needs to look up _G["stufomglolcatsandlasersharkstrexparty"..self.id] (2) Dispense with the _G lookup and change that to stuf.units["party"..self.id] instead. |
Thanks again for the help and the patience! I'm still extremely, very new to all this so I greatly appreciate it.
Anyway I was fumbling around a bit and did the whole remove and replace the _G bit and I was wondering why it didn't work, and it turns out that the capital letters matter too! I should've seen that one coming! :rolleyes: Anyway I got it to work perfectly with the hover stuff. Now to just test it out in a dungeon with the select. Thanks a ton! EDIT: Just an edit to say that it works perfectly, and I really appreciate it! Thanks again. |
Yep, Lua (the programming language in which addons are written) is case-sensitive, so THIS and This and this and tHiS are all different values.
|
Hi there, sorry to bother again but I'm having this come up.
Whenever I start up the game and load up the party frames, either via Stuf config mode or by actually joining a party, Swatter gets an error, and the script doesn't work, instead showing the hover/select frame always. I can fix this just by going to the kgpanels script and just like, putting a space and removing it and then pressing accept, but it's a bit annoying having to do it everytime I log in. Do you know if there's anything around this or will I just have to live with it? I also copied the error thing from swatter just in case. It's essentially four of these errors for each 'Party x', I think they all are the same. Code:
Date: 2013-12-14 23:11:34 Thanks a bunch |
Those errors would indicate that kgPanels is loading your panels before Stuf has loaded. If kgPanels has a "dependency" field, add Stuf to it. If not, add this to your OnLoad script:
Code:
if not INSERT_STUF_GLOBAL_HERE then |
Yeah kgPanels has dependency, or at least the individual panel's scripts do. I tried putting in 'Stuf' and 'Stuf Unit Frames' (since that's the name that shows up in the character select addon screen) into the dependency for the panel's scripts but to no avail. :'D
I'm gonna try using the code instead, but what does 'INSERT_STUF_GLOBAL_HERE' mean? Thanks again. |
For the dependency, you need to use the addon's folder name. For example, an addon that appears in-game as "My Addon: Awesome Plugin!" probably has a folder name of "MyAddon_AwesomePlugin". I have no idea what Stuf's folder is named, but it's in your addons folder, so you can figure it out easily. :p
The global would be whatever is at the root of your "stuf.units.party" path -- if that's the actual path you're using successfully in your script, then the global would be "stuf". Given your comment about capitalization, though, maybe it's "Stuf" or "STUF" instead. Don't use quotes around it in your code, though. |
Ohhh, okay! Stuf actually has three folders, Stuf, Stuf_Options and Stuf_Range. So if Stuf didn't work, maybe it was Stuf_Options I was supposed to put in?
Unfortunately that wasn't the case, and I couldn't get the code to work either. I replaced INSERT_STUF_GLOBAL_HERE with Stuf and also INSERT_STUF_FOLDER_NAME_HERE with Stuf. Was I supposed to put it at the start or the end of the OnLoad script? I put it at the start because I assumed that means it'd read it first, eheh. |
Okay, I gave up and spent some time looking through Stuf's code. The problem is that it doesn't create its frames right away when it loads. To fix that, you'll need to use function hooks to detect when Stuf creates the frames. Replace your OnLoad scripts with this (change the blue part at the top for each panel):
Code:
self.unit = "party1" |
Oh wow, that sounds really complicated. Sorry for making you go through all that, ahah, and thanks again so much!
And I don't mean to bother again, but I couldn't get that script to work for me. Now the entire hover/select thing doesn't work. This is the error that swatter gives me whenever I accept the script. Code:
Date: 2013-12-16 00:23:42 And this is the one it gives me when my party frames load. Code:
Date: 2013-12-16 00:25:16 Sorry for all the trouble this is causing, thanks again for your patience! |
Fixed; needs quotes around the unit (blue text).
|
Woo, there we go. No error message, how refreshing. :'D
Though.... I still need to go and edit and accept the script in order to get it working. xD Ahh, Stuf is so troublesome. |
All times are GMT -6. The time now is 05:16 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI