Tips and tricks

Note: These tips and tricks might seem to be worth just one or two bytes apiece, but when I go through some of my larger 4000 byte programs with them, I always find something to make better every time, and the first few times I edit them I save a few hundred bytes.

NEVER ADD CLOSING QUOTES AND PARENTHESIS to commands.
example: output(1,1,"HELLO WORLD") can be output(1,1,"HELLO WORLD

Don't use the X and Y variables in programs. They are overwritten by the calculator often.

delete all multiplication signs between variables.
If you are multiplying regular numbers, do the math yourself and substitute it.
example: A*B can be AB, 5*15 can be 75.

expand multiplication problems.
example: (A+1)*(B+2) can be AB+2A+B+2

use the Delvar command instead of 0->. Also, unless the next line is a lbl, you dont need a new line.
example: 0->A:Output(1,1,A) can be Delvar AOutput(1,1,A

when using the circle command, add ,{i to the end to speed up circle drawing. use the imaginary i.
example: Circle(15,42,4,{i instead of Circle(15,42,4)

omit closing quotes and parenthesis when storing.
example: "HELLO WORLD"->Str1 can be "HELLO WORLD->Str1

the most space saving graphing window is 0->Xmin:0->Ymin:62->Ymax:94->Xmax. This can be annoying when using the text command, but if you subtract where you would normally put text from 62, its the same. Also, this Graphing window can be abbreviated to 0->Xmin:1->triangleX:0->Ymin:1->triangleY. triangle X and Y can be found under vars/window/8 or 9.

to perfectly center an object on the graph screen, use this math equation. remember, do the math yourself and substitute.
Text(28, 47-.5*((4*number of letters in text)+number of spaces),TEXT HERE

here's a nifty one. Calculate the number of digits in a variable with 1+Int(Log(variable.
an example for use in displaying a user's HP in a fighting game.
Output(1,1,current HP variable
Output(1,2+int(log(current HP variable)),"/
Output(1,3+int(log(current HP variable)),max HP variable

DO NOT USE GOTO's or LBL's unless ABSOLUTELY NECESSARY. USE LOOPS SUCH AS WHILE and REPEAT instead.
examples
instead of
Lbl 1
……
……
if A=1
Goto 1
End
put
While not(A
……
……
End
or
Repeat A
……
……
End

One way to save space is to write subroutines. just write a program that contains a group of code lines often used in your program then substitute the program where the code lines are. Remember to put Return at the end of the subroutine.

the input command by itself allows the user to input a point on the graph screen, and saves the coordinates in X and Y. Remember to store X and Y to other variables as they are dangerous to use.

putting a ,0 at the end of a line command makes it a line off command.

putting a ,2 at the end of a pt-on or pt-off command makes a box around the point with a blank in the middle, like this. 1 means black and 0 is white.
111
101
111

putting a ,3 at the end of a pt-on or pt-off command makes a cross at the point, like this.
010
111
010

you can replace 10X with EX, and multiply it by a number to save space on long numbers. The E character can be found in the catalog.
example: 4E3 instead of 4000, E3 instead of 1000, E5 for 100000, or 3E4 instead 30000.

if you use a number with more than 1 digit more than five times in a program, you will want to store the number to a variable and use the variable.

if you need a number or calculation a lot and you are not overwriting the ans variable, you might want to put it on its own line right before you need it and use ans to insert the calculation where necessary.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NoDerivs 3.0 License