ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Hide armory save build button (https://www.esoui.com/forums/showthread.php?t=10528)

sinnereso 04/29/23 05:13 AM

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.

ExoY 04/29/23 05:58 AM

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

sinnereso 04/29/23 06:21 AM

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

sinnereso 04/29/23 12:03 PM

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.

votan 04/29/23 03:51 PM

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.

sinnereso 04/30/23 12:31 AM

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 :)

sinnereso 04/30/23 10:46 AM

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?

ExoY 04/30/23 11:13 AM

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.

sinnereso 04/30/23 11:30 AM

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.

ExoY 04/30/23 11:38 AM

if you use something of the keybind as parent then yes


All times are GMT -6. The time now is 05:24 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI