Message Row

From MZXWiki
Jump to navigation Jump to search

The Message Row is an incredibly simple yet powerful tool for displaying strings and values on the screen. Activating the message line only requires a single line of code, which must be repeated every cycle to keep the displayed data current. As of Megazeux 2.83, the message line can consist of 512 characters.

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

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

* "string"

CLEAR MESG

MESSAGE ROW #

SET MESG COLUMN #

CENTER MESG

DISABLE MESG EDGE

ENABLE MESG EDGE

Counters

The global counter BIMESG can be used to disable/enable built-in messages, such as the ones displayed when the player is hit by built-in bullets or switches bomb types.

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 row will also interpret the new line character, \n, and display any text that follows on the next row. The newline character can be used as many times as needed, as long as it doesn't extend past the bottom row of the screen.

You can also display 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')"

Message Row HUDs vs Overlay and Sprite HUDs

+ The message row is static to the viewport, as opposed to the Write/Copy Overlay commands

+ Unlike the message row, the overlay requires some clean-up if the board is allowed to scroll, or displays data that can be of varying length (like counter values).

- The robotic editor isn't designed to display ~ and @ color prefixes; As a result, scripting the message row to display graphical data can be cumbersome and error prone.

- Unlike the overlay and sprite layers, the background color of a message row will never change to what color is below it.