I am having trouble using ints.Ã, Here is of the things I have already done to try to resolve the problem:
-The globalscript now starts with all the int declarations.
-The globalscript now ends with all the export int lines
-The script header now has all the import int lines
The error:
-parse error in expr near 'health'
BTW:Ã, 'health' is defined as as int health in all the ways listed above.
Here's where it happens:
Ã, if ((health -= loss)<0) {
Any ideas?
-Thanks, Akumayo
-=? That isn't an operator.
do you mean if int1 minus int2 equals int2?
it should be an operator, no?Ã, In the manual:
Quote
You can add to and subtract from a variable using the += and -= operators. So, to add 3 to the current value of my_counter, do the following:
Ã, my_counter += 3;
I could be wrong, it could be wrong, I don't know.Ã, What I want
if ((health -= loss)<0) {
To do is check if health minus loss will be less than 0, and react accordingly, is there a better way to do this maybe?
EDIT--Fixed the problem, as it is += and -= can only be used to SET the int values, in if functions, simple + and - can be used and will work.
Yes,
x -= y
is shorthand for
x = x - y
so it won't do any good in a conditional expression.
I think I should've figured that out sooner, but thanks for clearing it up completely. :)
Well, in C this would have been a valid construction, (x -= a) both changes x and returns the result. I don't think that's what you wanted to do anyway...