VGInterface.com
Search Downloads


Login
User Name:

Password:

Remember Me?

StateKeys (Conditionals)

From VGInterface Wiki

image:Vgsohinterface_logo.jpg

Authors: Apoco & Parom

Contents

General Info

BinaryControls and StateControls are used as if else type statements used when you want the display of information only when a certain game state is true.

BinaryControl

This will be used only when a TRUE / FALSE situation is available. It will only flip between two states. For what constitutes True or False in variables see below.

BinaryWindow

Used the same as BinaryControl but if you want to change between an entire window's worth of controls.

StateControl

To be used when your variable returns a specific or multiple values that you want to use. This is also the one to use if you have two options but neither are considered False.

StateControl also has the following attribute useFirstOnInvalid as a default.

Remember that the state controls MUST have at least two entries although any one entry can have an empty placeholder static window. Variables are considered true if the have a value set. Strings are true unless empty and integers are true unless 0.

StateWindow

The big thing to remember is that if you are including more than one single control in each you MUST wrap them into one container before hand or the controls will show even when it isn't true of that value. The wrapper of choice is to use StaticWindow.

StateWindow also has the required attribute: stateKey.

Examples of StateControl

This is a very basic example of how a state control would work. This is what Parom and I were testing with. What it is doing:


IF TimeSecondsGV = 1 THEN Show 1 ELSE IF TimeSecondsGV = 2 THEN Show 2 ELSE Show TimeSecondGV


   <UseControl type="StateControl" gameVarLink="TimeSecondsGV">
          <StateControl useStateKeys="true" useFirstOnInvalid="true">
               
               <StateWindow stateKey="none">
                   <UseControl    type="TextField">
                       <TextField fontSize="7" color="white" align="left">
                           <Rect x="75" y="5" width="40" height="20"/>
                           <Text><gamevar=TimeSecondsGV></Text>
                       </TextField>
                       <Settings dropShadowText="true"/>
                   </UseControl>
               </StateWindow>
               
               <StateWindow stateKey="2">
                   <UseControl    type="TextField">
                       <TextField fontSize="7" color="white" align="left">
                           <Rect x="100" y="5" width="40" height="20"/>
                           <Text>2</Text>
                       </TextField>
                       <Settings dropShadowText="true"/>
                   </UseControl>
               </StateWindow>
               
               <StateWindow stateKey="1">
                   <UseControl    type="TextField">
                       <TextField fontSize="7" color="white" align="left">
                       <Rect x="100" y="5" width="40" height="20"/>
                           <Text>1</Text>
                       </TextField>
                       <Settings dropShadowText="true"/>
                   </UseControl>
               </StateWindow>
          
          </StateControl> 
    </UseControl>

Advanced StateKeys

Inside a StateWindow, you are allowed two advanced options:

StateControl

Components.

Here is an example of the Clock Code from the AssimX UI, using a highly advanced version of StateKeys/Controls

<UseControl type="StateControl" gameVarLink="TimeHoursGV">
   <StateControl useStateKeys="true" useFirstOnInvalid="true">
                   
       <StateWindow stateKey="none">
           <UseControl type="StateControl" gameVarLink="TimeMinutesGV">
               <StateControl useStateKeys="true" useFirstOnInvalid="true">
                   
                   <StateWindow stateKey="other">
                       <UseControl type="TextField">
                           <TextField fontSize="7" color="white" align="left">
                               <Rect x="1235" y="5" width="50" height="20"/>
                               <Text>&lt;gamevar=TimeHoursGV&gt;:&lt;gamevar=TimeMinutesGV&gt; A.M.</Text>
                           </TextField>
                           <Settings dropShadowText="true"/>
                       </UseControl>
                   </StateWindow>
                   
                   <StateWindow stateKey="0">
                       <UseControl type="TextField">
                           <TextField fontSize="7" color="white" align="left">
                               <Rect x="1235" y="5" width="50" height="20"/>
                               <Text>&lt;gamevar=TimeHoursGV&gt;:00 A.M.</Text>
                           </TextField>
                           <Settings dropShadowText="true"/>
                       </UseControl>
                   </StateWindow>
                   
                   <StateWindow stateKey="1">
                       <UseControl type="TextField">
                           <TextField fontSize="7" color="white" align="left">
                               <Rect x="1235" y="5" width="50" height="20"/>
                               <Text>&lt;gamevar=TimeHoursGV&gt;:01 A.M.</Text>
                           </TextField>
                           <Settings dropShadowText="true"/>
                       </UseControl>
                   </StateWindow>
                   
               </StateControl>
           </UseControl>
       </StateWindow>
                   
       <StateWindow stateKey="12">
           <UseControl type="StateControl" gameVarLink="TimeMinutesGV">
               <StateControl useStateKeys="true" useFirstOnInvalid="true">
                   
                   <StateWindow stateKey="other">
                       <UseControl type="TextField">
                           <TextField fontSize="7" color="white" align="left">
                               <Rect x="1235" y="5" width="50" height="20"/>
                               <Text>&lt;gamevar=TimeHoursGV&gt;:&lt;gamevar=TimeMinutesGV&gt; P.M.</Text>
                           </TextField>
                           <Settings dropShadowText="true"/>
                       </UseControl>
                   </StateWindow>
                   
                   <StateWindow stateKey="0">
                       <UseControl type="TextField">
                           <TextField fontSize="7" color="white" align="left">
                               <Rect x="1235" y="5" width="50" height="20"/>
                               <Text>&lt;gamevar=TimeHoursGV&gt;:00 P.M.</Text>
                           </TextField>
                           <Settings dropShadowText="true"/>
                       </UseControl>
                   </StateWindow>
                  
                   <StateWindow stateKey="1">
                       <UseControl type="TextField">
                           <TextField fontSize="7" color="white" align="left">
                               <Rect x="1235" y="5" width="50" height="20"/>
                               <Text>&lt;gamevar=TimeHoursGV&gt;:01 P.M.</Text>
                           </TextField>
                           <Settings dropShadowText="true"/>
                       </UseControl>
                   </StateWindow>
                  
               </StateControl>
           </UseControl>
       </StateWindow>
                  
   </StateControl>
</UseControl>

Known Problems:

1: If you /reloadui, StateKeys WILL NOT work. -- To Fix this, you must logout/login or restart game.

All times are GMT -5. The time now is 03:59 AM.


Our Network
EQInterface | EQ2Interface | War.MMOUI | WoWInterface | VGInterface | LoTROInterface | MMOInterface