Didnt check everything, but the variable definitions cant compile as the array dimensions are based on constants defined after the actual arrays itself.
You cant write constants as you attempt to do in your function. Also take a close look at your second for loop condition.
As a person with years of c/c++ experience you should be able to find simple compilation errors like these yourself though.
As Mille25 pointed out, the first error is "Non-constant initialization of constant object / array bounds must be constant". This is because you only declare and define the constants after you declare and define the array.
After correcting that it then highlights the error you showed. "nCivsGiven" is undefined as you called the variable "nCivGiven".
After that there is another error due to you trying to mutate constants. The hint is in the name.
After correcting all 3 above the following is the result which does compile.
Simply a copy paste error sorry about that. Also, the environment is completely different from c/cplusplus and my syntax highlighting package doesn't work properly. It would really help if it functioned correctly and errors were more helpful.
Anyways I see the issue, although I don't remember changing it. Me trying to modify const vars was due to me originally having vars in function( not const ). Trying to modify code I wrote in the trigger editor 10 months ago doesn't work out too well xD.
Anyways, thanks for the help, error parsing for just didnt make me think about variables, a undeclared variable nCivsGiven would be much more helpful.
a undeclared variable nCivsGiven would be much more helpful.
I guess that might be because of how the error is detected probably being not too well written. It might try to resolve the expression, fail (due to undeclared name) so then try to resolve a ';' and report that as an error purely because it was the last thing it tried to resolve. The error should be raised when it evaluates the expression in which case it should say the name is unresolvable.
At least it is better than WC3 where some errors would highlight almost every line of the entire script.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Didnt check everything, but the variable definitions cant compile as the array dimensions are based on constants defined after the actual arrays itself.
You cant write constants as you attempt to do in your function. Also take a close look at your second for loop condition.
As a person with years of c/c++ experience you should be able to find simple compilation errors like these yourself though.
As Mille25 pointed out, the first error is "Non-constant initialization of constant object / array bounds must be constant". This is because you only declare and define the constants after you declare and define the array.
After correcting that it then highlights the error you showed. "nCivsGiven" is undefined as you called the variable "nCivGiven".
After that there is another error due to you trying to mutate constants. The hint is in the name.
After correcting all 3 above the following is the result which does compile.
Simply a copy paste error sorry about that. Also, the environment is completely different from c/cplusplus and my syntax highlighting package doesn't work properly. It would really help if it functioned correctly and errors were more helpful.
Anyways I see the issue, although I don't remember changing it. Me trying to modify const vars was due to me originally having vars in function( not const ). Trying to modify code I wrote in the trigger editor 10 months ago doesn't work out too well xD.
Anyways, thanks for the help, error parsing for just didnt make me think about variables, a undeclared variable nCivsGiven would be much more helpful.
I guess that might be because of how the error is detected probably being not too well written. It might try to resolve the expression, fail (due to undeclared name) so then try to resolve a ';' and report that as an error purely because it was the last thing it tried to resolve. The error should be raised when it evaluates the expression in which case it should say the name is unresolvable.
At least it is better than WC3 where some errors would highlight almost every line of the entire script.