CRelease isn't a global variable so it will just equal 0 whenever you try to use it outside of the function. In this case, CRelease is local. This means that whenever you call that function, it uses its own version of CRelease, not the CRelease you see outside of the function.
Having said that, your function returns a value. This means that if you set a variable equal to that function, then the variable will equal the value returned. To make your code work you can do one of two things:
1.
Change this:
to this:
CRelease=MouseRelease(1,200)
So your end code is:
CRelease=MouseRelease(1,200)
IF CRelease=1
` Do Stuff
ELSE
` Do Stuff
ENDIF
What that does is set the CRelease variable used outside of the function to the value returned from the function. Since you return the number in the function's own version of the CRelease variable, you are essentially setting the external CRelease variable to the function's internal one. You could just as easily do this:
roflcopter=MouseRelease(1,200)
and use "roflcopter" as your variable, doing this:
roflcopter=MouseRelease(1,200)
IF roflcopter=1
` Do Stuff
ELSE
` Do Stuff
ENDIF
2.
The second thing you could do is declare CRelease as a global variable:
and have the function return nothing at all. What the GLOBAL command basically does is it makes a variable have no internal version so that functions have to use the same version that the main program and all of the other functions use. This means that you could change a variable without returning a value at all.
<-- Spell based team dueling game!