Dialogs (MGS)
In MGS Natlang, dialogs are found within dialog blocks and related combination blocks.
dialog dialogName {
SELF "Dialogs go here!"
}
//or
script {
show dialog dialogName {
SELF "Dialogs go here!"
}
// or
show dialog {
SELF "Dialogs go here!"
}
}
Structure
- Dialog identifier: exactly 1
- Dialog parameter: 0+
- Dialog message: 1+
- Dialog option: 0-4x
Multiple dialogs can occur back-to-back inside their parent block.
Dialog Identifier
dialog sampleDialog {
SELF
alignment BOTTOM_RIGHT
emote 3
"Messages..."
"So many messages!"
"Don't you think?"
> "Not really." : goto script sampleScript1
> "Definitely." : goto script sampleScript2
}
The dialog identifier identifies the "speaker" of the dialog messages that immediately follow. For most cases, this will be a specific entity (with option #1 or #2 below), though you could also build up a dialog from its component pieces instead (with option #3).
The three options:
$bareword
- The bareword identifier refers to a dialog label within a dialog settings block.
- If no dialog label is found, this is assumed to be an entity name instead. This usage also provides the entity name as an
entity
parameter for the dialog. - Entity names with spaces or other special characters are not eligible for this usage.
- If no dialog label is found, this is assumed to be an entity name instead. This usage also provides the entity name as an
- REMINDER: A quoted string is NOT allowed here! This string must be a bareword!
- The bareword identifier refers to a dialog label within a dialog settings block.
entity $string
- String: an entity's given name (i.e. the entity's name within the Tiled map).
- This usage also provides the entity name as an
entity
parameter for the dialog. - The entities
%PLAYER%
and%SELF%
must use this pattern (and not the bareword pattern) because they contain special characters. As this can be cumbersome, it's probably best to set up a dialog settings label for them so you can use a bareword as an identifier instead.
name $string
Dialog Parameters
dialog sampleDialog {
SELF
alignment BOTTOM_RIGHT
emote 3
"Messages..."
"So many messages!"
"Don't you think?"
> "Not really." : goto script sampleScript1
> "Definitely." : goto script sampleScript2
}
Dialog parameters are a dialog property and value pair. Multiple dialog parameters can occur back-to-back in a single (show) dialog block or a dialog settings target block.
entity $string
- String: the "given name" of the entity (i.e. the entity's name on the Tiled map). (Wrapping this name in
%
s is unnecessary and will in fact confuse the encoder.) - A dialog can inherit a
name
and aportrait
if given anentity
parameter. - The inherited
name
is a relative reference; the dialog display name will be whatever that entity's name is at that moment.
- String: the "given name" of the entity (i.e. the entity's name on the Tiled map). (Wrapping this name in
name $string
- String: a fixed string of no more than 12 ASCII characters. For an entity's current name) instead, wrap a specific entity's given name in
%
s. - Overrides names inherited via the
entity
parameter. - If this string is empty (
name ""
), the dialog box label will be absent entirely. (Sometimes you want this!)
- String: a fixed string of no more than 12 ASCII characters. For an entity's current name) instead, wrap a specific entity's given name in
portrait $string
- String: the name of a MGE portrait.
- Overrides portraits inherited via the
entity
parameter.
alignment $string
- String: one of the following:
TR
(orTOP_RIGHT
)BR
(orBOTTOM_RIGHT
)TL
(orTOP_LEFT
)BL
(orBOTTOM_LEFT
) (default)
- String: one of the following:
border_tileset $string
- String: the name of a MGE tileset.
- The default tileset is used if none is provided.
emote $number
- Number: the id of the "emote" in that entity's entry in
portraits.json
. - The default emote (
0
) will display if not specified.
- Number: the id of the "emote" in that entity's entry in
wrap messages (to) $number
- Number: the number of chars to auto wrap the contents of dialog messages.
- 42 is default.
Dialog Messages
A dialog message is any quoted string.
dialog sampleDialog {
SELF
alignment BOTTOM_RIGHT
emote 3
"Messages..."
"So many messages!"
"Don't you think?"
> "Not really." : goto script sampleScript1
> "Definitely." : goto script sampleScript2
}
- Each message is a new "text screen" in the game.
- Only ASCII characters will be printed.
- Insert an entity's current name) by wrapping their given name in
%
s. - Insert the current value of a MGE variable by wrapping its name in
$
s.- Words wrapped in
$
s will count as 5 chars when the dialog message is auto-wrapped.
- Words wrapped in
- Some characters must be escaped in the message body, such as double quote (
\"
) (for messages wrapped in double quotes).\t
(tabs) are auto-converted to four spaces.\n
(new lines) are honored, but since text is wrapped automatically, don't worry about hard wrapping your messages unless you want to put line breaks in arbitrary places.%
and$
are printable characters unless used in pairs within a single line, in which case the only way to print them is to escape them (e.g.\%
).
- Word processor "smart" characters such as ellipses (…), em dashes (—), and smart quotes (“”) are auto converted to ASCII equivalents (
...
) (--
) ("
).
Dialog Options (MGS)
dialog sampleDialog {
SELF
alignment BOTTOM_RIGHT
emote 3
"Messages..."
"So many messages!"
"Don't you think?"
> "Not really." : goto script sampleScript1
> "Definitely." : goto script sampleScript2
}
Syntax:
> $label:quotedString : (goto) (script) $script:string
- You may have up to 4 dialog options per dialog.
- As each of these "branches" results in a script jump, no dialog messages afterward will be seen. Therefore, dialog options must come last within the dialog.
- The label is the text that will be shown to the player. As the cursor (approximated with
>
) takes up some room, assume you will only have 39 characters instead of the usual 42.- The label behaves like dialog messages in terms of inserting variables (with
$
or%
), escaped characters, etc. - Must be wrapped in quotes.
- The label behaves like dialog messages in terms of inserting variables (with
- In the MGE, dialog options are displayed underneath the final dialog message. Therefore, final dialog message (before any options) should consist of a single line of no more than 42 characters.
- The words
goto
andscript
are optional. Any string given after the:
(other thangoto
andscript
) is assumed to be the script name.