Thread Tools Display Modes
01/23/24, 03:18 AM   #1
CircleOf14
Join Date: Jan 2024
Posts: 4
SetAlpha() not working

Hello. I'm trying to write my own AddOn. I want to be able to use it while using my gamepad. I'm currently trying to modify the behavior of the control which displays your companion name and their health meter. I've determined that the control is called:

ZO_SmallGroupAnchorFrame

and I am able to successfully reposition it by calling:

ZO_SmallGroupAnchorFrame:SetAnchor()

but I also want to be able to hide it. The problem is when I call:

ZO_SmallGroupAnchorFrame:SetAlpha(0)

nothing happens. I've tried passing other values like 0.1 or 0.2, but nothing works, no value changes the opacity of this control. What am I missing?
  Reply With Quote
01/23/24, 03:31 AM   #2
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
Originally Posted by CircleOf14 View Post
Hello. I'm trying to write my own AddOn. I want to be able to use it while using my gamepad. I'm currently trying to modify the behavior of the control which displays your companion name and their health meter. I've determined that the control is called:

ZO_SmallGroupAnchorFrame

and I am able to successfully reposition it by calling:

ZO_SmallGroupAnchorFrame:SetAnchor()

but I also want to be able to hide it. The problem is when I call:

ZO_SmallGroupAnchorFrame:SetAlpha(0)

nothing happens. I've tried passing other values like 0.1 or 0.2, but nothing works, no value changes the opacity of this control. What am I missing?
try ZO_GroupFrameAnchor maybe ?
  Reply With Quote
01/23/24, 03:39 AM   #3
CircleOf14
Join Date: Jan 2024
Posts: 4
Originally Posted by Masteroshi430 View Post
try ZO_GroupFrameAnchor maybe ?
Hello. Just tried that, but it throws a "attempt to index a nil value" error. At least calling:

ZO_SmallGroupAnchorFrame:SetAlpha(0)

doesn't throw an error, but it just doesn't do anything.
  Reply With Quote
01/23/24, 03:47 AM   #4
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
Originally Posted by CircleOf14 View Post
Hello. Just tried that, but it throws a "attempt to index a nil value" error. At least calling:

ZO_SmallGroupAnchorFrame:SetAlpha(0)

doesn't throw an error, but it just doesn't do anything.
I looked in my addons code, try this one:
ZO_UnitFramesGroups
ZO_UnitFramesGroups:SetHidden(true) works for sure
  Reply With Quote
01/23/24, 04:06 AM   #5
CircleOf14
Join Date: Jan 2024
Posts: 4
Originally Posted by Masteroshi430 View Post
I looked in my addons code, try this one:
ZO_UnitFramesGroups
ZO_UnitFramesGroups:SetHidden(true) works for sure
That was it! Both SetAlpha() and SetHidden() work with ZO_UnitFramesGroups. Thanks so much.

Man I am so new to this, if you don't mind telling me, how on earth did you figure out that ZO_UnitFramesGroups is the correct control name? The only way I was able to get ZO_SmallGroupAnchorFrame as a starting point was because i used the Azurah addon and looked at the saved variables file.

Is there some simple way to know the name of any given control in the UI?
  Reply With Quote
01/23/24, 04:35 AM   #6
Masteroshi430
 
Masteroshi430's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2020
Posts: 185
Originally Posted by CircleOf14 View Post
That was it! Both SetAlpha() and SetHidden() work with ZO_UnitFramesGroups. Thanks so much.

Man I am so new to this, if you don't mind telling me, how on earth did you figure out that ZO_UnitFramesGroups is the correct control name? The only way I was able to get ZO_SmallGroupAnchorFrame as a starting point was because i used the Azurah addon and looked at the saved variables file.

Is there some simple way to know the name of any given control in the UI?
This was in one of my addons' code, usually if I can't find a control's exact name, I look in the corresponding xml files, it helps.
  Reply With Quote
01/23/24, 04:47 AM   #7
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Try to use addons like merTorchbug and/or zgoo to inspect the controls below your mouse.

Move mouse above the control, then type in chat
With merTorchbug addon:
/tbm (or /tbug mouse)
or alternatively press SHIFT + LEFT MOUSE + RIGHT MOUSE (At the same time!)

With zgoo addon:
/zgoo mouse

The inspector will open and show you the name and all data of the inspected control so the name should show as e.g.
ZO_SmallGroupAnchorFrame then
or similar

You can see the child controls then at the bottom so you can clicka round and find the controls, and even manipulate it with e.g.
double clicking the hidden state to change the true/false and see if it hides then.
  Reply With Quote
01/23/24, 07:31 AM   #8
CircleOf14
Join Date: Jan 2024
Posts: 4
Originally Posted by Baertram View Post
Try to use addons like merTorchbug and/or zgoo to inspect the controls below your mouse.

