TXTML

The markup language for Subversive (Mobile) Storytelling

math : subtract


DESCRIPTION

<subtract> decrements a user variable by the given value. The first value encountered by <subtract>, starting with the attribute and then traversing any sub-modules depth first, will be the initial value for the subtraction. All other values are subtracted in order. <block> may be used to define order of operation.

Note that if <subtract> is used with a variable which is a string, the number format will be applied to the variable first. If the variable has no numeric content, this will result in a value of 0. Best practice is to use the number format with the <set> module when setting variables intended to be numeric.


PARAMETERS

var - which variable to operate on
value - (float) the value to subtract     
float - (true|false) whether to store decimal values. True by default. Decimals are always restricted to two places.


EXAMPLES

...     
     <subtract var="health_points" value="1" />          
...


...     
     <subtract var="net_value">          
          <get var="costs" />
          <get var="gross" />
     </subtract>
...

introduction
installation
authoring txtml
definition
event handlers
flow control
conditions
variables
content
math
other
feeds
requestors
formats
admin interface
extending