ExtraHintclass
FRAMEWORK FOR THE EXTRA HINTS MECHANISM
The ExtraHint class provides a framework for providing players (especially novice players) with extra hints, nudges, and tips during the course of play. When it is activated (either at player request, or because the player appears to be having trouble), a hint or tip can be displayed at the end of the turn in response to what the player has just typed, or some condition that has just become true, or which became true a certain number of turns ago.
It is also possible to define conditions (typically the achievement of some goal) that render a particular ExtraHint otiose, so that it is not displayed if it is no longer needed.
We simply need to define objects of the ExtraHint class to encapsulate the extra hints we want displayed.
A series of ExtraHints can be defined using a template if desired.
The first (optional) element in the template (e.g. ->doorAchievement) is the achievement we check to see if this ExtraHint has become redundant. For example, if the player has already taken the flyer, flyer.achievement has been achieved, and so we don’t need this first ExtraHint.
The second (optional) element in the template (e.g. +1) is the hintDelay; this is number of turns that should elapse between the openWhen condition (see below) becoming true and the hint being offered. This optionally allows the player a few turns to work on the solution before being offered a gratuitous hint.
The third element in the template is simply the text of the extra hint to display.
The openWhen property holds the condition that must be true before this ExtraHint is displayed. In the case of the first ExtraHint, the condition is that the player char has visited the location that contains the telephone pole.
class
ExtraHint
:
HintOpener
Superclass Tree (in declaration order)
ExtraHint
HintOpener
` object`
Subclass Tree
(none)
Global Objects
(none)
Summary of Properties
hintDelay
hintDone
hintText
location
openedWhen
priority
Inherited from HintOpener
:
closeWhen
closeWhenAchieved
closeWhenExamined
closeWhenKnown
closeWhenMoved
closeWhenRevealed
closeWhenSeen
closeWhenTrue
openWhen
openWhenAchieved
openWhenExamined
openWhenKnown
openWhenMoved
openWhenRevealed
openWhenSeen
openWhenTrue
Summary of Methods
checkClose
doHint
setDelay
showHint
Properties
hintDelay
The number of turns between openWhen becoming true and this hint being displayed.
hintDone
For internal use only: Flag; have we done with this hint (because we’ve displayed it)?
hintText
The text to display in relation to this ExtraHint
location
no description available
openedWhen
The turn on which this ExtraHint was first opened
priority
Our priority. When two ExtraHints become available on the same term, the one with the higher priority will be displayed.
Methods
checkClose ( )
The condition under which we close this ExtraHint. By default we close it if either hintDone becomes true or our closeWhen condition is true.
doHint ( )
If the closeWhen condition is true we remove this ExtraHint from the list of potentially active ExtraHints and return nil to tell the caller that this ExtraHint was not displayed. Otherwise we check if this ExtraHint (a) meets its openWhen conditions to be displayed and (b) is due to be displayed because hintDelay turns have passed since it was open. If both conditions are met we show our text and return true to tell our caller that an ExtraHint has been displayed (important since we display at most one ExtraHint per turn). Otherwise we return nil.
setDelay (val)
Set the number of turns that must elapse before we display this hint
showHint ( )
Show the text related to this ExtraHint
Adv3Lite Library Reference Manual
Generated on 15/03/2023 from adv3Lite version 1.6.1