Print.at.v

From AGI Wiki
Revision as of 07:12, 18 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''print.at.v''' command indirectly displays a message in a window at a specified location. == Syntax == print.at.v(var vMSG, byt ROW, number|b...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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

Syntax

print.at.v(var vMSG, byt ROW, byt COL, byt MAXWIDTH);

Remarks

IMPORTANT NOTE: This '.v' command is different from others in that only the first argument is a variable. The other arguments are byte values. All the other '.v' commands require ALL arguments to be variables.

The text of the message referred to by variable vMSG 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.v 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.v 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:

<syntaxhighlight lang="agi">

  1. message 5 "The snake eyes you warily."

v50 = 5; print.at.v(v50, 8, 18, 15); [ prints message 5 at desired location </syntaxhighlight>

Technical Information

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

See Also

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