View Single Post
10/03/17, 08:19 AM   #7
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
Ok so most likely, if you're following the guide on the wiki, you have this in your XML:

<TopLevelControl name="TestPluginIndicator"> <Dimensions x="200" y="25" /> <Anchor point="BOTTOM" relativeTo="GuiRoot" relativePoint="CENTER" offsetY="-20" />


The UI will automatically be visible from the start, because that's what makes sense. If you draw something, default behaviour should be that you see it. However, you can make it hidden from the start. Change <TopLevelControl name="TestPluginIndicator"> to <TopLevelControl name="TestPluginIndicator" hidden="true">. This probably isn't the best way to handle it though. If you do this, and the player reloadsui while in combat, the indicator will be hidden. Sure, it's a rare bug but it's still a bug. Here's two ways you can fix that.


1. Check if the player is in combat in the Initialized() function, and set it visible/hidden as needed.
2. Use the <OnInitialized> field:
<OnInitialized>
-- LUA code here. This is where you'd check to see if the control needs to be hidden or not.
</OnInitialized>
Oninitialized does what you might expect: Runs the code within when the control is created.Edit: Actually, I don't think it does that. I think it runs when the addon is initialized, but I'm not sure.


I'd suggest checking here: http://wiki.esoui.com/UI_XML to see what other attributes are available. A TopLevelControl will have the fields under TopLevelControl. Since it says Inherits: Control there, it also has all the fields which are listed under Control.

Originally Posted by elly22 View Post
No. I need to do that?

But why sign exists on startup?
CombatState is 1 by default? Or default value is sth like "CombatState = nil" and it must be set to zero manually?

The value of CombatState in general has nothing to do with the visibility of the indicator. It only affects the visibility because of the code. So changing the value of combatState will do nothing, because there's no event for a variable being changed. combatState is just a variable within your code, and it has no connection at all to the indicator. Please let me know if you're still confused about this.

Last edited by Dolgubon : 10/03/17 at 08:48 AM.
  Reply With Quote