Allows you to perform simple addition and subtraction
Notes: * Variables must be declared before they can
be used with set_attr and this function.
eg. setpr cool-item 1 tmpVar 0
* max and min values are artificially limited
to -65534 and 65534. Anything outside of
these bounds will return NULL (0).
Example:
> setpr cool-item tmpVar 0
> setpr cool-item 1 on_math-test
set_attr('tmpVar',''+simple_math(integer(get_attr('tmpVar')),10)),
msg_character(%a,'tmpVar is now: '+get_attr('tmpVar')),
return(true)
@
> setpr cool-item 1 on_math-test-subtract
set_attr('tmpVar',''+simple_math(integer(get_attr('tmpVar')),-10)),
msg_character(%a,'tmpVar is now: '+get_attr('tmpVar')),
return(true)
@
> compile
>
Result:
> math-test
TmpVar is now: 10
> math-test
TmpVar is now: 20
> math-test
TmpVar is now: 30
> math-test-subtract
TmpVar is now: 20
> math-test-subtract
TmpVar is now: 10
>