Trick #1 - Removing the "Done" message: Don't you hate that message that is displayed when your program terminates? "Done". Yuck. Well, you're in luck. This can be defeated! All you have to do is put Outpt(1,1,"" as the last command (Or the command right before Return or Stop). For example,
:ClLCD
:Outpt(1,1,""
will clear the screen, output nothing, and then quit the program without displaying "Done"!
Trick #2 - More Than One Statement per Line Sometimes it just makes the code neater to compact it onto fewer lines. You can do this by adding your own colon between statements. For example, these two programs are exactly the same:You don't have to switch the way that you program, just know that they mean the same thing in case other people (Like me in the next few tricks) do it.
:A=1
:B=1
:C=1
:D=1
:E=1
:F=1
:A=1:B=1:C=1
:D=1:E=1:F=1
Trick #3 - Deleting Old Variables So, what if you make some variables, for instance ones named TEMP and BEEF, and you don't need them once your program ends? Well, if you don't, then who needs them? They just take up space. Clean up after yourself! Don't make the user do it. Put code like this at the end of your programs:
:DelVar(TEMP
:DelVar(BEEF
The above code deletes the variables called TEMP and BEEF. Delete all of your unneeded variables when you finish with them and make your users happy!
Trick #4 - Killing Y= Settings Have you ever run a game, only to find that on the title screen a line would be graphed, and then you had to manually delete all your graph equations? Well, you can automatically get rid of these Y= equations! Just use code like this:
:DelVar(y1:DelVar(y2
:DelVar(y3:DelVar(y4
:DelVar(y5:DelVar(y6
:DelVar(y7:DelVar(y8
:DelVar(y9
This code deletes the first 9 graphing equations... you can do more or fewer, whatever you find necessary. This ensures that no equations will be graphed when your program is run. See trick #5 for a way to do this only temporarily.
Trick #5 - Using GDBs in Graphics Programs: GDB stands for Graph Data Base (I think). GDBs hold all of the information required to set up the graph window and equations. If you make a game, you can use a StGDB command at the beginning to save the user's settings, change the window for your game, and use RcGDB at the end to revert to the user's original settings. To do this, you would use this code:
:StGDB A
:0->xMin:162->xMax
:0->yMin:62->yMax
...program code here...
:RcGDB A:DelVar(A
The first line stores the graphing settings to variable A. The next four statements change the window for the game. One of the last lines in the program recalls the graphing settings from variable A, then gets rid of the old variable. If done properly, the game will work fine, and the user will never know that the settings were even altered. One problem: If the user breaks a program with [On], the original settings will not be recalled. It is still better to use a GDB than not, however.
I'll add more tricks as I come up with them... If you have any, please send them to me at andrewmatta@ti86world.cjb.net.
Congratulations! By now you have the knowledge to start creating excellent BASIC programs and games! If you still have questions or comments about this tutorial, or programming, feel free to send a letter to andrewmatta@ti86world.cjb.net. For some examples, check out the next chapter, Chapter 10: Sample Programs.
Click to Return to This Tutorial's Home Page