Difference between revisions of "Operator Element"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>JRoush
(listed elements)
 
imported>JRoush
Line 1: Line 1:
{{unfinished}}
{{unfinished}}
Property Elements are a subgroup of the elements in the [[:Category: Oblivion XML|Oblivion XML]] schema, always found as children of [[Property Element]]s.  They are used to create mathematical formulas, which the game engine can evaluate to obtain a value for the parent property.


== General ==
There is, generally speaking, an Operator Element for every basic ''binary'' mathematical operator - every operator that takes exactly two operands. The first operand is always the current value of the property, and the second is the contents of the operator.  For example:
*Copy
<image>
  <x>
    <add> 1 </add>  &lt;!-- Add one to current x position --&gt;
  </x>
</image>
A property element may contain a series of Operators, which are evaluated in order:
<image>
  <x>
    &lt;!-- New X = (X + 10) * 2 --&gt;
    <add> 10 </add>
    <mult> 2 </mult>
  </x>
</image>
Operator Elements may contain other operator elements as children:
<image>
  <x>
    &lt;!-- New X = X + (10 / 3) --&gt;
    <add>
      <copy> 10 </copy>
      &lt;div> 3 &lt;/div>
    </add>
  </x>
</image>
Operator Elements may contain the value of a property for some other element somewhere in the menu:
<image>
  <x>
    &lt;!-- Place this image 10 pixels to the right of the "ExitButton" element --&gt;
    <copy src="ExitButton" trait="x"/>
    <add src="ExitButton" trait="width"/>
    <add> 10 </add>
  </x>
</image>


== Algebraic ==
== Copy ==
The only unary (single-operand) operator.  The <copy> operator ''replaces'' the current property value with its contents:
<image>
  <x>
      &lt;!-- Set the current x position to be 50 pixels --&gt;
      <Copy> 50 </Copy>
  </x>
</image>
 
== Algebraic Operators ==
*Add  
*Add  
*Sub  
*Sub  
Line 10: Line 51:
*Div
*Div


== Conditional ==
== Boolean Operators ==
*Onlyif
*Onlyif
*Onlyifnot
*Onlyifnot

Revision as of 01:40, 19 December 2009

Property Elements are a subgroup of the elements in the Oblivion XML schema, always found as children of Property Elements. They are used to create mathematical formulas, which the game engine can evaluate to obtain a value for the parent property.

There is, generally speaking, an Operator Element for every basic binary mathematical operator - every operator that takes exactly two operands. The first operand is always the current value of the property, and the second is the contents of the operator. For example:

<image>
  <x>
    <add> 1 </add>  <!-- Add one to current x position -->
  </x>
</image>

A property element may contain a series of Operators, which are evaluated in order:

<image>
  <x>
    <!-- New X = (X + 10) * 2 -->
    <add> 10 </add>
    <mult> 2 </mult> 
  </x>
</image>

Operator Elements may contain other operator elements as children:

<image>
  <x>
    <!-- New X = X + (10 / 3) -->
    <add> 
      <copy> 10 </copy>
      <div> 3 </div>
    </add>
  </x>
</image>

Operator Elements may contain the value of a property for some other element somewhere in the menu:

<image>
  <x>
    <!-- Place this image 10 pixels to the right of the "ExitButton" element -->
    <copy src="ExitButton" trait="x"/>
    <add src="ExitButton" trait="width"/>
    <add> 10 </add>
  </x>
</image>

Copy

The only unary (single-operand) operator. The <copy> operator replaces the current property value with its contents:

<image>
  <x>
     <!-- Set the current x position to be 50 pixels -->
     <Copy> 50 </Copy>
  </x>
</image>

Algebraic Operators

  • Add
  • Sub
  • Mult
  • Div

Boolean Operators

  • Onlyif
  • Onlyifnot
  • Lt
  • Gt
  • Eq
  • Neq
  • Min
  • Max