Move mouse above the control, then type in chat
With merTorchbug addon:
/tbm (or /tbug mouse)
or alternatively press SHIFT + LEFT MOUSE + RIGHT MOUSE (At the same time!)

With zgoo addon:
/zgoo mouse

The inspector will open and show you the name and all data of the inspected control so the name should show as e.g.
ZO_SmallGroupAnchorFrame then
or similar

You can see the child controls then at the bottom so you can clicka round and find the controls, and even manipulate it with e.g.
double clicking the hidden state to change the true/false and see if it hides then.
Wow! That sounds amazing! Inspecting any control for all the details seems like an invaluable development tool for addons. Thanks!

And thanks again to Masteroshi430 for fixing the original problem.
  Reply With Quote
01/23/24, 09:00 AM   #9
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by CircleOf14 View Post
Wow! That sounds amazing! Inspecting any control for all the details seems like an invaluable development tool for addons. Thanks!

And thanks again to Masteroshi430 for fixing the original problem.
A semi related question regarding the use of mertorchbug.. ive been trying to eliminate a bug in my addon and using mertorchbug to find the code or function that "discard changes" executes when you want to clear CP items that have been sloted but not commited. I can find the name of the control "ZO_KeybindStripButtonTemplate3" but cannot find what its executing to actually clear the cp slots or in the code items added by "AddHotbarSlotToChampionPurchaseRequest()". I'd like to perform the same function from code in my addon to clear those.

Last edited by sinnereso : 01/23/24 at 09:07 AM.
  Reply With Quote
01/23/24, 10:08 AM   #10
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
merTorchbug and zgoo do not show you code or let you inspet code!
It's inspecting contols and tables and variables and provides search functionality to search for function names, class names, Strings, sounds etc.


If you want to find the code have a look at GitHub and or downoad the ESOUI source code locally and search in it with your development IDE.


And control names are nither existant in the ESUI source code "in total length" as they are concatenated via the parent name + child control names.
e.g. ZO_KeybindStripButtonTemplate3
It's parent is ZO_KeybindStrip
And child control is Button
and that is parent of child control Template3 again

So you need to search in ESOUI source code in xml and lua files for e.g. ZO_KeybindStrip and then check how the child controls get added there.

Sae for the function you search, try to search for AddHotbarSlotToChampionPurchaseRequest in the esoui sources.
https://github.com/search?q=repo%3Ae...uest&type=code

And then fiddle the way back to the code that calls it, via
function ZO_ChampionAssignableActionBarSlot:CollectUnsavedChanges()
And when you see the function got a : in between then you can pretty be sure ZOs uses the class
ZO_ChampionAssignableActionBarSlot and this will create an object via
<objectName> = ZO_ChampionAssignableActionBarSlot:New

So search for ZO_ChampionAssignableActionBarSlot:New
https://github.com/esoui/esoui/blob/...ionbar.lua#L37

And you will see it generates a lcoal slot there so you need to find out where this local slot was added to a global variable
and so on.
You can see e.g. that it adds each slot to the table self.slots
table.insert(self.slots, slot)

And self of self.slots would point you to the function ZO_ChampionAssignableActionBar:Initialize(control)
and to the class ZO_ChampionAssignableActionBar
->So you again search for ZO_ChampionAssignableActionBar:New to find the object! And this object's.slots would be the table that was filled with the slots then:

https://github.com/esoui/esoui/blob/...ampion.lua#L65
self.championBar -> self -> function ChampionPerks:Initialize(control) -> ChampionPerks:New ->
https://github.com/esoui/esoui/blob/...pion.lua#L2599
Code:
CHAMPION_PERKS = ChampionPerks:New(self)
So it would be <globalObject> = CHAMPION_PERKS.championBar.slots (which is self.slots from above).
You can iterate that CHAMPION_PERKS.championBar.slots then to get each slot and then call
slot:CollectUnsavedChanges()

So whatever you want to do there with merTorchbug or zgoo is not easily doable with classes and objects and you need to read the actual game code, and then "debug" it ingaem using merTorchbug and zgoo to check what the __index entries (metatables -> e.g. object pointing to it's class) show you, and see what you can find there and use there.

And then you can do something ingaem with /script or /tb or /zgoo like this:
Code:
/tb CHAMPION_PERKS.championBar.slots[1]:CollectUnsavedChanges()
Which would point to the 1st (index 1) slot in self.slots


How to find an ingame functionality by it's shown "text" (e.g. keybind "Revert changes")
But if you want to find a function that does something to discard changes then search for that in the proper esoui/ingame/whateverFolderApplies here lua and xml files -> It should be named like discrd there too or whatever the ingame keybind says.
Easiest way to find it would be
1st) find english text shown ingame and write down
2nd) Check ingame localization in merTorchbug -> type /tb and at teh global inspector select tab "Strings" and then search for that string. You will find the SI_WHATEVER* constant then.
Or find it in the esoui sources ingame localization.lua files:
https://github.com/esoui/esoui/blob/...tedstrings.lua
https://github.com/esoui/esoui/blob/...tedstrings.lua

