WoWInterface (
-   AddOn Help/Support (
-   -   kgPanels - Script Mouseover Combat (

Wolly_44 12-08-19 09:01 PM

kgPanels - Script Mouseover Combat
Hey guys,

First post here because I'm completely stuck trying to correctly script the following function in kgPanels.

I have a kgPanel for my chat, and I want to hide the panel & chat frame when I enter combat, that part was easy, I just used the following instructions to hide/show the panel when entering/leaving combat.





if event == "PLAYER_REGEN_ENABLED" then
elseif event == "PLAYER_REGEN_DISABLED" then

But I still want to be able to reveal it via mousover during combat if needed, I have Details! damage meter and this has the function built in and it works perfectly, I can have the window hidden during combat but mousover to reveal it if needed during a fight.

I've tried adjusting the same

into the OnEnter/OnLeave sections of the panel so that if my regen is disabled (in combat) then OnEnter show the panel, or if regen is disabled then hide the panel.

I dont want to hide the panel on mouseover outside of combat, can anyone help me fill in the gaps i'm missing to get this working?

Thanks in advance for any help :D

Seerah 12-08-19 10:02 PM

Hiding a panel is not the same as making it "invisible". When your panel is hidden, it's not there to mouse over. Think of hiding a panel as putting it away. Change its alpha instead.

Wolly_44 12-08-19 11:00 PM

Thank you for your help!

I have now adjusted the OnEvent to the following:

if event == "PLAYER_REGEN_DISABLED" then
elseif event == "PLAYER_REGEN_ENABLED" then

And I've also changed the OnEnter/OnLeave scripts to the following:

if event == "PLAYER_REGEN_DISABLED" then

Once I enter combat, all works well, the panel & chatframes are not visible until I leave combat, but when I mouseover the panel nothing is reappearing until I leave combat again.

Are my OnEnter/OnLeave statements incorrect?

EDIT: I can get the mouseover to work regardless of combat status, I just want to know how to script it so that when I am out of combat the mousover is disabled

Thanks again!

Seerah 12-11-19 02:23 PM

There is no event return for mouseovers. You have to explicitly check to see if you are in combat using the InCombatLockdown function.

Wolly_44 12-15-19 08:48 AM

This has definitely put me in the right direction :D Thank you so much!
Still unable to find the exact string required for my desired result but this has been very helpful!
I'm just not sure how to tie this to the OnEnter/OnLeave handles available in kgPanels.

Seerah 12-15-19 03:24 PM

In your OnEnter:
Lua Code:
  1. if InCombatLockdown() then  --if you are in combat then
  2.      self:SetAlpha(0)
  3.      ChatFrame1:SetAlpha(0)
  4. end

All times are GMT -6. The time now is 10:55 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI