Skip to content

Game text (GXT)

import { gxt } from "@sagl/server";

The game's own text, by its GXT key, read from each player's copy of the game: objectives, help text and mission dialogue exactly as the game shows them, in each player's language, with their own key bindings.

Game text: an objective with the player's key, MISSION PASSED with a number, help text with its colours

gxt(key, options?)

gxt(key: string, options?: { table?: string; numbers?: number[] }): string

A marker for that text, which each player's game fills in. Use it anywhere text goes to a player's screen, on its own or inside other text: objectives, big text, subtitles, ped.say, draws, result screens, and server-opened UI documents.

Parameter Type Description
key string The GXT key, 1-7 letters, digits or _.
options.table string The mission table it's in (e.g. "RYDER2"); left out, the main table.
options.numbers number[] Fill the text's ~1~ placeholders, in order (up to 6).

Throws RangeError for a malformed key or table.

const R = { table: "RYDER2" };
m.objective(gxt("RY2_02", R));                      // "Drive down to the compound at Ocean Docks."
player.hud.bigText(gxt("M_PASS", { numbers: [5000] }));   // "MISSION PASSED! $5000"
player.subtitle(gxt("RYD2_AA", R));                 // Ryder's line
player.draw.text(`${gxt("RY2_21", R)}: 3/6`, 20, 120);    // "Boxes: 3/6"

What the game's text codes do:

Code
~r~ ~g~ ~b~ ~y~ ~p~ ~w~ ~s~ ~h~ ~n~ Colours and new lines, as everywhere.
~1~ ... The numbers.
~k~~ACTION~ The player's key for that action ("Press CAPSLOCK to ...").
~z~ Marks dialogue; dropped.

A key their game doesn't have shows as the key itself (and is logged in their client log).

Finding keys

Mission tables are named after their mission script (RYDER2 is Robbing Uncle Sam, CASINO9 ...), and keys follow each table's own pattern (RY2_02 objectives, RYD2_AA dialogue). Tools that read text/american.gxt list them.