3rd) Search for that SI_WHATEVER* constant in the esoui sources lua and xml files then to find the place where it is used,
4rd) Check which file and folder matches your usecase if this was found more than once
5th) Read the ZOs code and find out how the funciton is called -> Read above about class and "<object>" and call it accodingly properly using the object:functionName(param1, param2, .....)

Last edited by Baertram : 01/23/24 at 10:12 AM.
  Reply With Quote
01/23/24, 11:28 AM   #11
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 245
Originally Posted by Baertram View Post
merTorchbug and zgoo do not show you code or let you inspet code!
It's inspecting contols and tables and variables and provides search functionality to search for function names, class names, Strings, sounds etc.


If you want to find the code have a look at GitHub and or downoad the ESOUI source code locally and search in it with your development IDE.


And control names are nither existant in the ESUI source code "in total length" as they are concatenated via the parent name + child control names.
e.g. ZO_KeybindStripButtonTemplate3
It's parent is ZO_KeybindStrip
And child control is Button
and that is parent of child control Template3 again

So you need to search in ESOUI source code in xml and lua files for e.g. ZO_KeybindStrip and then check how the child controls get added there.

Sae for the function you search, try to search for AddHotbarSlotToChampionPurchaseRequest in the esoui sources.
https://github.com/search?q=repo%3Ae...uest&type=code

And then fiddle the way back to the code that calls it, via
function ZO_ChampionAssignableActionBarSlot:CollectUnsavedChanges()
And when you see the function got a : in between then you can pretty be sure ZOs uses the class
ZO_ChampionAssignableActionBarSlot and this will create an object via
<objectName> = ZO_ChampionAssignableActionBarSlot:New

So search for ZO_ChampionAssignableActionBarSlot:New
https://github.com/esoui/esoui/blob/...ionbar.lua#L37

And you will see it generates a lcoal slot there so you need to find out where this local slot was added to a global variable
and so on.
You can see e.g. that it adds each slot to the table self.slots
table.insert(self.slots, slot)

And self of self.slots would point you to the function ZO_ChampionAssignableActionBar:Initialize(control)
and to the class ZO_ChampionAssignableActionBar
->So you again search for ZO_ChampionAssignableActionBar:New to find the object! And this object's.slots would be the table that was filled with the slots then:

https://github.com/esoui/esoui/blob/...ampion.lua#L65
self.championBar -> self -> function ChampionPerks:Initialize(control) -> ChampionPerks:New ->
https://github.com/esoui/esoui/blob/...pion.lua#L2599
Code:
CHAMPION_PERKS = ChampionPerks:New(self)
So it would be <globalObject> = CHAMPION_PERKS.championBar.slots (which is self.slots from above).
You can iterate that CHAMPION_PERKS.championBar.slots then to get each slot and then call
slot:CollectUnsavedChanges()

So whatever you want to do there with merTorchbug or zgoo is not easily doable with classes and objects and you need to read the actual game code, and then "debug" it ingaem using merTorchbug and zgoo to check what the __index entries (metatables -> e.g. object pointing to it's class) show you, and see what you can find there and use there.

And then you can do something ingaem with /script or /tb or /zgoo like this:
Code:
/tb CHAMPION_PERKS.championBar.slots[1]:CollectUnsavedChanges()
Which would point to the 1st (index 1) slot in self.slots


How to find an ingame functionality by it's shown "text" (e.g. keybind "Revert changes")
But if you want to find a function that does something to discard changes then search for that in the proper esoui/ingame/whateverFolderApplies here lua and xml files -> It should be named like discrd there too or whatever the ingame keybind says.
Easiest way to find it would be
1st) find english text shown ingame and write down
2nd) Check ingame localization in merTorchbug -> type /tb and at teh global inspector select tab "Strings" and then search for that string. You will find the SI_WHATEVER* constant then.
Or find it in the esoui sources ingame localization.lua files:
https://github.com/esoui/esoui/blob/...tedstrings.lua
https://github.com/esoui/esoui/blob/...tedstrings.lua

3rd) Search for that SI_WHATEVER* constant in the esoui sources lua and xml files then to find the place where it is used,
4rd) Check which file and folder matches your usecase if this was found more than once
5th) Read the ZOs code and find out how the funciton is called -> Read above about class and "<object>" and call it accodingly properly using the object:functionName(param1, param2, .....)
TY! ill dig through all that.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » SetAlpha() not working


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