I ran into some $calc behaviour I find rather odd, and I was hoping someone here could explain why it happens. Usually when doing calculations I use $calc to avoid things being interpreted as text instead. Now consider this line:

Code:
var %change = $calc($2 - %bonus_ [ $+ [ $1 ] ])


$1 = str (the rest of the variable name I want to use..)
$2 = 0
%bonus_str = 4

%change becomes 0, while I was expecting 0 - 4 = -4
If I omit the $calc() part, %change is correctly assigned the value -4, but why?

Explanation would be appreciated to prevent future potential bugs in my scripts smile

Last edited by SubSpace; 26/01/03 05:31 PM.