Not sure if considered a bug or just how the system works, but either way it's just yet another annoyance I have with how constants work in AGK.
Essentially, when you use a constant it doesn't hold any value at all but is a placeholder for whatever is assigned to it. In my function below, it doesn't see 0.2 (1280/6400), it literally inserts 1280 / 6400 into the middle of the equation, which unless I wrap RATIO_X in parenthesis, throws off the whole value.
Global _targetZoom# = 3.0
#CONSTANT RATIO_X = 1280 / 6400.0
print(getScreenToWorldX(640))
function getScreenToWorldX(x as float)
x = getRawMouseX() / (RATIO_X) / _targetZoom#
endfunction x
Another weird example:
If I do the following, I can't use the constant inside a function because "thing" isn't seen unless I make it global.
[code]
thing = 1280
#CONSTANT RATIO_X = thing / 6400.0
[/code]
thing = 1280
#CONSTANT RATIO_X = thing / 6400.0
[/code]