Message Row

From MZXWiki
Revision as of 20:38, 24 January 2011 by Old-Sckool (talk | contribs)
Jump to navigation Jump to search

The Message Line is an incredibly simple yet powerful tool for outputting strings and values on the screen. Displaying the message line only requires a single line of code. As of Megazeux 2.83, the message line can consist of 512 characters.

* "This line of text will be displayed on the Message Line!"

By default, the message line command causes the text to appear centered on the bottom row, while the forground color of the text is animated by cycling through various colors of the palette. Also, the message line will only be displayed for a short period, unless a new message is created. Lastly, built-in objects can also use the message line to display their own messages, which could potentially overwrite important information that we want to communicate to the player. Fortunately, we can adjust these defaults with a few commands and some special formatting.

Commands

set message row # Sets the row in which the message line appears in
set mesg column # Sets the column in which the message line appears in, and disables auto-centering
center mesg Enables auto-centering of the message row.

Counters

The global counter BIMESG can be used to disable/enable built-in messages

Special Formatting

You can also adjust the appearance of the text through the special prefixes ~ and @ followed by a hexadecimal digit for the color.

* "~FThis text is white on black. ~eThis text is yellow on black. @1This text is yellow on dark blue."

The message line will also interpret the new line character, \n, and display the text on the next line, as long as it doesn't extend past the bottom row of the screen.

You can also output values stored inside of counters, and even expressions, through counter interpolation.

set "$string" to "Five minus four equals "
set "num" to 4
* "~f&$string&(5-'num')"