Print

From AGI Wiki
Revision as of 20:22, 17 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''print''' command displays a message in a window. == Syntax == print(msg mMSG);<br /> print("message text"); == Remarks == The text of message '''mMS...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The print command displays a message in a window.

Syntax

print(msg mMSG);
print("message text");

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. AGI will center the window on the screen, and if the message is more than 30 characters long, AI will automatically add line breaks.

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 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 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 in for details on available message codes.

Possible Errors

None.

Example

Code:

<syntaxhighlight lang="agi"> [ format code examples v50 = 99; print("%v50 bottles of beer on the wall"); [ will show on screen as "99 bottles of beer on the wall"

  1. message 3 " again."

print("You got killed%m3"); [ will show on screen as "You got killed again."

s1 = "20 years" print("You are %s1 old."); [ will show on screen as "You are 20 years old."

[ player enters "eat dirt" print("Why eat %w2?"); [ will show on screen as "Why eat dirt?" </syntaxhighlight>

Technical Information

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

See Also

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