messages.tfile

source file

Classes
Summary
 

Objects
Summary
 

Functions
Summary
Details

*************************************************************************** messages.t

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

Summary of Classes  

CustomMessages MessageCtx MessageParams VerbTense

Summary of Global Objects  

dummy_ Future FuturePerfect messageDummyCommand Narrator Past PastPerfect Perfect pluralDummy_ Present

Summary of Global Functions  

bmsg buildMessage debugMessage dmsg message

Global Functions  

bmsg (txt, [args])

messages.t[799]

bmsg returns the text of a message formatted by the message formatter.

buildMessage (id, txt, [args])

messages.t[133]

Build a message to be shown by message()

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]

Message debugging. This shows the message before processing: the ID, the default source text with the {…} parameters, the overriding custom source text, and the arguments.

dmsg (txt, [args])

messages.t[792]

Use the message builder to format a message without supplying a key to look up at alternative message. We can use this with library messages that employ object properties (e.g. cannotTakeMsg) or user code.

dmsg() displays the resultant message.

message (id, txt, [args])

messages.t[114]

Show a message.

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.

Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1