Display

From AGI Wiki
Jump to: navigation, search

The display command displays text at a specified row and column.

Syntax

display(byt ROW, bytCOL, msg mMSG);
display(byt ROW, byt COL, "message text");

Remarks

This command takes a numbers as arguments. display.v also displays text, but all arguments are variables.

The text of message mMSG is displayed at row ROW and column COL, using the background and foreground colors set by the most recent set.text.attribute command. Note that unlike the print commands, the display command does not include a border around the message text.

The display command is mostly used on the text screen. Typical uses for the text screen are to display help screens, or passages of text from in game items such as books, letters, etc.

The display command will also display text messages on the graphics screen. Care must be taken in this case, because the text does not automatically clear. Also, if a screen object moves over the displayed text, the text will be erased pixel by pixel as the the object moves past. The programmer should take care to be sure the displayed text will not be accidentally erased by moving objects.

A typical use of the display command on the graphics screen is to add text to credit screens, or maybe to provide changing text on signs or such.

Possible Errors

If you pass a row value greater than 24, your text will not display at all. If you pass a column value greater than 39, the first character of the display message will be placed slightly below the desired ROW value, with a vertical offset in pixels equal to INT(COL/40), in a column equal to the COL value MOD 40, and the rest of the display message will be left aligned, one row below the desired ROW value.

Example

Code:
text.screen();             [ change to text screen so we can use all colors
set.text.attribute(3, 0);  [ cyan text on black background
display(6, 10, "Burma Shave");

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 103 (0x67 hex)

See Also

display.v
set.text.attribute