Members
present :Array
An array of [check_condition, staging, is_else, text_to_present] tuples
typically coming from the x-present-tag's in the HTML of a Location.
Type:
- Array
visited :int
Number of times main-character has visited a location
Type:
- int
Methods
evaluateCheckConditionStaging(condition, staging) → {Array}
Evaluates the condition in a ck or else-ck attribute of an x-present tag.
Parameters:
Name | Type | Description |
---|---|---|
condition |
string | contents from a ck, check, else-ck, or else-check attribute. Conditions can be boolean conditions on game variables. If an x-present tag did not have a ck attribute, condition is null. |
staging |
string | contents from a stage attribute. If no such attribute, this will be an empty string. Such an attribute could have a sequence of pause(some_millisecond); and clickProceed(some_string) commands |
Returns:
[check_result, proceed, pause] if the condition involved
a boolean expression, then check_result will hold the result of
the expression (so the caller then could prevent the the display of
an x-present tag if false), proceed is the link text (if any) for a
link for the first clickProceed (which is supposed to delay the
presentation of the x-present tag until after the user clicks the
link) if found (else ""), pause (if non zero) is the number of
milliseconds to sleep before presenting the x-present tag according to
the condition
- Type
- Array
prepareControls()
Prepares input, textareas, and select tags in the game so that they can
bind to game Object or Location fields by adding various Javascript
Event handlers. An input tag like
binds with the name field of the bob game object (i.e., obj(bob).name).
In the case above, as the default type of an input tag is text, this
would produce a text field whose initial value is the current value
obj(bob).name. If the user changes the field, the value of the obj
changes with it. This set up binds input tags regardless of type, so it
can be used with other types such as range, email, color, etc.
prepareSection(section) → {string}
A given Location contains one or more x-present tags which are
used when rendering that location to the game-content area. This
method takes the text from one such tag, interpolates any game
variables into it, and adds to any x-speaker tags in it the HTML
code to render that speaker bubble (adds img tag for speaker icon, etc).
Parameters:
Name | Type | Description |
---|---|---|
section |
string | text to process before putting into the game content area. |
Returns:
resulting HTML text after interpolation and processing
- Type
- string
(async) renderPresentation()
Used to display a description of a location to the game content
area. This description is based on the x-present tags that were
in the x-location tag from which the Location was parse. For
each such x-present tag in the order it was in the original HTML,
the ck/else-ck condition and staging is first evaluated
once/if the condition is satisfied, staging is processed (this may
contain a delay or a clickProceed call), then the HTML contents of the
tag are shown. In the case where the ck or else-ck evaluates to false
than the x-present tag's contents are omitted. In addition to the
usual HTML tags, an x-present tag can have x-speaker subtags. These
allow one to present text from a speaker in bubbles. An x-present tag
may also involve input tags to receive/update values for x-objects or
x-locations.