Okay, rather than start a new thread, I'll just ask my question here. Why can't I declare a global variable within a function and have it work in every other function? While it may seem like it works, it doesn't. Here's what happened.
1. I had three functions: VARIABLES(), DISPLAY_MENU(), and CONTROL_MENU().
2. Within the VARIABLES() function, I declared (but did not initialize) the variable ButtonOver.
3. In the DISPLAY_MENU() function, I have a DO loop. Within this do loop, there are many instances in which ButtonOver's value can be changed, mostly by the user putting their mouse over a button I have. Within the DO loop (all code within the function is in the DO loop) I call CONTROL_MENU(). In the CONTROL_MENU() function it is vital that I read the value of ButtonOver. I did this the first time to have it not work. So, obviously analyzing my code and run-time for errors, I use the code
center text 50, [y position], "ButtonOver: " + str$(buttonover). I found that in the DISPLAY_MENU() function, the variable is altered, yet when CONTROL_MENU() is called, either the variable is reset or it has not been globally altered.
4. When I tried declaring ButtonOver at the top of my program (NOT within a function), I did not have this problem and the variable was globally altered.
Any ideas? Could this be a...
*dum dum dum*
Bug?!
Team EOD :: Programmer/Storyboard Assistant