Xardex wrote...
So far += and -= has been good enough for me, but...
I just noticed that *= and /= doesn't return an error when compiling. I assume they work since they are the most obvious and common math operations, but then I started testing...
yes this is most likely what you are thinking it is.
x *= 5; is the same as x=x*5 ;
x /= 5 ; is the same as x=x/5;
&=
%=
again about the same you just need to know what the operators are.
x &=; is the same as x=x & 5; This will do a bitwize
And between x and 5. unlike the logical And(&&) that returns just true or false. (1 or 0) the bit wize And(&) will a logical and on every bit position in the number.
so if x = 260.
x &= 5 would return a value of 4 for x. That being the only bit the two numbers have in common.
the %= is a modulous so
x %= 5 would be the same as x = x % 5; it returns the remainder of the devision of x and 5. so it x was initinaly 6 the remainder would be 1.
$=
I do not know that the $ operator does in NWN. I have speculated on it in the past though.
@=
'=
it has been speculated that the @ is a compiler directive. I have no idea what your number would evalute to. I may have to play with this one a bit more since this will compile.
the '= do not have a clue.
...Do not return an error either. Does anyone know what are they used for?
the unknown ones above may just be compiler bugs returning unknown values to the varaiable. along with the other unknown one below. the \\=.
Also ^= compiles fine... I assume this is used to raise a number to an exponent...
If it is so, what is the point of the pow( ) function?
This one you have wrong. In NwN script the carrot(^) is not a to the power of operator. It is a Bitwize ExclusiveOr Operator.
So x ^= 5; is the same as x = x^5; that is the Exclusive Or between all the bits positions of x and 5;
rounding out that set you missed on the Or =
|=
Hope that all help.