Problems with variable scope

BlitzMax Forums/BlitzMax Programming/Problems with variable scope

Hi, I have two includes:

;game.bmx
Type game
	Global score:Int = 0
End Type

;editor.bmx
Type editor
	Function Check()
		If game.score = 0
			Notify "ok"
		EndIf
	End Function
End Type


And then I call editor.Check() from somewhere else. The problem is, editor.Check() cannot see game.score during compilation.

The error being returned during compilation is:


Compile Error
Identifier 'score' not found



I cannot reproduce it with the example above. It tends to happen sparodically and is in my somewhat huge game. But I have boiled it down to basically this situation.

What I am asking for is advice on why this can happen, and why it could happen, and any experiences you may have had with identifiers not found.

This will help me avoid this situation in future.