Difference between revisions of "Operator Element"
→Overview
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 | 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 | 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> <!-- Move image 1 pixel to the right every frame --> | ||
<add> 1 </add> <!-- Add | <add> 1 </add> <!-- (Add 1 to current x position) --> | ||
</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> <!-- Move image 5 pixels to the right every frame --> | |||
<x> <!--Add the value of the y coordinate (5) to the current x position --> | |||
<add src="example_image" trait="y"/> | |||
</x> | </x> | ||
</image> | </image> | ||
A property element may contain | 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> | ||
== Copy Operator == | == Copy Operator == |