Thread Tools Display Modes
12-08-19, 09:01 PM   #1
Wolly_44
A Defias Bandit
Join Date: Dec 2019
Posts: 3
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.


Code:
OnLoad

self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")

OnEvent

if event == "PLAYER_REGEN_ENABLED" then
  self:Hide()
elseif event == "PLAYER_REGEN_DISABLED" then
  self:Show()
end
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
Code:
if event == "PLAYER_REGEN_DISABLED"
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
  Reply With Quote
12-08-19, 10:02 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-08-19, 11:00 PM   #3
Wolly_44
A Defias Bandit
Join Date: Dec 2019
Posts: 3
Thank you for your help!

I have now adjusted the OnEvent to the following:
Code:
if event == "PLAYER_REGEN_DISABLED" then
  self:SetAlpha(0)
  ChatFrame1:SetAlpha(0)
elseif event == "PLAYER_REGEN_ENABLED" then
  self:SetAlpha(1)
  ChatFrame1:SetAlpha(1)
end
And I've also changed the OnEnter/OnLeave scripts to the following:
Code:
if event == "PLAYER_REGEN_DISABLED" then
  self:SetAlpha(1)
  ChatFrame1:SetAlpha(1)
end
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!

Last edited by Wolly_44 : 12-09-19 at 12:27 AM.
  Reply With Quote
12-11-19, 02:23 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
There is no event return for mouseovers. You have to explicitly check to see if you are in combat using the InCombatLockdown function.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
12-15-19, 08:48 AM   #5
Wolly_44
A Defias Bandit
Join Date: Dec 2019
Posts: 3
This has definitely put me in the right direction 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.
  Reply With Quote
12-15-19, 03:24 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » kgPanels - Script Mouseover Combat

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off