Print.at

From AGI Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The print.at command displays a message in a window at a specified location.

Syntax

print.at(msg mMSG, byt ROW, byt COL, byt MAXWIDTH);
print.at("message text", byt ROW, byt COL, byt MAXWIDTH);

Remarks

The text of message mMSG is displayed in a bordered window. The background color is always white, and the foreground color is always black.

The window is positioned with the upper left corner of text at row ROW, column COL. If zero is passed for MAXWIDTH, it defaults to 30.

The actual width of the message box is determined by AGI based on how it splits the message to fit over multiple lines. If the length of the text is <= MAXWIDTH - 1, the text will fit on one line and the actual width will be the total text length plus one. If the text is too long to fit on one line, AGI will automatically add line breaks, and the total width will be one more than the length of the longest line of text, up to MAXWIDTH. If there are no spaces and the text is longer than MAXWIDTH AGI will force a break and set the width to MAXWIDTH.

Reserved flag f15 (no pause windows) and reserved variable v21 (window close time) determine how the print command affects game play. The default condition is f15 reset to FALSE and v21==0; displayed windows (including those shown by the print.at command) pause the game, and remain until the player presses ENTER or ESC key. If f15 is FALSE but v21 is not zero, the window will also be dismissed after v21 * 0.5 seconds. If f15 is set to TRUE, the game is NOT paused, and the window remains open indefinitely (use the close.window command to dismiss the message).

After every time a window is displayed (including by using the print.at command) f15 is always reset to FALSE, and v21 is always set to 0.

Messages can contain special format codes to enhance the output. See the Message Format Codes topic for details on available message codes.

Possible Errors

When determining values for ROW, COL and MAXWIDTH, the programmer should ensure the window will fit on the screen. If the combination of ROW, COL and MAXWIDTH results in any part of the window falling outside the screen boundaries, the window borders and text will not display properly. Specifically:

- Do not use a MAXWIDTH value of 1 as this will crash AGI.
- If COL <= 1 the window will not draw correctly because there is not enough room to draw the left window border correctly;
- If COL plus the actual width is >= 39 the window will not draw correctly because there is not enough room to draw the right window border;
- If ROW plus the number of displayed lines > 23, the window will not draw correctly due to overlapping off the bottom edge of the screen;
- If any part of the window extends beyond the background picture image, it may not clear correctly. For example, using a value for ROW of 0 will erase part of the status line if the status line is also set to display on row 0.

Example

Code:
print.at("The snake eyes you warily.", 8, 18, 15);

Technical Information

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

See Also

Display Commands
Message Format Codes
print
print.v
print.at.v
display