I am relatively new to coding and Ti-Basic. I code in school when bored on my 83 plus. I recently made a dice game similar to craps that has two menu's where you choose how much of your money you want to wager. Both menu's are in their own label. After shifting through menu's and selecting different options maybe 50 times the program crashed, displaying ERR:Memory. When I clicked goto, it took me to the last character of text in the first menu option that links to the second menu. Any ideas on why this would be happening or how to fix it would be appreciated. Also, the longer you play the game for, the longer it takes the calculator to generate the random dice rolls, its like it begins to lag, which I am assuming comes from the filling up memory. Thanks!
If you're gonna make a game that switches between menus like that, you might want to make a custom menu and arrange it so that it doesn't uses labels or loops (well in a way that ends it before going to the next menu) . All you need to know is that breaking out of a label without ending or a loop will not allow the calculator to clear up its memory. Other members can explain how it works better than I can.
The Silver Phantom welcomes you
When using Lbl and Goto in TI Basic, its very easy to create memory leaks, which can cause lag and ERR:Memory. I try to avoid using them as much as posible. But it is possible to use them without causing memory leaks. You can do this by making sure the Lbl and Goto are on the same level in the program. Every program structure that requires an End increases the level. A good way to show this is by indenting your program whenever you see one of these comands and unindenting when you see an End. If the Lbl and Goto are at the same level of indentation then you wont have a memory leak. If they are at different levels then you are going to have problems.
Lbl A While 1 While 1 Goto A End End
Different levels, causes a memory leak.
If 1:Then If 1:Then Lbl A End End If 1:Then If 1:then Goto A End End
Same level, no memory leak :)