Skip to content

Rich_Text_Tags

Jack Brett edited this page Jan 14, 2025 · 1 revision

Rich Text Tags

We have implemented a tag system similar to other narrative engines (most closely related to Twine) so you can change styling of text, add feedback to certain parts of text and more! You can also substitute variables using our markdown language, vary text and create simple conditional statements too.

Rich Text Tags Examples

  • {b} Bold Text {/b}
  • {i} Italic Text {/i}
  • {color=red} Color Text (color){/color}
  • {size=30} Text size {/size}
  • {s}, {s=60} Writing speed (chars per sec){/s}
  • {w}, {w=0.5} Wait (seconds)
  • {wi} Wait for input
  • {wc} Wait for input and clear
  • {wvo} Wait for voice over line to complete
  • {wp}, {wp=0.5} Wait on punctuation (seconds){/wp}
  • {c} Clear
  • {x} Exit, advance to the next command without waiting for input
  • {vpunch=10,0.5} Vertically punch screen (intensity,time)
  • {hpunch=10,0.5} Horizontally punch screen (intensity,time)
  • {punch=10,0.5} Punch screen (intensity,time)
  • {flash=0.5} Flash screen (duration)
  • {audio=AudioObjectName} Play Audio Once
  • {audioloop=AudioObjectName} Play Audio Loop
  • {audiopause=AudioObjectName} Pause Audio
  • {audiostop=AudioObjectName} Stop Audio
  • {m=MessageName} Broadcast message
  • {$VarName} Substitute variable

Examples:

This is a line of dialog.
{wc}
This is another line of dialog with some {punch=10,0.5} punch!.
This is another line of dialog with some {color=blue}blue{/b} text.

String Substitution

You can use the normal string subsitution syntax {$VarName} anywhere in Orders that make use of text. For example if you have a string variable called PlayerName you can embed this in a conversation like this:

Good morning {$PlayerName}!

Text Variation

Our text variation allows for simple changes to occur within the same block of text, instead of having to create multiple Orders. The Text Variation System is inspired by [Ink]'s Variable Text system. The Writer and Menu classes use this system, as such most Orders that make use of text will utilise it.

Handles replacing vary text segments. Keeps history of previous replacements to allow for ordered sequence of variation.

  • [] mark the bounds of the vary section
  • | divide elements within the variation

Default behaviour is to show one element after another and hold the final element. Such that [1|2|3] will show 1 the first time it is parsed, 2 the second and every subsequent time it will show 3.

Empty sections are allowed, such that [a||c], on second showing it will have 0 characters.

Supports nested sections, that are only evaluated if their parent element is chosen.

This behaviour can be modified with certain characters at the start of the [], e.g. [&a|b|c];

  • & does not hold the final element it wraps back around to the beginning in a looping fashion
  • ! does not hold the final element, it instead returns empty for the varying section
  • ~ chooses a random element every time it is encountered

Example Usage

In a simple case you may want to have a line read differently the first time the user encounters it. Perhaps a shop keeper, first time they say

Hail and well met, stranger. What can I help you with?

but when the same node is run again you want it to be more friendly

Welcome back, friend. What can I help you with?

Instead of creating diverging Nodes of Orders we could use text variation of.

[Hail and well met, stranger|Welcome back, friend]. What can I help you with?

Another common usage is for commonly repeated passages of text where players return for menus or story branching points. You may want there to be some variation so it feels more natural. Perhaps by varying the greeting used to be randomised, among;

  • Mornin.
  • G'day.
  • How's it hanging?
  • Oi oi.
  • How are we?
  • Let's do this.

We could do a variation of

[~Mornin.|G'day.|How's it hanging?|Oi oi.|How are we?|Let's do this.]

Conditions within Text

We can write simple conditions in the text using the following pattern:

  • [] the condition is contained within square braces.
  • The condition starts with if followed by the $variablename and consequent operator (in this case '=') finally followed by the value to compare against.
  • The ? operator is then used to delineate between what to do when the condition is true and false (where the true comes first and then the false which is separated by a : oeprator.

For example:

Hello, [if$var=1 ? <color=red>Welcome Newcomer, tell me your name...</color> : Welcome back {$PlayerName}!]

Clone this wiki locally