About this manual
This manual explains the feature for inserting variable and database values into text in ACTION GAME MAKER. It also covers the feature for revealing the body text one character at a time.
You can open this page from the “Open Manual” button in the Inspector of each of these settings.
Overview
You can mix runtime values into a sentence, as in “HP: 100/200”.
All you write in the body text is this:
HP: <self.hp>/<self.max_hp>
The part wrapped in < > is replaced with the value while the game runs. If the value changes, the display follows.
There are three places you can use it.
| Place | What it is |
|---|---|
| The action “Display Text” (DisplayText) | Dialogue, damage readouts and so on |
| Label (ValueLabel) | Text you can place on a map layer / a UI layer / a menu |
| Rich Text (ValueRichTextLabel) | The above, plus colour, bold and images |
The codes you can use
This object’s own variables and switches
<self.hp> this object's own variable
<sw.self.is_invincible> this object's own switch
Variables are the default, and you put sw. in front only for switches. Switches display as ON / OFF.
Project variables and project switches
<project.Score>
<sw.project.Cleared>
Databases
<db.DatabaseName.RecordName.ColumnName>
Example: <db.Items.Potion.Price>
The shared board
<board.KeyName>
When the key is of the object-reference type, the root node name of that object is displayed.
Another object’s variables and switches
To point at another object you use an “alias” (explained in the next section).
<p.hp>
<sw.p.is_invincible>
Images (Rich Text only)
An image column from a database can be inserted into the middle of a sentence, like an emoji.
<img.db.Items.Potion.Icon> displayed at the same height as the text
<img.db.Items.Potion.Icon|24> displayed at 24 pixels
What an alias is
self and project work just by writing them, but other objects have no fixed name to call them by. The “alias” mechanism is there so you can give the target object whatever name you like. Think of it like a short URL.
An alias is not a node name and not a scene name — it is a name you decide yourself. Keeping it short, like p or e1, makes it easy to pick out inside the body text.
Add a row to “Text Bindings” in the Inspector and set these two:
- Alias … the name you write in the body text (for example
p) - Target Object Type …
SELECT_OBJECT(an object you specify) /SELF/LOCKED_OBJECT/PARENT/LAST_CONTACTED_OBJECT/BLACKBOARD_OBJECT
If you pick SELECT_OBJECT, specify the target scene in “Target Object Path”; if you pick BLACKBOARD_OBJECT, specify the key in “Blackboard Key”.
With that, you can write <p.hp> in the body text.
On Label and Rich Text, this setting is called “Bindings”. They also have no owning object, so the only choices are SELECT_OBJECT and BLACKBOARD_OBJECT. If you write something that cannot be resolved, a warning appears in the scene tree.
Note that self / project / db / board / sw / img are reserved words and cannot be used as aliases.
Tidying up how numbers look
You can specify a format after the |.
| Format | Meaning | Displayed as |
|---|---|---|
4 |
Show in 4 digits | 42 |
04 |
4 digits, zero-padded | 0042 |
, |
A comma every three digits | 1,234,567 |
.0 |
Do not show anything after the decimal point | 12 |
<self.hp|04>
When combining them, separate them with a space. , specifies three-digit grouping, so it cannot be used as the separator.
<project.Score|06 ,>
Decorating the text (Rich Text only)
Rich Text accepts BBCode, so you can write it straight into the body text.
HP: [color=#ffcc00][b]<self.hp>[/b][/color]
The format specifier can do the same thing.
| Format | Meaning |
|---|---|
b |
Bold |
i |
Italic |
u |
Underline |
s |
Strikethrough |
color=#ffcc00 |
Text colour |
<self.hp|04 b color=#ffcc00>
On an ordinary Label, decoration and images are ignored and only the value is displayed. Use Rich Text when you want colour.
When using it in “Display Text”, turn on “Rich Text”.
Revealing one character at a time
In “Display Text” you can have the body text appear one character at a time. Turn on “Reveal by Character”.
| Setting | What it is |
|---|---|
| Reveal Speed | How many characters appear per second |
| Reveal Effect | Nothing / Fade In / Rise Up / Rise And Fall |
| Reveal Effect Duration | How long the effect takes |
Effects can only be chosen with Rich Text, because Rich Text is the only one that can vary the look per character.
The text-advance sound
You can play a sound effect in step with the characters appearing.
| Setting | What it is |
|---|---|
| Reveal Sound ID | The sound to play |
| Reveal Sound Interval | Every how many characters it plays |
| Reveal Sound Min Interval | It does not play at intervals shorter than this |
| Reveal Sound Pitch Variation | How much to shift the pitch at random |
It does not play on spaces or line breaks. The same sound every time sounds mechanical, so a little pitch variation makes it more natural.
Skipping ahead
Turn on “Reveal Skip by Input” and a key press displays the whole body text at once.
“Reveal Skip Input Idx” defaults to Same As Quit Key. In that case the first input skips the reveal and the second input closes the display. You can also assign a different key.
Worked examples
Showing health on the HUD
Place a “Label” on a UI layer and write HP: <p.hp>/<p.max_hp> in the text. Add p to the bindings and point the target at the player’s scene, and it is done.
Lining up an item name and its icon
Place a “Rich Text” on a UI layer and write this:
<img.db.Items.Potion.Icon> <db.Items.Potion.Name> ×<self.held_count>
Making a message appear one character at a time
In “Display Text”, turn on “Rich Text” and “Reveal by Character”, set the effect to “Fade In” and set up the text-advance sound. Adding “Reveal Skip by Input” as well means you are not keeping anyone waiting once they have finished reading.
When it does not work
The literal text <p.hp> appears instead of the value
It is not being read as an insertion. Check that the name is in the bindings and that the variable name matches. A < > that could not be interpreted is displayed as plain text (by design, so that existing writing is not broken).
Nothing appears at all
The target object may not have been found. An insertion that cannot be resolved becomes an empty string.
Colour or images appear as text, or are ignored
Check that “Rich Text” has not been left off.
When you rename a variable
When changing the name of a variable or a database, use “Rename All” in the reference search. Insertions written in body text are rewritten along with everything else.