Inline Text Markup

In addition to standard stylization features, VNgen text actions support inline markup for modifying style and behavior in ways not possible externally. This markup is written directly in text strings and is interpreted by the engine in real-time, meaning you can even use VNgen markup in external word processing software before copying in your script.

With some exceptions, markup is typically written as tags in brackets with opening and closing pairs. However, using closing tags is optional, and omitting them will simply apply markup to the rest of the entire string.

In this section we will examine available markup tags and their individual behaviors in detail.

Speaker Names

Syntax

"Name||Text"

Description

Though not always necessary, the name of the current speaking character associated with the text can be declared with inline markup. This is done by writing the name of the character followed immediately by ||, after which text can be written as normal. Any text preceding || will be assigned as the speaking character and ignored when drawing the rest of the string onto the screen.

If the speaking character is declared both inline and as an argument, the inline declaration will take precedence.

Note that in order for speaker names to affect other engine features such as labels and character highlighting, the name declared here must match the name set in vngen_char_create exactly.

Escape

Syntax

^[

Description

By default, VNgen interprets all brackets as markup. However, there may be times when you wish to draw brackets literally. This is achieved using a combination of the secondary escape character, ^, and [.

Note that only opening brackets need to be escaped.

Newline

Syntax

\n

Description

While VNgen word-wraps text automatically, there may be times when you wish to manually trigger a line break prematurely. This is achieved using a combination of the primary escape character, \, and n for "newline".

Note that VNgen uses \n for manual line breaks in both GameMaker Studio 1 and 2, even though only GameMaker Studio 2 supports \n markup by default.

Font

Syntax

[font=my_font]custom text[/font]

Description

Draws the enclosed text with a custom font. This font must be previously created as a font resource in GameMaker Studio, and can be used for bold or italic variants of the same font, or different fonts entirely. That being said, it is recommended to use fonts of similar size when possible.

It is also possible to supply a variable in place of an actual font resource, which can assist in supporting multiple languages with different scripts, for example.

Color

Syntax

[color=#FFFFFF]colored text[/color]
[color=#FFF, #000]2-color gradient text[/color]
[color=#FFF, #FFF, #000]3-color gradient text[/color]
[color=#FFF, #FFF, #000, #000]4-color gradient text[/color]

Description

Draws the enclosed text with up to four colors specified in hex color notation and separated by commas. Hex color can be written in either three or six characters representing the red, green, and blue channels, respectively. Where multiple colors are specified, text will be drawn with a gradient: two colors providing a horizontal gradient, three colors providing a triangular gradient, and four colors providing a square gradient.

Shadow

Syntax

[shadow=#000]shaded text[/shadow]

Description

Draws the enclosed text with a shadow of the color specified in hex color notation. Hex color can be written in either three or six characters representing the red, green, and blue channels, respectively. Unlike regular text color, shadow color modifications do not support comma-separated gradients.

Outline

Syntax

[outline=#FFF]outlined text[/outline]

Description

Draws the enclosed text with an outline of the color specified in hex color notation. Hex color can be written in either three or six characters representing the red, green, and blue channels, respectively. Unlike regular text color, outline color modifications do not support comma-separated gradients.

Execute Event

Syntax

[event=ev_other, ev_user0]

Description

Executes the specified GameMaker Studio object event when reached by the typewriter effect. Two values must always be supplied here, separated by a comma, with the second value being 0 when no other value applies. Supports Create, Destroy, Step, Alarm, Draw, and Other Events (see documentation on GameMaker's event_perform function for a list of available events in these categories). User Events (a subset of Other) are recommended.

The desired Event must be set up in the running object in order for markup to take effect. In this way, event markup can be used to execute any code possible, but bear in mind that it will only be executed once when the text is drawn.

Link

Syntax

[link=ev_other, ev_user0]linked text[/link]

Description

Turns the enclosed text into a clickable hotspot which will execute the specified GameMaker Studio Event when selected. Two values must always be supplied here, separated by a comma, with the second value being 0 when no other value applies. Supports Create, Destroy, Step, Alarm, Draw, and Other Events (see documentation on GameMaker's event_perform function for a list of available events in these categories). User Events (a subset of Other) are recommended.

The desired Event must be set up in the running object in order for links to take effect. In this way, VNgen links can be used to execute any code possible, including acting as links to webpages with the url_open command built-in to GameMaker Studio.

It is recommended to combine link tags with other style tags to draw attention to them as clickable. Links will automatically highlight when hovered, however highlighting will not be visible on white text.

Speed

Syntax

[speed=0.5]slow text[/speed]
[speed=2]fast text[/speed]

Description

Multiplies the speed at which enclosed text is printed onto the screen. Unlike the default speed, which is written in characters per-second, speed tags use a multiplier to achieve the same effect at all text speeds.

Pause

Syntax

[pause=5]temporarily delayed text
[pause=-1]indefinitely delayed text

Description

Suspends the typewriter effect for the specified duration, in seconds. If -1 is supplied, the effect will be paused indefinitely until vngen_continue is run. Unlike other tags, pause markup has no corresponding closing tag.

important

If auto mode is enabled, negative pause values will be interpreted literally, not indefinitely. This allows crafting a fully automated experience that retains temporary pauses where appropriate. To change this behavior, see vngen_set_auto_type.