messages.tfile | source file |
Classes Summary | Objects Summary | Functions Summary Details |
This module forms part of the adv3Lite library (c) 2012-13 Eric Eve, but is based substantially on the Mercury Library (c) 2012 Michael J. Roberts
CustomMessages
MessageCtx
MessageParams
VerbTense
dummy_
Future
FuturePerfect
messageDummyCommand
Narrator
Past
PastPerfect
Perfect
pluralDummy_
Present
bmsg
buildMessage
debugMessage
dmsg
message
bmsg (txt, [args]) | messages.t[799] |
buildMessage (id, txt, [args]) | messages.t[133] |
We put this in a separate function to make it easy to obtain the text of a message for subsequent use without first displaying it.
debugMessage (id, txt, cm, args) | messages.t[364] |
dmsg (txt, [args]) | messages.t[792] |
dmsg() displays the resultant message.
message (id, txt, [args]) | messages.t[114] |
This looks for a customized version of the message text, as defined in CustomMessages objects. If we don't find one, we use the provided default message text.
Substitution parameters take the form {x y z} - curly braces with one or more space-delimited tokens. The first token is the parameter name, and any additional tokens are arguments. The parameter names and their arguments are up to the language module to define.
In addition to the parameters, the string itself can have two sections, separated by a vertical bar, '|'. The first section (before the bar) is the "terse" string, which is for a straightforward acknowledgment of a simple, ordinary action: "Taken", "Dropped", etc. The terse string is used only if the Command argument's actor is the player character, AND the command doesn't have any disambiguated objects. If these conditions aren't met, the second half of the string, the "verbose" version, is used.
Once we have the message text, we perform parameter substitutions. Parameters can be provided as strings, which are substituted in literally; or as objects, whose names are inserted according to the grammar in the template text.