Quantcast
CharacterMicroButton:Click() not working - WoWInterface
Thread Tools Display Modes
11-21-20, 11:33 PM   #1
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 118
CharacterMicroButton:Click() not working

Hi,

im creating a new micro menu and wanted to use the click functions (to avoid taints).
It is working for all micro menu buttons except character.

When I do:

Lua Code:
  1. CharacterMicroButton:Click()

Nothing happens...

Is there somethign special about this button?

*EDIT*

Nevermind. They taint anyway. Since ShowUIPanel and HideUIPanel are forbidden in fight now I tried to do the following:

Lua Code:
  1. local function showUIPanel(frame, _, duplicated)
  2.     if (frame and not frame:IsShown() and (not duplicated) and InCombatLockdown()) then
  3.         local point, _, relativePoint, xOff, yOff = frame:GetPoint()
  4.  
  5.         frame:ClearAllPoints()
  6.         frame:SetPoint(point or "CENTER", FRAMES.UIParent, relativePoint or "CENTER", xOff or 0, yOff or 0)
  7.         frame:Show()
  8.     end
  9. end
  10.  
  11. local function hideUIPanel(frame, _, duplicated)
  12.     if (frame and frame:IsShown() and (not duplicated) and InCombatLockdown()) then
  13.         frame:Hide()
  14.     end
  15. end
  16.  
  17. hooksecurefunc("ShowUIPanel", function(frame, force, duplicated)
  18.     showUIPanel(frame, force, duplicated)
  19. end)
  20. hooksecurefunc("HideUIPanel", function(frame, force, duplicated)
  21.     hideUIPanel(frame, force, duplicated)
  22. end)

This is working for most of the buttons but for example not for the spell book frame.

Is there any way to get this working without any taints or is the way to go:

"This is not allowed during combat!"?

Last edited by Lybrial : 11-22-20 at 12:40 AM. Reason: new informations
  Reply With Quote
11-22-20, 04:43 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,550
If your goal was to hide and show the buttons dependant on whether in combat or not you could use the Events that monitor regeneration as that happens just before and just after combat and can be used to make any frame changes.

I use it to disable clickable buttons or hide frames that contain items that are only usable out of combat.

PLAYER_REGEN_DISABLED
- Fired whenever you enter combat, as normal regen rates are disabled during combat. This means that either you are in the hate list of a NPC or that you've been taking part in a pvp action (either as attacker or victim).

PLAYER_REGEN_ENABLED
Fired after ending combat, as regen rates return to normal. Useful for determining when a player has left combat. This occurs when you are not on the hate list of any NPC, or a few seconds after the latest pvp attack that you were involved with.


If this wasn't what you were hoping to do with the frames maybe you could clarify what your ideas were.
__________________
  Reply With Quote
11-22-20, 06:36 AM   #3
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 118
Originally Posted by Xrystal View Post
If your goal was to hide and show the buttons dependant on whether in combat or not you could use the Events that monitor regeneration as that happens just before and just after combat and can be used to make any frame changes.

I use it to disable clickable buttons or hide frames that contain items that are only usable out of combat.

PLAYER_REGEN_DISABLED
- Fired whenever you enter combat, as normal regen rates are disabled during combat. This means that either you are in the hate list of a NPC or that you've been taking part in a pvp action (either as attacker or victim).

PLAYER_REGEN_ENABLED
Fired after ending combat, as regen rates return to normal. Useful for determining when a player has left combat. This occurs when you are not on the hate list of any NPC, or a few seconds after the latest pvp attack that you were involved with.


If this wasn't what you were hoping to do with the frames maybe you could clarify what your ideas were.
Hi,

no, my goal was to make them usable while in combat. But it does not seem that it is possible.

Still would be interesting why `CharacterMicroButton:Click()` does nothing.
  Reply With Quote
11-22-20, 09:31 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,550
Have you created the buttons using the secure frame system ? That will allow limited functionality while in combat.

Just in case you haven't looked at that aspect of this then this page may help you. As well as some posts on this site ..

https://wow.gamepedia.com/SecureTemplates


As to why the Character button isn't working could be due to the fact that you are not allowed ( I think ) to switch out your armour and weapons during combat. I vaguely recall seeing a message when I tried opening the frame myself ( using the mouse rather than script ).
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » CharacterMicroButton:Click() not working

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