Text.screen

From AGI Wiki
Jump to navigationJump to search

The text.screen command switches the AGI display to text mode.

Syntax

text.screen();

Remarks

The text.screen command switches AGI to the text display mode. This mode displays text only; no graphics. The text screen uses separate memory, so the graphics screen is not lost when the text mode is active. When the text display is activated, it is cleared to a black background (if the background color is black [value of 0]), or white, if background color is any other value. (See the set.text.attribute command for a workaround to clear the text screen to other colors).

Use the graphics command to switch back to the graphics screen after you are done with text mode.

The text mode should only be used to display text on the screen, and not to use menus, show messages with the print commands, or attempt to manipulate graphics.

Technically, menus can be activated while in text mode, but they do not display properly. Similarly, the print commands will show messages on the text screen except they do not have a border, and do not clear the screen when the player presses a key.

It is possible to allow player input while the text mode is active. However, there are a couple of quirks:

  1. The input line will always default to the top line when the text mode is first activated. After the player enters some input, the input line will move back to its normal position (as defined in the configure.screen command).
    A workaround to this is to use the prevent.input command just before switching to text mode, then calling the accept.input command immediately afterward. This forces the input line to its correct position.
  2. When clearing areas on the text screen (via the clear.lines and clear.text.rect commands) the background color is ALWAYS set to black. The color argument for these commands is ignored in text mode.
    The clear.text.rect topic includes sample code that provides a workaround for this.

Possible Errors

None.

Example

Code:
prevent.input();  [ disable input prior to switch
text.screen();    [ switch to text mode
accept.input();   [ force input line back to proper position

Technical Information

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

See Also

Display Commands
AGI Text Screen
graphics
clear.text.rect