Thread Tools Display Modes
05/22/23, 04:52 PM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
Question detect if HUD hidden or shown

Looking for a way to detect if the HUD is shown. ive been been trying things like this but no success.

Code:
local hud = SCENE_MANAGER:GetScene("hud")
if hud:IsHidden() then
im able to with callbacks for 3 other related scenes but I'm trying to avoid that if possible.

**EDIT
figured it out

Code:
local hudScene = SCENE_MANAGER:GetScene("hud")
if hudScene:GetState() == SCENE_SHOWN then

Last edited by sinnereso : 05/22/23 at 08:53 PM.
  Reply With Quote
05/23/23, 01:25 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,959
Maybe helps too:
https://wiki.esoui.com/Fragments_in_...t_state_change
  Reply With Quote
05/23/23, 02:15 AM   #3
Sharlikran
 
Sharlikran's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 639
Code:
    if IsGameCameraUIModeActive() or IsUnitInCombat("player") then
        return
    end
  Reply With Quote
05/23/23, 03:18 AM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,959
Attention: IsUnitInCombat("player") does not tell you if you are in HUD mode as you can be in combat having the menus open or not!
  Reply With Quote
05/23/23, 12:49 PM   #5
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
Originally Posted by Baertram View Post
yeh I was previously using 3 state changes for crafting machines but was more callbacks than I wanted and events driving my code savage. I prefer events that I can fully turn on and off via options as I have many features so for me its key they can properly completely shut down any feature they are not using and its no longer firing anything related.

So I reversed my thinking and switched to:

Code:
EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_CRAFTING_STATION_INTERACT, MyAddon.AutoMeticulous)
EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_END_CRAFTING_STATION_INTERACT, MyAddon.AutoMetReturn)
with a filters in the functions for different things with:

Code:
if craftSkill ~= 0 and craftSkill ~= 1 and craftSkill ~= 2 and craftSkill ~= 3 and craftSkill ~= 6 and craftSkill ~= 7 then return end
and

Code:
local deconCraftScene = SCENE_MANAGER:GetScene("smithing")
local deconEnchantScene = SCENE_MANAGER:GetScene("enchanting")
local deconAssistScene = SCENE_MANAGER:GetScene("universalDeconstructionSceneKeyboard")
if deconCraftScene:GetState() ~= SCENE_SHOWN and deconEnchantScene:GetState() ~= SCENE_SHOWN and deconAssistScene:GetState() ~= SCENE_SHOWN then

etc etc.

Last edited by sinnereso : 05/23/23 at 12:55 PM.
  Reply With Quote
05/23/23, 02:03 PM   #6
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 88
you can also just register the same event multiple times for different features
  Reply With Quote
05/24/23, 04:11 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,959
You should not use the fixed numbers 0 ,1 and 2 etc. but the constants the game provides.
The constants type used for any API function or event are provided at the API documentation txt file:

Code:
* EVENT_CRAFTING_STATION_INTERACT (*[TradeskillType|#TradeskillType]* _craftSkill_, *bool* _sameStation_, *[CraftingInteractionMode|#CraftingInteractionMode]* _craftMode_)
Search for TradeskillType in the same txt filet o get the possible constants:
Code:
h5. TradeskillType
* CRAFTING_TYPE_ALCHEMY
* CRAFTING_TYPE_BLACKSMITHING
* CRAFTING_TYPE_CLOTHIER
* CRAFTING_TYPE_ENCHANTING
* CRAFTING_TYPE_INVALID
* CRAFTING_TYPE_JEWELRYCRAFTING
* CRAFTING_TYPE_PROVISIONING
* CRAFTING_TYPE_WOODWORKING

You will find those constants and their values via merTorchbug ingame too, using /tb and then click on the constants tab (search is top left).
e.g. enter CRAFTING_ and it should list all + their values.

Better use those as the numbers MIGHT (did) change in the future and 0 will stay 0 but CRAFTING_TYPE_INVALID might change to soemthing like -1 or similar and break your code then!

This applies to all API functions and events and callbacks.




Originally Posted by ExoY View Post
you can also just register the same event multiple times for different features
Yes, only make sure to change the unique eventName "MyAddon" you specify to really be unique or you just overwrite your event callback!


Code:
EVENT_MANAGER:RegisterForEvent("MyAddon" .. tostring(craftingType), ...
btw: "MyAddon" (if you really use that in your addon RidinDirty as the unique event name) is not unique enough!
You might break other addons using the same.
!!!Please change that at ALL events in your addons to use a really unique name, like YOUR addon's real name, and not a generic "My Addon" or similar !!!
e.g. use RidinDirty.name if this exists

Last edited by Baertram : 05/24/23 at 04:15 AM.
  Reply With Quote
05/24/23, 04:31 PM   #8
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
Originally Posted by Baertram View Post
You should not use the fixed numbers 0 ,1 and 2 etc. but the constants the game provides.
The constants type used for any API function or event are provided at the API documentation txt file:

Code:
* EVENT_CRAFTING_STATION_INTERACT (*[TradeskillType|#TradeskillType]* _craftSkill_, *bool* _sameStation_, *[CraftingInteractionMode|#CraftingInteractionMode]* _craftMode_)
Search for TradeskillType in the same txt filet o get the possible constants:
Code:
h5. TradeskillType
* CRAFTING_TYPE_ALCHEMY
* CRAFTING_TYPE_BLACKSMITHING
* CRAFTING_TYPE_CLOTHIER
* CRAFTING_TYPE_ENCHANTING
* CRAFTING_TYPE_INVALID
* CRAFTING_TYPE_JEWELRYCRAFTING
* CRAFTING_TYPE_PROVISIONING
* CRAFTING_TYPE_WOODWORKING

You will find those constants and their values via merTorchbug ingame too, using /tb and then click on the constants tab (search is top left).
e.g. enter CRAFTING_ and it should list all + their values.

Better use those as the numbers MIGHT (did) change in the future and 0 will stay 0 but CRAFTING_TYPE_INVALID might change to soemthing like -1 or similar and break your code then!

This applies to all API functions and events and callbacks.





Yes, only make sure to change the unique eventName "MyAddon" you specify to really be unique or you just overwrite your event callback!


Code:
EVENT_MANAGER:RegisterForEvent("MyAddon" .. tostring(craftingType), ...
btw: "MyAddon" (if you really use that in your addon RidinDirty as the unique event name) is not unique enough!
You might break other addons using the same.
!!!Please change that at ALL events in your addons to use a really unique name, like YOUR addon's real name, and not a generic "My Addon" or similar !!!
e.g. use RidinDirty.name if this exists
ty I always forget that.. ill get that updated soon.. And no I dont ever use MyAddon anywhere. I do that here for posts so as to keep my RidinDirty secret sauce a secret =p
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » detect if HUD hidden or shown

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