From AGI Wiki
Jump to: navigation, search

The set.string command assigns the text of a message to a string.


set.string(str sA, msg mB);
set.string(str sA, "message text");
sA = mB;
sA = "message text";


Strings are limited to 40 characters (including the null terminator). If the message text is longer than 40 characters, the string only uses the first 40. This is one of the few situations where AGI actually checks and prevents buffer overflow.

The number of strings available in AGI is 24 (s0 - s23), except for versions 2.089, 2.272 and 3.002.149, which have a limit of 12 (s0 - s11).

The very first string (s0) is reserved by AGI as the player input prompt.

Possible Errors

AGI does not check that sA is a valid string. If a value greater than the limit is used, AGI will write over areas of memory that contains game state data and the main program executable code. This will almost certainly crash AGI.


set.string(s5, "a sample message");
s5 = "another sample message";

Technical Information

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

See Also

String Commands