Thread Tools Display Modes
04/29/23, 05:13 AM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
Question Hide armory save build button

Hey guys I'm back messing with this hide armory save build button. Ive had a semi reliable working version of it for a while now but am not totally happy with the implementation built around delays for armory opening etc.

Where im experiencing the biggest issue is 1st opening the armory as the controls dont exist yet. id like to find something specific I could check and loop back to delay more if needed because I'm concerned for people with high latency and/or very slow pc's might encounter lua errors.

Here's the section of code im trying to work with and could use a tweak on:

Code:
------------------------------------------------------------------------
------------ HIDE ARMORY SAVE BUILD BUTTON -- 131761 = open armory, 131763 = equip build
------------------------------------------------------------------------
function MyAddon.HideArmorySaveBuildDelay(eventID)-- <<< function that all the events for armory open and switch builds etc fire
	if MyAddon.savedVariables.armoryLock == false then return end
	zo_callLater(function() MyAddon.HideArmorySaveBuild(eventID) end, GetLatency()+200)
end

function MyAddon.HideArmorySaveBuild(eventID)
	if ZO_KeybindStripButtonTemplate3 == nil then MyAddon.HideArmorySaveBuildDelay(eventID) return end--<<<< LOOKING FOR HELP HERE TO LOOP BACK UP IF SAVE BUTTON NOT CREATED AND VISIBLE YET AFTER OPENING ARMORY
	if ZO_KeybindStripButtonTemplate3:IsHidden() == false then
		if eventID == 131763 then
			zo_callLater(function() ZO_KeybindStripButtonTemplate3:ToggleHidden() end, 5000)--<< loading a build
		elseif eventID == 131761 then
			zo_callLater(function() ZO_KeybindStripButtonTemplate3:ToggleHidden() end, 300)--<< opening armory
		else
			ZO_KeybindStripButtonTemplate3:ToggleHidden()--<<< selecting different builds falls here
		end
	end
end
what I'm observing with this is there is a tiny 20-30ms time where the "KeybindStripButtonTemplate3" is not nil and created but is not visible yet so it skips past "IsHidden() == false" and does nothing leaving the save button sitting there. I can obviously add more delay to compensate but not everyone needs that. Id like something to check thats a concrete way to know if it can be hidden or not.

Last edited by sinnereso : 04/29/23 at 11:58 AM.
  Reply With Quote
04/29/23, 05:58 AM   #2
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 87
have you checked out how it is done by ArmoryStyleManager.
There might be a issue with the addon by now but the function to prevent overwriting builds always worked without any issues.

https://www.esoui.com/downloads/info...leManager.html
  Reply With Quote
04/29/23, 06:21 AM   #3
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
yeh ive peeked through it trying to make sense of it. I was hoping to keep it at a more basic level and do my own thing as much as possible. I haven't been able to determine its magic yet
  Reply With Quote
04/29/23, 12:03 PM   #4
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
This setup works just ok. But imo the real issue is that the "EVENT_OPEN_ARMORY_MENU" appears to trigger before anything is actually done, sending my code in motion but theres no controls or anything yet to even look at for over 100ms. Are all events fired early like that? That event is fine like that if you intend to only output a chat message but if you intend to manipulate the armory it cant be done for at least 100ms on a decent system with decent latency.

Im giving it my best to do it this way due to the simplicity of the "ZO_KeybindStripButtonTemplate3:ToggleHidden()" which not only hides the button but also disables the keybind making it a suitable choice.

Last edited by sinnereso : 04/29/23 at 12:09 PM.
  Reply With Quote
04/29/23, 03:51 PM   #5
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
You do not work with the Keystrip directly. You should find the way to the keybinddescriptor of the amory station and add a
Code:
.visible = false
to the save button entry.
  Reply With Quote
04/30/23, 12:31 AM   #6
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
ty votan for your help.. you inspired me to take another peek at armory style manager and I found this little beuty which was all i needed,.. no more timer or events.. works 100% perfectly from settings panel . Need only 2 lines.. one on load/reload and one in settings panel doing this only:

Code:
ARMORY_KEYBOARD.keybindStripDescriptor[2].enabled = false
well obviously additional lines to check saved variable if the feature is on or off but thats it

Last edited by sinnereso : 04/30/23 at 12:35 AM.
  Reply With Quote
04/30/23, 10:46 AM   #7
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
New setup working perfectly but.. Im trying to add a lock image overtop of the keybind image in the bottom screen controls when its locked. I've got this working fine but for the life of me I cant find a way to detect when the armory is closed to remove it from the screen. suggestions?
  Reply With Quote
04/30/23, 11:13 AM   #8
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 87
does the scene manager not include the armory?

instead of just adding the lock on your scree, maybe anchor it to the button. seems like a more propper solution to me.
  Reply With Quote
04/30/23, 11:30 AM   #9
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 244
I was wondering if that were possible. Would that hide it when the keybindstrip etc is hidden when armory closes? Like the anchor disapears with what its anchored to?

**EDIT

Actually I think I'm gonna bail on it.. With the current setup the R and text is already greyed out and unusable when locked.. I might be wasting my time on useless fluff. Everything is working soo good I think im just gonna enjoy it for now.

Last edited by sinnereso : 04/30/23 at 11:37 AM.
  Reply With Quote
04/30/23, 11:38 AM   #10
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 87
if you use something of the keybind as parent then yes
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Hide armory save build button

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