Jump to content
Sign in to follow this  
r.flagg

'warning nil variable overridden...'

Recommended Posts

First time I've ever seen this before, and since I've used a lot of 'tricks' in this mission that I've never used before (stuff I find here on the forums), I'm not sure where to begin. So I'm starting by just asking a generalized sort of question.

Has anyone seen this message before, and if so, is there any sort of specific type of thing I should be looking for. The message on mission loading said;

"Warning nil variable overridden . fix mission or loaded addon scripts"

I had fired up the mission a bunch of times myself through the MP editor, and never got that message. But when my friend hosted me through a listen server, that's when we saw it.

I'm using the latest beta also.

Share this post


Link to post
Share on other sites

Your friend was probably using CBA and someone who made the mission made the mistake of using nil = something in the scripting somewhere. Don't use nil, use _nul or _nil, but not nil :)

Share this post


Link to post
Share on other sites

Squint will catch attempts to assign to 'nil' (or any other reserved keyword).

Share this post


Link to post
Share on other sites
Your friend was probably using CBA and someone who made the mission made the mistake of using nil = something in the scripting somewhere. Don't use nil, use _nul or _nil, but not nil :)

Yet the best way to do it, and completely problem-free (if you don't want the handle) is to do:

0 = execVM "script.sqf"

Why? It doesn't error, it doesn't change the value of zero, and it simply... works. There's no danger of redefining another variable or reserved keyword, and even to someone reading the code (who is unfamiliar with SQF) it becomes relatively obvious, relatively quickly, that it's just used for discarding the handle.

Normally, in a language, I'd expect this to error or, maybe (but I'd cringe), to allow zero to be re-assigned to the new value (have fun with maths, after evaluating 0=1, kids) - but the way BIS have allowed this has given me a useful way to 'throw away' script handles :)

Share this post


Link to post
Share on other sites

Well this is fantastic replies, thank you guys. Now I know exactly what I need to go and look for.

Here I was worried I was going to be disassembling this thing one piece at a time trying to find out what I borked.

Love these forums! Thanks guys!

Share this post


Link to post
Share on other sites

Will the command for "isNil" (for checking variable status) also generate this error message?

I have removed what I believe to be every instance of nil from the Red Mercury mission, and replaced it with _nil, but I left any instance of "isNil" and still I get this message from CBA

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×