TI-BASIC:Text
Command Summary
Displays a number, a string, or several numbers and strings (you may mix and match) at (row, column) on the graph screen, using the small font.
The alternative syntax allows using the large font on the graph screen (TI-83+ and higher only)
Command Syntax
Text(row, column, value1 [,value2, ...])
(83+ and higher only) Text(-1, row, column, value1 [,value2, ...])
Menu Location
Press:
- 2ND PRGM to enter the DRAW menu
- 0 to choose Text(, or use arrows
TI-83/84/+/SE
1 byte
The Text( command allows you to display text on the graph screen, using the small font. It takes three arguments: the row (0-62) at which you want to display something, the column (0-94), and whatever it is you want to display. Like the Output( command, it is limited to numbers and strings. If part of what you want to display goes off the screen, it will not be displayed - the calculator will cut you off at the most characters that will fit on the screen entirely.
Unlike the large text used on the home screen, the small font this command uses varies in width from 2 pixels to as many as 6 (counting the blank space at the end of each character, which is 1 pixel). All characters are 6 pixels tall, but the top row of pixels is used very rarely (only in international characters such as ä). On the TI-84+ and TI-84+ SE, the Text( command may also erase a single row of pixels underneath the text: whether this occurs or not depends on whether it was the menu screen or the table that was visited last, of the two.
Without storing them to a special string, the Text( command cannot be used to display quotation marks (") and the Store command (→). However, you can mimic these respectively by using two apostrophes (' ' ), and two subtract signs and a greater than sign (—>).
Like many other drawing commands, if you're outside a program and on the graph screen, you can use this command directly, without going to the home screen. Just select Text( from the draw menu, and you will be able to type text at a cursor you control with arrow keys; press CLEAR or ENTER (among other things) to exit this mode.
Advanced Uses
On the TI-83+, 83+SE, 84+, and 84+SE, Text( has an alternate syntax: put a -1 before the row and column to display the text using the large font instead of the small font. With this syntax, Text( becomes like an Output( for the graph screen, but with more features: you don't have to display text exactly aligned to one of the home screen's rows and columns, and you can display more than one string or number at a time. Also, text still won't wrap like Output('s does.
This feature may be helpful in making programs more appealing, but remember that it does not work on the regular TI-83. If you want to maintain compatibility, don't use this syntax, or make an alternate version of your program without it.
The Text( command is also critical to the sprite technique known as text sprites. Although they have limitations, they allow pure Basic programs to have high-quality graphics without taking up lots of space.
On the TI-84+ and TI-84+ SE, another compatibility issue occurs with Text(. On certain occasions, using Text( to display small text on the graph screen will erase a 1-pixel margin below the text itself. The cause is a system option which is turned on when accessing the new MODE menu, and turned off when accessing the table, matrix editor, or list editor. The 1-pixel margin may not seem like a big deal, but it's enough to stop certain games (such as Bryan Thomas's Contra) from working on the TI-84+/SE.
The situation can be detected quite easily: turn on a pixel, display text 6 rows above it, and test if the pixel is still turned on. Fixing the situation is slightly more difficult:
- The hex code AsmPrgmFDCB058EC9 will disable the option (but it requires having an additional subprogram).
- DispTable will also do the trick, but of course it will display the table as well.
- Switch the program to G_T while it's on the graphscreen. Before doing this it's useful to have a FnOff.
- There's the option of telling users to access a certain screen before playing...
You can also try to get around the situation by storing and recalling pictures, to prevent anything from being erased when you don't want it to be.
Error Conditions
- ERR:DOMAIN is thrown if the coordinates of Text( are not integers or are out of range: usually the range is between 0 and 57 for the row, and between 0 and 94 for the column. A few comments:
- ERR:DATA TYPE can sometimes occur instead on the TI-83+ or higher because of confusion with the alternate syntax
- Similarly, Text(-1,0,0) will cause no error and display nothing whatsoever on the TI-83+ or higher.
- With Text(-1,... the upper bound on the row is one less of what it would be normally.
- In Horiz mode the upper bound on the row is 25 rather than 57. In G_T mode the upper bound on the column is 46.
- ERR:ARGUMENT is thrown if the number of arguments given to Text( is 256 or more or if one of the arguments contains an imaginary part.