06/04/15, 05:11 PM | #1 | |
Join Date: May 2015
Posts: 7
|
Trouble Hiding Objects
Hello again,
I am having trouble hiding objects related to the reticle, such as the reticle itself, stealth text, reticle interact button etc In the mean time i have been setting a Anchor offscreen if i wanted to hide the element, then restoring the original anchor when i want to show it, as calling SetHidden(true) seems to hide it until it shows after exiting UI, killing an enemy and other cases. I have registered events to try and combat this, but it seems that unless i set a delay on the function that was registered to the event, that the object wil reappear (seems to reappear within first 0.7-0.8 seconds). I am guessing that I need to somehow unregister an event on the object (?), as I have seen that function in zgoo, however I havent had any success while playing around with it. Any ideas? The method ive been using in the meantime does work, however I would rather see if i can somehow use SetHidden() so i dont have to store original anchors and such. Thank you |
|
06/04/15, 11:49 PM | #2 | |
All calling this function: Lua Code:
Lua Code:
|
||
06/05/15, 12:04 AM | #3 | ||
Join Date: May 2015
Posts: 7
|
Also, I have been using ZO_ReticleContainerReticle, ZO_ReticleContainerStealth etc rather than RETICLE, what is the differences between ZO_ReticleContainer and RETICLE? Thank you for your help |
||
06/05/15, 01:24 AM | #4 | |
I'm at work now, so I can not test what I'm writing, but it is basically:
Lua Code:
Lua Code:
I talk about the reference to the function, not calling it. RETICLE is the instance of the controller class handling the ZO_ReticleContainer control and its child controls. |
||
06/05/15, 02:21 AM | #5 | ||
Join Date: May 2015
Posts: 7
|
I think i just don't really understand some of the terms and what is meant by hooking, so i googled it and that i think i get what you mean. Here: Lua Code:
the function RETICLE:UpdateHiddenState() is replacing the function UpdateHiddenState() in RETICLE, so we are pretty much redefining what the UpdateHiddenState() function in RETICLE does, so in this case where your '--Do your post-hook stuff' comment is, I would call SetHidden(true) on the children of RETICLE?, and thus in my case in particular i do not need any pre-hook stuff? Also does the redefined function's placement being inside the hook function matter? if so, why? would it position inside a function mean that i would have to call the function differently, or would it still be just RETICLE:UpdateHiddenState(). But then whats the difference between that method, and simply calling the orininal RETICLE:UpdateHiddenState(), followed by a SetHidden(), wouldnt the reticle just toggle back on again as i described in the OP? Am I on the right track or is my understanding/interpretation completely off? Sorry for the bombardment of questions, I have always just called functions on ZO_ objects before and had no idea about these handlers(?). Was using these handlers(?) the intended way for manipulating objects? Thank you for your help EDIT: Nevermind on those questions above, I tried it out and it works perfectly and I think I understand it all, so basically its in a way similar to RegisterForEvent, but instead of an event on the event list, its whenever the UpdateHiddenState is called, right? (And you can do code before the function call) Also, in the original UpdateHiddenState(), it calls the SetHidden(value) function right? otherwise the second method (HookReticleSetHidden) wouldnt work. is that correct? Last edited by hoydyd : 06/05/15 at 02:55 AM. |
||
06/05/15, 03:58 AM | #6 | |
Inside UpdateHiddenState the SetHidden of that control is called based on GetUnitDisguiseState("player") and GetUnitStealthState("player") function RETICLE:UpdateHiddenState() is a Lua shortcut for function RETICLE.UpdateHiddenState(self) In Lua nearly everything is a variable. Including function names. Replacing/Overwritting a function is just assigning a new nameless function to a named table member/variable. The overwritting takes place in the moment you do the assignment. Putting the code into a function has two effects: 1. The scope of the "backup" variable is limited. So you know who can and will call the base function only. 2. The assignment=replacement is delayed to the moment everything is initialized (e.g. your saved variable=addon settings) Otherwise you may get unexpected nil value errors. Happened to me edit 1: Well, controls are just controls. Like your addon, there is always some additional code doing something with them. And for a lot classes/instances ZOS is so kind to give public access via those global variables like RETICLE, PLAYER_INVENTORY and so on. Last edited by votan : 06/05/15 at 04:10 AM. |
||
06/05/15, 10:34 PM | #7 | ||
Join Date: May 2015
Posts: 7
|
Just wondering, but in the function listed here: http://esodata.uesp.net/100010/src/i...e.lua.html#217 there is no mention of getting the disguise or stealth state. And i can't seem to find out what is inside the IsReticleHidden function. I mention this as I have an issue when reenabling the stealth eye, and i think i can fix it, but i cant really explore all thats happening during UpdateHiddenState(). the reticle works fine but the stealth eye either doesnt reappear, or depending on how i do it, looks like a weird half-eye fuzzy texture. Any other way to see everything thats happening in that function? Also, does an (m) next to a function in zgoo mean you cant access it or something?, having trouble with only one function and it has an (m) before it I seems like RETICLE may be different to what i linked Thank you Last edited by hoydyd : 06/06/15 at 01:38 AM. |
||
06/06/15, 08:57 AM | #8 | |
I think the "m" stands for "metadata". Meaning it is from a "class" definition. CU |
||
ESOUI » Developer Discussions » Lua/XML Help » Trouble Hiding Objects |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|