Difference between revisions of "Operator Element"

Jump to navigation Jump to search
349 bytes added ,  13:43, 31 March 2010
imported>JRoush
m
imported>JRoush
Line 1: Line 1:
== Overview ==
== Overview ==
Operator 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.
Operator 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 evaluates in real time to get the property value.


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:
There is pretty much an Operator Element for every basic mathematical operator - at least of or every operator that takes two operands. The first operand is always the current value of the property (i.e. whatever the value was the ''previous'' frame).
If the operator contains a literal number or string, that is used as the second operand.  For example:
  <image>
  <image>
   <x>
   <x>               &lt;!-- Move image 1 pixel to the right every frame --&gt;
     <add> 1 </add>  &lt;!-- Add one to current x position --&gt;
     <add> 1 </add>  &lt;!-- (Add 1 to current x position) --&gt;
  </x>
</image>
However, Operators instead refer to ''other properties'' for the value of their second operand, or even properties of ''other Object elements''.  For example:
<image name="example_image>
  <y> 5 </y>        &lt;!-- Move image 5 pixels to the right every frame --&gt;
  <x>  &lt;!--Add the value of the y coordinate (5) to the current x position --&gt;
    <add src="example_image" trait="y"/>
   </x>
   </x>
  </image>
  </image>
A property element may contain a series of Operators, which are evaluated in order:
Here ''src'' and ''trait'' are XML [[traits]] indicating the Object & Property, respectively, to get the value from.  '''Don't be confused:''' The XML trait called ''trait'' here actually refers to a ''Property Element'', not another XML trait.  It seems Bethesda used the word differently than the XML community at large.
 
A property element may contain more than one Operator, which are evaluated in order:
  <image>
  <image>
   <x>
   <x>
Line 16: Line 26:
   </x>
   </x>
  </image>
  </image>
Operator Elements may contain other operator elements as children:
 
Operator Elements may contain other operator elements as children to make more complicated formulas:
  <image>
  <image>
   <x>
   <x>
Line 26: Line 37:
   </x>
   </x>
  </image>
  </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>
Here ''src'' and ''trait'' are XML [[traits]] indicating the source element and property, respectively.  Don't be confused by the use of the word 'trait' in the latter case - it's actually referring to a element (specifically a 'property' element).


== Copy Operator ==
== Copy Operator ==
Anonymous user

Navigation menu