API Reference
Every script command and property available in GoNorth scripts.
In the tables below, Type shows what the expression returns when read. R = readable, W = writable (can be assigned to). Commands marked Action perform an operation and return nothing.
Player
| Command | Type | R/W | Description |
|---|---|---|---|
Player.Name | String | R/W | The player's name (set via Game.Ask() or directly) |
Player.Score | Number | R/W | Shorthand for Player.Score("default"). Read or write a simple score value without named keys. Supports Player.Score += 10, Player.Score = 50, etc. |
Player.Score("key") = value | — | W | Set the score entry named key to value. Awarding points twice for the same key simply replaces the value — it never double-counts. Keys are case-insensitive. |
Player.Score("key") | Number | R | Read the current value for key. Returns 0 if not yet set. |
Player.Score.Total | Number | R | Sum of all named score entries (including "default") — the player's current total score. |
Player.Score.Reset | Action | — | Clear all named score entries (resets Player.Score.Total to 0). |
Player.LocationId | Number | R/W | Current location ID. Setting this teleports the player. |
Player.TurnCount | Number | R | Number of turns elapsed since game start |
Player.ItemCount | Number | R | Number of items being carried |
Player.CarryWeight | Number | R | Total weight of all carried items |
Player.CarrySize | Number | R | Total size of all carried items |
Player.CarriedItemsText | String | R | The carried items as a spoken list (“a key, a lamp and three coins”); empty if none |
Player.HasItem(id|"name") | Boolean | R | True if player is carrying this item |
Player.HasAll("item1", "item2", ...) | Boolean | R | True if player is carrying every listed item. Accepts any number of item names or IDs. |
Player.HasAny("item1", "item2", ...) | Boolean | R | True if player is carrying at least one of the listed items. Accepts any number of item names or IDs. |
Player.HasVisited(locationId) | Boolean | R | True if player has been to this location |
Player.Variable("name") | Any | R/W | Read or write a player variable. Can use unquoted name: Player.Variable(HitPoints) |
Player.GiveItem(id|"name") | Action | — | Add item to player's inventory |
Player.GiveItem("name", n) | Action | — | Give the player n copies of an item: loose copies of that name are used first, then new copies are made |
Player.Count("name") | Number | R | How many interchangeable copies of that item the player is carrying |
Player.TakeItem(id|"name") | Action | — | Remove item from player's inventory (item disappears) |
Player.DropItem(id|"name") | Action | — | Move item from inventory to current location |
Player.TakeAll() | Action | Number | Pick up every visible, pickable item here (incl. contents of open containers). Silent: does not run item OnPickUp scripts and prints nothing. Returns how many were taken |
Player.DropAll() | Action | Number | Drop everything the player carries into the current location. Silent: does not run item OnDrop scripts and prints nothing. Returns how many were dropped |
Player.Move(locationId) | Action | — | Move the player like a normal exit: Location OnExit / Global OnLocationExit, the new room's description and OnEnter, NPC enter triggers. Runs when the current script finishes. |
Player.GoTo(locationId) | Action | — | Silent teleport (alias for setting LocationId): no exit/enter scripts, no description. Use when you want to place the player without any narration. |
Examples
# Simple scoring — Player.Score is shorthand for Player.Score("default")
# Use it when you don't need named categories
Player.Score += 10
OutputText("You found treasure! Score: " AND Player.Score)
# Award points for finding a chest — running it again changes nothing
# (OnUse script on the chest item)
Player.Score("chest") = 10
OutputText("You find a handful of coins. +10 points!")
# Larger reward for defeating the dragon
Player.Score("dragon") = 50
OutputText("The dragon falls. +50 points!")
# Show current total
OutputText("Your score is now " AND Player.Score.Total AND " points.")
# Check whether a particular award was already given
if Player.Score("dragon") > 0 then
OutputText("You slew the dragon!")
endif
# Rank the player at game end (OnGameEnd event)
let grade = "Novice"
if Player.Score.Total > 49 then grade = "Explorer" endif
if Player.Score.Total > 99 then grade = "Adventurer" endif
if Player.Score.Total > 199 then grade = "Hero" endif
OutputText("Final score: " AND Player.Score.Total AND " — Rank: " AND grade)
# Player variables and inventory
Player.Variable(HitPoints) -= 5
if Player.HasItem("lantern") then
OutputText("The lantern lights your way.")
endif
# Ask for player's name at game start (OnGameStart event)
Player.Name = Game.Ask("What is your name, adventurer?")
OutputText("Welcome, " AND Player.Name AND "!")
Awarding points with
Player.Score("chest") = 10 records that the chest has already
contributed 10 points. Running the same line again simply keeps it at 10 — the total never
grows no matter how many times the player repeats the action. This removes the need for a
"has the player done this yet?" guard variable.
Location
With no arguments, refers to the current location. Use Location(id) or Location("name") for a specific one.
| Command | Type | R/W | Description |
|---|---|---|---|
Location.Describe() | Action | — | Output the location's long description (VisitCount <= 1) or short description (otherwise) — the same VisitCount-based logic as the standard entry convention, so a scripted LongDescription change correctly re-triggers the long text here too |
Location.DescribeExits() | Action | — | Output the current location's enabled exits by direction name, one per line, no prefix. Same as DescribeExits("", false). |
Location.DescribeExits("prefix") | Action | — | Output prefix as its own line, then each enabled exit's direction name on its own line. No output at all if there are no enabled exits. |
Location.DescribeExits("prefix", true) | Action | — | Output one line: prefix followed by the exit directions joined with commas, e.g. "You can go: north, south, east" |
Location.DescribeExits("prefix", true, "and") | Action | — | Same as above, but the last comma is replaced with the given word, e.g. "You can go: north, south and east". See Grammar. |
Location.DescribeNPCs("prefix") | Action | — | Output prefix as its own line, then the name of each NPC visible at the current location (enabled + visible; dead NPCs are included — a corpse can be in the room) each on its own line. No output at all if none are present. |
Location.DescribeNPCs("prefix", true) | Action | — | Output one line: prefix followed by the NPC names joined with commas, e.g. "You can talk to: Tom, Dick, Harry" |
Location.DescribeNPCs("prefix", true, "and") | Action | — | Same as above, but the last comma is replaced with the given word, e.g. "You can talk to: Tom, Dick and Harry" |
Location.DescribeItems("prefix") | Action | — | Output prefix as its own line, then each visible item's short description at the current location, each on its own line. No output at all if none are present. |
Location.DescribeItems("prefix", true) | Action | — | Output one line: prefix followed by the item descriptions joined with commas, e.g. "You can see: a brass compass, a torn map" |
Location.DescribeItems("prefix", true, "and") | Action | — | Same as above, but the last comma is replaced with the given word |
Location.Id | Number | R | ID of the current location |
Location.Name | String | R | Name of the current location |
Location.LongDescription | String | R/W | Override the long description at runtime Alias: .Description, .Desc, .LongDesc |
Location.ShortDescription | String | R/W | Override the short description at runtime Alias: .Short, .ShortDesc |
Location.VisitCount | Number | R/W | How many times the player has entered this location since its LongDescription last changed. 1 = first visit, or first visit since a scripted description change. Resets to 0 automatically when LongDescription's effective text changes (not on ShortDescription changes) — so the standard "if VisitCount = 1" convention shows the long description again automatically after a scripted change, with no adventure edits needed. |
Location.VisitAbsolute | Number | R | The true, permanent count of every visit to this location. Unlike VisitCount, never reset by a description change. |
Location.PreviousID | Number | R | Id of the location the player was in before the current one (0 if none yet). Set by the engine on every move. Pass it to Player.Move() to send the player back, e.g. a flee/retreat. Also readable as Player.PreviousLocationId. |
Location.ItemCount | Number | R | Number of items in the current location |
Location.VisibleItemCount | Number | R | Number of visible items in the current location (excludes items where IsVisible = false) |
Location.VisibleNPCCount | Number | R | Number of NPCs the player can see here (enabled and visible) |
Location.Script("OnEvent").Exists | Boolean | R | True if the location has a script stored in that event slot. Also Item("x").Script("OnEvent").Exists and NPC("x").Script("OnEvent").Exists. See Scripting. |
Location.Visited | Boolean | R | Has the player been here before |
Location.Variable("name") | Any | R/W | Read or write a variable on the current location |
Location(id).Variable("name") | Any | R/W | Variable on a specific location |
Location.HasItem(id|"name") | Boolean | R | Is this item present in the current location (not carried) |
Location.AddItem(id|"name") | Action | — | Place an item in the current location |
Location.RemoveItem(id|"name") | Action | — | Remove an item from the current location |
Location.HasNPC(id|"name") | Boolean | R | Is this NPC in the current location |
Location.HasExit("direction") | Boolean | R | Is this exit currently accessible |
Location.ExitEnabled("dir", bool) | Action | — | Open or close an exit dynamically. true = open, false = blocked. |
Location.FurnitureCount | Number | R | Number of furniture items defined on the current location |
Location.Furniture("name").Exists | Boolean | R | Does a furniture item matching this name or alias exist |
Location.Furniture("name").Name | String | R | Primary name of the matched furniture item |
Location.Furniture("name").Description | String | R/W | Get or update the examine text of a furniture item at runtime |
Location.Furniture("name").Alias | String | R/W | Get or set aliases (comma-separated string) for a furniture item at runtime |
Location.AddFurniture("name", "desc") | Action | — | Create (or update) a furniture item on the current location. Optional 3rd arg: comma-separated aliases. |
Location.AddFurniture("name", "desc", "aliases") | Action | — | Create furniture with aliases. Existing item with same name is updated, not duplicated. |
Location.RemoveFurniture("name") | Action | — | Remove a furniture item from the current location |
Location.ExitsCount | Number | R | Count of currently enabled exits from the current location |
Location.NPCCount | Number | R | Count of currently enabled NPCs at the current location |
Location(id).Furniture("name").Description | String | R/W | Access furniture on a specific location by ID |
Item
Replace "name" with the item's primary name, any of its aliases, or its numeric ID.
Aliases are set in the Item Editor's Aliases field (comma-separated, e.g. earth, dirt)
and let players refer to an item by multiple names — Item("earth") and Item("soil")
resolve to the same item if earth is listed as an alias.
| Command | Type | R/W | Description |
|---|---|---|---|
Item("x").Name | String | R | Item's primary name |
Item("x").Description | String | R/W | Item's full description Alias: .Desc, .LongDesc, .LongDescription |
Item("x").ShortDescription | String | R/W | Item's short description — the label used in room listings and in standard messages ("You take the …"). If none is set it is the item's name, e.g. coin. Assigning overrides it at runtime; the authored text is used again if you assign ""Alias: .Short, .ShortDesc |
Item("x").IsWearable | Boolean | R/W | Whether the item can be worn (WEAR / REMOVE) |
Item("x").IsWorn | Boolean | R/W | Whether the player is currently wearing it. Only true while the item is carried |
Item("x").DisplayName | String | R/W | The name the player sees (inventory, messages) and types in commands, together with aliases. Empty = use Name. Name remains the fixed key for scripts. Example: Item("Form 14C").DisplayName = "Form 14C (completed)". Restored by UNDO. |
Item("x").Describe() | Action | — | Output the item's long description the first time it is called, and the short description every time after — the Item equivalent of Location.Describe(). If the item has no long description, the short description is used from the start. Sets Interacted to true. |
Item("x").Interacted | Boolean | R/W | False until Item("x").Describe() has run once. Setting a new long description from a script (Item("x").Desc = "...") resets it to false; assigning identical text does not. Settable: Item("x").Interacted = false. |
Item("x").Weight | Number | R | Item's weight |
Item("x").Size | Number | R | Item's size |
Item("x").LastSeenLocation | String | R | Name of the location where the player last saw or carried this item (empty if never seen) |
Item("x").LastSeenLocationId | Number | R/W | Id of that location; -1 if never seen |
Item("x").LastSeenTurn | Number | R/W | The turn the player last saw or carried this item |
Item("x").HasBeenSeen | Boolean | R | True once the player has seen or carried this item |
Input.NounItem.IsHere | Boolean | R | False when the command named an item that is somewhere else (inside an item's OnAbsent script) |
Item("x").IsPickable | Boolean | R/W | Whether the player can pick this item up |
Item("x").IsVisible | Boolean | R/W | Whether the item is visible to the player (hidden items can't be picked up or examined) |
Item("x").IsOpen | Boolean | R/W | For container items — whether the container is currently open |
Item("x").ContentsVisible | Boolean | R | True if this is an open container (read-only shorthand for IsOpen) |
Item("x").Exists | Boolean | R | True if player is carrying this item |
Item("x").IsCarried | Boolean | R | Alias for .Exists |
Item("x").IsInLocation | Boolean | R | Is item in the current location (not carried) |
Item("x").Variable("name") | Any | R/W | Read or write an item variable |
Item("x").Give(Player|"npc") | Action | — | Transfer item to player or named NPC |
Item("x").Drop() | Action | — | Move item to current location floor |
Item("x").MoveTo(locationId) | Action | — | Teleport item to a specific location |
Item("x").Destroy() | Action | — | Remove item from the game entirely |
Item.Duplicate("name") | Action | — | Deep-copy an item with a new ID, placed in the same location |
Item.Create(name, shortDesc, longDesc, isPickable) | String | — | Create a brand-new item and add it to the adventure. Returns the item's actual name (auto-disambiguated with " (2)", " (3)", ... on a name collision — capture it with let). The new item is not placed anywhere yet; place it with Location.AddItem, Player.GiveItem, or NPC("x").GiveItem before the script ends. |
Item("x").Variable("name") | Any | R/W | Read or write an item variable. Supports unquoted name: Item("x").Variable(Fuel) |
Item("x").Contents.HasItem("y") | Boolean | R | Does container x hold item y |
Item("x").Contents.AddItem("y") | Action | — | Put item y inside container x |
Item("x").Contents.RemoveItem("y") | Action | — | Take item y out of container x |
Item("x").Contents.Count | Number | R | How many items are inside container x |
NPC
| Command | Type | R/W | Description |
|---|---|---|---|
NPC("x").Name | String | R/W | NPC's name |
NPC("x").ShortDescription | String | R/W | Short description (e.g. shown after death) Alias: .ShortDesc, .Short |
NPC("x").Description | String | R/W | Long description, also what EXAMINE shows Alias: .Desc, .LongDesc, .LongDescription |
NPC("x").DisplayName | String | R/W | The name the player sees (speaker label, messages) and types in commands, together with aliases. Empty = use Name. Name remains the fixed key for scripts and voice packs. Changing it at runtime is restored by UNDO. |
NPC("x").Describe() | Action | — | Output the NPC's long description (Description / a scripted .Desc change) the first time it is called, and the short description every time after — the NPC/Item equivalent of Location.Describe(). If the NPC has no long description, the short description is used from the start. Sets Interacted to true. |
NPC("x").Interacted | Boolean | R/W | False until NPC("x").Describe() has run once. Setting a new long description from a script (NPC("x").Desc = "...") resets it to false so the new text is shown once; assigning identical text does not. You can also set it yourself: NPC("x").Interacted = false to replay the first-meeting text. |
NPC("x").IsEnabled | Boolean | R/W | Whether the NPC is active and visible to the player. Set false to hide.Alias: .Enabled |
NPC("x").IsAlive | Boolean | R/W | Alive/dead state |
NPC("x").IsHere | Boolean | R | Is this NPC in the current location |
NPC("x").Whereabouts | String | R/W | Where the player believes this NPC went. Used when the player names them while they're away. |
NPC("x").LastSeenLocation | String | R | Name of the location where the player last saw this NPC (tracked automatically; empty if never seen) |
NPC("x").LastSeenLocationId | Number | R/W | Id of that location; -1 if never seen |
NPC("x").LastSeenTurn | Number | R/W | The turn the player last saw this NPC |
NPC("x").HasBeenMet | Boolean | R | True once the player has seen this NPC |
Input.TargetNPC.IsHere | Boolean | R | False when the command named an NPC who is somewhere else (inside an OnAbsent script) |
NPC("x").LocationId | Number | R/W | Which location the NPC is in |
NPC.Create(name, shortDesc, longDesc, locationId) | String | — | Create a brand-new NPC at the given location. Returns the NPC's actual name (auto-disambiguated with " (2)", " (3)", ... on a name collision — capture it with let). |
NPC("x").Destroy() | Action | — | Remove NPC from the game entirely |
NPC("x").HasItem("name") | Boolean | R | Does NPC carry this item |
NPC("x").Variable("name") | Any | R/W | Read or write an NPC variable. Supports unquoted name: NPC("x").Variable(Damage) |
NPC("x").Say("text") | Action | — | Output dialogue attributed to this NPC — typically displayed as "Name: text" |
NPC("x").Move(id,...) | Action | — | Move NPC to a location. Pass multiple location IDs to pick one at random each time. Fires OnLeave then OnEnter and outputs LeaveMessage/EnterMessage if set, exactly like automated movement. |
NPC("x").GiveItem("name") | Action | — | Give an item to this NPC (adds to their inventory) |
NPC("x").TakeItem("name") | Action | — | Remove an item from this NPC's inventory (item disappears) |
NPC("x").ItemDrop("name") | Action | — | Move item from NPC's inventory to the current location floor |
NPC("x").FollowPlayer(true|false) | Action | — | When true, the NPC automatically moves to match the player's location each turn |
NPC("x").Locations | String | R/W | Get or set the NPC's permitted movement locations as a comma-separated string of location IDs, e.g. "14,21,18". Setting this replaces the entire list and resets directional momentum. Setting it to "" stops the NPC moving. |
NPC("x").AddLocation(id) | Action | — | Add one location ID to the NPC's permitted movement list |
NPC("x").RemoveLocation(id) | Action | — | Remove one location ID from the NPC's permitted movement list |
NPC("x").ClearLocations | Action | — | Remove all permitted locations and reset directional momentum — the NPC stops moving on the next turn |
NPC("x").MovementMode | Number/String | R/W | Get (returns the ordinal 0-5) or set the movement mode. Accepts either an ordinal (0=Stationary, 1=RandomFromList, 2=Wander, 3=Scripted, 4=WeightedRandom, 5=PatrolRoute) or a mode name string, e.g. NPC("x").MovementMode = "PatrolRoute". Resets patrol position to the start of the route. |
NPC("x").LeaveMessage | String | R/W | Departure announcement template, output whenever this NPC's location changes. Placeholders: {NpcName}, {LocationName}, {DirectionName}. Empty string = silent (the OnLeave event still fires). |
NPC("x").EnterMessage | String | R/W | Arrival announcement template, same placeholders as LeaveMessage. Empty string = silent (the OnEnter event still fires). |
NPC Movement
Every NPC has a Movement Mode set in its properties panel (Movement tab), or
scriptable directly via NPC("x").MovementMode. There are six modes:
| Mode | Behaviour |
|---|---|
| Stationary | The NPC never moves on its own. You can still move it manually with NPC("x").Move(id) or NPC("x").LocationId = id in a script. |
| Random From List | Each turn the NPC picks a neighbouring exit that leads to one of its permitted locations and moves through it, using weighted selection to give realistic directional momentum (see below). |
| Wander | Each turn the NPC picks any enabled exit at random and wanders freely — no permitted-location restriction. |
| Weighted Random | Each turn the NPC jumps directly to a location chosen from its Location Weights (no adjacency check — this is a teleport, not a walk). Weight 1-10 per location, 0 = forbidden, unlisted locations default to weight 1. |
| Patrol Route | Each turn the NPC jumps directly to the next waypoint in its ordered Patrol Route, cycling back to the start when it reaches the end. Also a teleport, not a walk — list waypoints in a sensible order. |
| Scripted | The NPC's Movement Script runs every turn and decides movement entirely in code — maximum flexibility. |
A dead NPC (IsAlive = false) or a frozen one (IsStatic = true) never
moves automatically under any mode — this is checked before every mode's dispatch, so setting
either flag is a reliable way to stop movement regardless of the configured mode. Their
OnTurn script still runs, only movement is suppressed.
How Random From List movement works: the engine looks at the exits available from the NPC's current location and keeps only those that lead to a permitted location. It then assigns weights based on which direction the NPC last came from:
| Exit relationship | Weight | Effect |
|---|---|---|
| Continuing the same direction | 40 | Very likely — NPCs tend to keep going |
| Perpendicular turn | 20 | Occasional — a natural turn |
| Diagonal | 10 | Less common |
| Reversing (back the way they came) | 5 | Rare — avoids obvious ping-pong |
| No prior direction (first move, or after a custom exit) | Equal | All exits equally likely |
This directional memory is session-only — it is not saved with the game and resets when the game starts or when the NPC's location list is changed via script. Custom-named exits (e.g. Trapdoor, Portal) have no natural inverse direction, so taking one resets the memory and the next move is equal-weight.
The permitted-location list is set in the NPC's Properties panel in the Designer, or changed at runtime with the script commands above. If no permitted exit is available (e.g. all exits are closed or disabled), the NPC simply stays put that turn.
Departure & Arrival Announcements
Whenever an NPC's location actually changes — under any movement mode, or an explicit script
NPC("x").Move(id) — the engine outputs LeaveMessage (if non-empty)
and fires the OnLeave event, then outputs EnterMessage (if non-empty)
and fires the OnEnter event. Both default to a simple template
("{NpcName} leaves." / "{NpcName} enters.") — clear the field in the
Designer's Movement tab (or set it to "" via script) for silence; the event still
fires either way, so a script can output custom text itself.
OnEnter runs before the player's next input, so it's the right place for an
ambush or similar immediate reaction. Note the message for a move is output before
OnEnter runs, so set a custom EnterMessage once (in the Designer, or
right before calling Move()) rather than inside OnEnter itself —
OnEnter is for reacting to the arrival, not narrating it:
# NPC "Gollum", MovementMode = Scripted — OnTurn or MovementScript:
if not Player.HasItem("ring of power") and not NPC("Gollum").IsHere then
NPC("Gollum").EnterMessage = "An angry Gollum enters!"
NPC("Gollum").Move(Location.Id("Cave"))
endif
# NPC "Gollum" — OnEnter script (fires immediately after the move above):
if NPC("Gollum").IsHere then
NPC("Gollum").Say("We hatesss it!")
# ...attack logic here
endif
Image
| Command | Description |
|---|---|
Image.Show("alias") | Display the image registered under alias in the Media Manager. Alias: ShowImage("alias") |
Image.Show("alias", "color") | Display the image with a coloured border/background. color can be any X11/W3C named colour (e.g. "red", "darkslateblue") or "transparent". Bare-word form also accepted: Image.Show("scene", green). Available colours → |
Image.Hide() | Dismiss the current image. Alias: HideImage() |
In the Designer play panel, clicking the image opens it full-screen. It auto-closes after 5 seconds or when you click / press a key.
Global (Alias: Game)
Game is an alias for Global. All examples use Global.
| Command | Type | R/W | Description |
|---|---|---|---|
Global.Variable("name") | Any | R/W | Read or write a global variable Alias: Game.Variable() |
Global.Ask("question") | String | R | Prompt the player for input. Once they answer, the script runs again from its first line with the answer filled in, so put output and score changes below the last question (Verify warns about this). Use in OnGameStart.Alias: Game.Ask() |
Game.NoTurn() | — | — | Make the current command free: no turn passes, so daemons, timers and NPC movement don't tick and the turn counter doesn't advance. Use in a custom meta command such as status. See Free commands.Alias: Global.NoTurn() |
OutputText("text") | Action | — | Output a line of text to the player Alias: Output.Text("text") |
Respond("outcome") / Respond("action", "outcome") | — | Print the engine's default reply for an action outcome (language-file text, with placeholders filled). See Respond — default replies for every action and outcome. | |
DefaultPickUp() | Action | — | In an item's OnPickUp. Puts the item in the inventory and prints the standard message. A scripted OnPickUp does nothing until it calls this — leave it out to refuse. DefaultPickUp("quiet") moves without the message |
DefaultDrop() | Action | — | In OnDrop. Puts the item on the floor of the current location and prints the standard message. "quiet" skips the message |
DefaultWear() | Action | — | In OnWear. Marks the item as worn and prints the standard message. "quiet" skips the message |
DefaultRemove() | Action | — | In OnRemove. Takes the item off (it stays in the inventory) and prints the standard message. "quiet" skips the message |
DefaultPutIn() | Action | — | In a container's OnPutIn. Puts Input.NounItem inside the container and prints the standard message. "quiet" skips the message |
DefaultGive() | Action | — | In an NPC's OnGive. Hands Input.NounItem to the NPC and prints the standard message. "quiet" skips the message |
InputText("text") | Boolean | R | True if the player's input contains this text |
GameOver("message") | Action | — | End the game with a message |
Match.Group("name") | String | R | Get a captured group from the current pattern match |
Match.HasGroup("name") | Boolean | R | True if the named group was captured |
Match examples
Match.Group lets scripts read the words a player typed that matched
a pattern placeholder. For example, a pattern paint - VERB=[paint|colour] NOUN={word}
gives you Match.Group("NOUN") to find out what the player wanted to paint.
# Pattern: ask - ASK=[ask|question] NOUN={word}
if Match.HasGroup("NOUN") then
OutputText("You ask about " AND Match.Group("NOUN") AND ".")
else
OutputText("Ask about what?")
endif
Built-in Functions
| Function | Returns | Description |
|---|---|---|
OutputText("text") | — | Output a line of text to the player. Empty string outputs a blank line. |
InputText("text") | Boolean | True if the player's raw input contains the given text (case-insensitive). Useful in outcome scripts and global handlers. |
random(a, b, c, ...) | Any | Return one of the supplied values at random |
Randomise(n) | Number | Return a random integer from 1 to n inclusive. e.g. Randomise(6) returns 1, 2, 3, 4, 5 or 6. Also spelled Randomize(n). |
chance(percent) | Boolean | True N% of the time, e.g. chance(30) = 30% chance |
DiceRoll(notation) | Number | Roll dice using standard tabletop notation — NdM, optionally followed by +K or -K, d/D case-insensitive, N optional (defaults to 1). Multiple terms can be chained with +/- for compound rolls. Returns the summed integer result. e.g. DiceRoll("2D6") (2-12), DiceRoll("1D6-1") (0-5), DiceRoll("2D6+1D4+3") (compound). |
min(a, b) | Number | Smaller of two numbers |
max(a, b) | Number | Larger of two numbers |
abs(x) | Number | Absolute value (removes negative sign) |
round(x) | Number | Round to nearest whole number |
round(x, dp) | Number | Round to dp decimal places |
floor(x) | Number | Round down |
ceil(x) | Number | Round up |
clamp(x, lo, hi) | Number | Keep a value between lo and hi |
sqrt(x) | Number | Square root |
upper(s) | String | Convert to uppercase |
lower(s) | String | Convert to lowercase |
proper(s) | String | Sentence case — capitalise first letter and first letter after each . |
length(s) | Number | Number of characters in string |
trim(s) | String | Remove leading/trailing spaces |
contains(s, sub) | Boolean | True if s contains sub |
startswith(s, prefix) | Boolean | True if s starts with prefix |
endswith(s, suffix) | Boolean | True if s ends with suffix |
replace(s, old, new) | String | Replace all occurrences of old with new |
substring(s, start, len) | String | Extract part of a string |
str(x) | String | Convert number or boolean to string |
num(x) | Number | Convert string to number |
int(x) | Number | Convert to whole number (truncates) |
Respond — default replies
Every built-in action (take, drop, open, examine…) has named outcomes
(succeed, failed, already, cant…). Each outcome has a
reply line in the adventure's language file (responses.patterns) that you can override per
adventure in the Commands window. Respond prints that reply from a script, so you never have to
hard-code the English yourself:
| Call | Prints |
|---|---|
Respond("outcome") | The reply for that outcome of the current action, e.g. Respond("failed") in a take override. |
Respond("action", "outcome") | The reply for any action, e.g. Respond("get", "cant"). |
Placeholders such as [NOUN], [MATCHES:list] and [ARG:name] are filled in from
the current turn. In the Script Editor click the Respond palette button to pick an
action and outcome from a list, or start typing Respond for autocomplete.
Respond("succeed") shows the standard message and
changes nothing in the game. To actually pick up, drop, wear, remove, put in or hand over an item
from a script, use DefaultPickUp(), DefaultDrop(), DefaultWear(),
DefaultRemove(), DefaultPutIn() or DefaultGive() — see
Scripted events: the script is in charge.
Respond is for the other cases — a script that already did the work and wants the
standard wording, or an override that refuses with the standard "can't" message:
# Item OnOpen — open it yourself, then say the standard line
Item("chest").IsOpen = true
Respond("open", "succeed")
All actions and outcomes
| Action | Outcome | Meaning |
|---|---|---|
get | succeed | Item picked up (by the standard pick-up, or by the item's OnPickUp script calling DefaultPickUp()) |
failed | No such item here | |
already | Already carrying it | |
cant | IsPickable = false | |
ambiguous | Several items match — the which-did-you-mean question | |
succeedall | TAKE ALL picked something up ([MATCHES:list]) | |
failedall | TAKE ALL found nothing to pick up | |
nonoun | Verb typed with no object ("take") | |
drop | succeed | Item dropped (by the standard drop, or by the item's OnDrop script calling DefaultDrop()) |
failed | Not carrying it | |
worn | It's being worn — take it off first | |
succeedall | DROP ALL dropped something ([MATCHES:list]) | |
failedall | DROP ALL: carrying nothing (worn items are skipped) | |
nonoun | Verb typed with no object ("take") | |
put | succeed | Item moved into the container (PUT IN; or via its OnPutIn script calling DefaultPutIn()), or the target's OnPutOn printed something (PUT ON) |
nonoun | No item named, or not carrying it | |
notarget | No container / target named | |
notcontainer | PUT IN: the target isn't a container | |
cantputon | PUT X ON Y: the target has no OnPutOn event, or it printed nothing | |
use | succeed | OnUse / OnUseOn printed something |
failed | The item has no OnUse / OnUseOn event | |
nonoun | Verb typed with no object ("take") | |
give | succeed | The NPC took the item (its OnGive script called DefaultGive()) |
failed | The NPC has no OnGive event; the player keeps the item | |
noitem | No item named, or not carrying it | |
nonpc | No NPC named | |
eat | succeed | The item's OnEat event printed something |
failed | No OnEat event, or it printed nothing — or the noun names nothing here | |
nonoun | Verb typed with no object ("take") | |
drink | succeed | The item's OnDrink event printed something |
failed | No OnDrink event, or it printed nothing — or the noun names nothing here | |
nonoun | Verb typed with no object ("take") | |
break | succeed | The item's OnBreak event printed something |
failed | No OnBreak event, or it printed nothing — or the noun names nothing here | |
nonoun | Verb typed with no object ("take") | |
push | succeed | The item's OnPush event printed something |
failed | No OnPush event, or it printed nothing — or the noun names nothing here | |
nonoun | Verb typed with no object ("take") | |
pull | succeed | The item's OnPull event printed something |
failed | No OnPull event, or it printed nothing — or the noun names nothing here | |
nonoun | Verb typed with no object ("take") | |
climb | succeed | The item's OnClimb (item, then location) event printed something |
failed | No OnClimb (item, then location) event, or it printed nothing — or the noun names nothing here | |
nonoun | Verb typed with no object ("take") | |
wear | succeed | Now worn (by the standard wear, or by the item's OnWear script calling DefaultWear()) |
failed | IsWearable = false | |
already | Already wearing it | |
notcarried | Not carrying it | |
nonoun | Verb typed with no object ("take") | |
remove | succeed | Taken off (by the standard take-off, or by the item's OnRemove script calling DefaultRemove()) |
failed | Carried but not worn (not carried → treated as GET) | |
nonoun | Verb typed with no object ("take") | |
look | succeed | Room described (unless the location's OnExamine printed something) |
failed | No current location (shouldn't happen) | |
examine | succeed | Item/NPC/location described (its OnExamine or description) |
nothing | EXAMINE with no noun | |
scenery | The noun isn't an item, NPC, location or furniture | |
nothingspecial | Item has no description | |
failed | The noun names nothing visible | |
nonoun | Verb typed with no object ("take") | |
read | succeed | OnRead printed something, or the item was examined |
failed | The noun names nothing visible | |
nonoun | Verb typed with no object ("take") | |
open | succeed | Container opened (or OnOpen printed something) |
already | Container already open | |
failed | Not a container and no OnOpen event | |
nonoun | Verb typed with no object ("take") | |
close | succeed | Container closed (or OnClose printed something) |
already | Container already closed | |
failed | Not a container and no OnClose event | |
nonoun | Verb typed with no object ("take") | |
listen | succeed | OnTalk / location OnListen printed something |
failed | Nothing to hear | |
talk | succeed | NPC has no OnTalk output |
failed | No such NPC here, or it's disabled | |
ask | succeed | Topic answered or OnAsk printed something |
unknown | The NPC knows nothing about it | |
failed | No such NPC here, or it's disabled | |
topics | unasked | Topics not yet asked about |
asked | Topics already asked about | |
none | The NPC has nothing to discuss | |
failed | No such NPC here, or it's disabled | |
go | succeed | Moved — the new room is described |
failed | No enabled exit that way | |
blocked | Exit exists but no destination condition passes | |
enter | succeed | Moved — the new room is described |
failed | Can't enter that | |
blocked | Exit exists but no destination condition passes | |
inventory | succeed | Carried items listed ([INVENTORY:list]) |
empty | Carrying nothing | |
hint | none | No OnHint event printed anything |
recap | empty | The journal is empty |
wait | succeed | A turn passes |
help | succeed | Help text (unless OnHelp is defined) |
score | succeed | Score shown |
save | succeed | Game saved |
error | Saving failed ([ARG:error]) | |
undo | succeed | Last turn reversed |
failed | Nothing to undo | |
error | Undo failed | |
quit | confirm | Asks whether to save first |
saved | Saved, goodbye | |
nosave | Goodbye without saving | |
again | failed | Nothing to repeat |
north … down (all ten directions) | Same outcomes as go. | |
Grammar
Helpers for turning a raw comma-separated list into a grammatically joined sentence fragment.
| Function | Returns | Description |
|---|---|---|
Syndetic("text", "word") | String | Replaces the final ", " in a comma-separated string with " word " (no comma before the word), so a plain list reads naturally. Does not print — assign it or pass it to OutputText(). |
Examples
let names = Syndetic("Tom, Dick, Harry", "and")
OutputText(names) --> "Tom, Dick and Harry"
Location.DescribeNPCs, Location.DescribeItems and
Location.DescribeExits each take the syndetic word directly as their 3rd
argument, which covers the common case without a separate Syndetic() call:
Location.DescribeExits("You can go: ", true, "and")
--> "You can go: north, south and east"
Reach for Syndetic() directly when you need the same "and"-joining on some
other comma-separated text.
If Statements
| Form | Syntax | Notes |
|---|---|---|
| Inline | if cond then statement |
Single statement on same line. No else. No endif required. |
| Block | if cond then … endif |
Body on next line(s). Supports else. endif required. |
| Block with else | if cond then … else … endif |
Both branches can contain multiple statements. |
| elseif chain | if a then … elseif b then … else … endif |
One endif closes the whole chain.Alias: elsif, elif |
Examples
# Inline — no endif
if Player.Score.Total >= 100 then OutputText("Well done!")
# Block form with else — endif required
if Player.HasItem("torch") then
OutputText("The torch lights the way.")
else
OutputText("It is pitch dark.")
endif
# elseif chain — one endif closes all branches
if Player.Score.Total >= 200 then
OutputText("Hero!")
elseif Player.Score.Total >= 100 then
OutputText("Adventurer.")
elseif Player.Score.Total >= 50 then
OutputText("Survivor.")
else
OutputText("Novice.")
endif
Examples
# Inline — no endif
if Player.Score.Total >= 100 then OutputText("Well done!")
# Chained inline ifs (random message selection)
let r = Randomise(3)
if r = 1 then OutputText("The wind howls.")
if r = 2 then OutputText("Something creaks.")
if r = 3 then OutputText("Silence.")
# Block form with else — endif required
if Player.HasItem("torch") then
OutputText("The torch lights the way.")
else
OutputText("It is pitch dark.")
endif
Calling Scripts — call / run / gosub / RunScript
All four forms are identical in behaviour. They execute a named script by name, wait for it to finish, and then continue from the next line. Use whichever reads most naturally in context.
| Syntax | Notes |
|---|---|
call "ScriptName" | Standard keyword form — recommended |
run "ScriptName" | Alias for call |
gosub "ScriptName" | Alias for call — familiar to BASIC authors |
RunScript("ScriptName") | Function-call form — useful in inline command scripts |
Lookup order
- The current location's Events dictionary
- The adventure's GlobalEvents dictionary
- The adventure's GlobalProcedures dictionary
- The adventure's script library (
.gnl), if it has one - GoNorth's default library
Library names are matched without regard to capitals; the adventure's own scripts match exactly.
Commands
- Commands
- What the player can type, and what happens. Edited on the Commands tab of a location or an item, or in Tools → Commands (F9) for the adventure and its characters. See Commands.
Script libraries (.gnl)
.gnl(script library)- A text file of named scripts (procedures) that fill in GoNorth's built-in output. Chosen per adventure and stored inside the adventure package.
Location.VisibleItemsText/Location.VisibleNPCsText/Location.ExitsText- The visible items, characters or exits as a spoken list ("a key, a lamp and a rope"). Empty if none.
Player.CarriedItemsText/Item("name").ContentsText- Carried items, or the visible contents of a container, as a spoken list.
Location.LookItems()/Location.LookNPCs()/Location.LookExits()- Print exactly the matching part of what
lookprints (heading plus indented lines). The default library'sDescribeRoomis built from them. x.Index,x.IsFirst,x.IsLast- Loop-variable properties inside
foreach: position (from 1), first item, last item. Game.RunCommand("look")- Runs a read-only command (look, examine, read, listen, inventory, topics, recap, quick recap, last entry) as if the player typed it, and shows its output. Costs no turn. Inside a
lookoverride it runs the built-in look. look(library script)- Runs for the
lookcommand instead of the built-in handler, unless the adventure has its ownlookoverride or the location has anOnExaminescript.
A local script with the same name as a global script shadows it for that location only. This lets you write a generic global handler and override it per-location without changing any other scripts.
Limits
Maximum call depth is 16. Calls beyond that depth are silently discarded
and an error message is added to the turn output. Mutual recursion is possible within
this limit but should be used carefully. repeat runs at most 1000 passes. Every
script that runs in one turn shares a work limit; a turn that goes over it is undone (see
How long a script can run).
Example
# In a location's OnEnter script — calls the global version unless overridden locally
call "describe_weather"
OutputText("You step inside.")
# In a combat script — gosub reads naturally for BASIC-style authors
gosub "resolve_attack"
if Global.Variable("EnemyDefeated") then
OutputText("The creature falls.")
endif
# run is identical — use it if it reads better in your adventure's style
run "play_stinger"
Functions — function / endfunction / return
Functions are reusable, named blocks of code with parameters and a return value.
Unlike call, which runs a named script in the caller's scope, functions
have isolated local scope — variables declared inside are cleaned
up automatically when the function returns.
Definition syntax
function.Name(param1, param2)
# body
return value
endfunction
Call syntax
| Form | Notes |
|---|---|
let x = function.Name(arg1, arg2) | Capture return value |
function.Name(arg1, arg2) | Call discarding return value |
if function.Name(arg) then | Use return value as condition |
let x = function("Name", arg1, arg2) | String-name variant |
Rules
| Rule | Detail |
|---|---|
| Scope | All variables in a function are local — cleaned on return. Parameters are also local. |
| Parameters | Passed by value. Available as local variables inside the function body. |
| Return | return value exits and returns that value. return alone returns null (0 in numeric context). |
| Persistence | Use Game.Variable() / Global.Variable() for data that must survive the function call. |
| Recursion | Allowed. Max depth 16 (shared with call). Exceeding it prints an error and returns null. |
| Hoisting | Functions can be defined anywhere in the script and are available throughout — order does not matter. |
| Nesting | Nested function blocks are not allowed. Define all functions at the top level. |
Example
function.Clamp(Value, Lo, Hi)
if Value < Lo then return Lo endif
if Value > Hi then return Hi endif
return Value
endfunction
Player.Score("task") = function.Clamp(Player.Score("task"), 0, 100)
Containers
Items can be containers that hold other items. The engine automatically makes contents visible when the container is open, and hides them when closed.
| Command | Type | R/W | Description |
|---|---|---|---|
Item("x").IsOpen | Boolean | R/W | Whether the container is currently open. Items inside a closed container are invisible and untargetable. |
Item("x").ContentsVisible | Boolean | R | True if the container is open and has contents |
Item("x").Contents.HasItem("y") | Boolean | R | Does container hold this item |
Item("x").Contents.AddItem("y") | Action | — | Put item inside container |
Item("x").Contents.RemoveItem("y") | Action | — | Take item out of container |
Item("x").Contents.Count | Number | R | How many items are inside |
# OnUse on a chest — open/close toggle
if Item("Chest").IsOpen then
Item("Chest").IsOpen = false
OutputText("You close the chest.")
else
Item("Chest").IsOpen = true
OutputText("You open the chest. Inside you see a key.")
endif
Global Daemons
A daemon is a script that runs by itself at the end of every turn, wherever the player is, for as long as it is switched on. Use one for something that keeps happening in the background: a burning fuse, growing hunger, spreading poison. A Timer only counts, and your scripts read its value; a daemon does something each turn.
| Command | Description |
|---|---|
Daemon.Start("name") | Enable a daemon — it will now run every turn |
Daemon.Stop("name") | Disable a daemon |
Daemon.IsRunning("name") | True if the daemon is currently active |
Daemon.TurnCount("name") | How many turns have elapsed since the daemon started |
Daemon.StopAfter("name", n) | Auto-stop the daemon after n turns |
Create daemons on the Daemons tab of Adventure Settings. The script can be the code itself or the name of a Global Procedure to run:
# Daemon "BombFuse" — runs every turn while active
if Daemon.TurnCount("BombFuse") = 1 then OutputText("You hear a fuse burning.")
if Daemon.TurnCount("BombFuse") = 3 then OutputText("The fuse is nearly gone!")
if Daemon.TurnCount("BombFuse") >= 5 then
OutputText("BOOM. The bomb explodes!")
GameOver("You were too slow.")
endif
# Start it from another script:
Daemon.Start("BombFuse")
Daemon.StopAfter("BombFuse", 6)
Cyclic Adventure Timers
A Timer is a named clock, configured on the Timers tab in
Adventure Settings (Name, Cycle Length, Turns Per Step, Start Value, Running).
Unlike a Daemon it has no script of its own — scripts just read its current
value and branch on it. Same Object.Verb("name", ...) command
shape as Daemon above.
| Command | Description |
|---|---|
Timer.Value("name") | Current int position in the cycle |
Timer.IsRunning("name") | True if the timer is currently advancing |
Timer.Start("name") | Resume advancing, from wherever it left off |
Timer.Stop("name") | Pause — Value stays frozen |
Timer.Reset("name") | Back to Start Value, resumes from there |
TurnsPerStep is how many turns each value is held for;
CycleLength / TurnsPerStep gives the number of distinct values in
the loop. e.g. (24, 1) is 24 values, one per turn (an hour clock);
(24, 6) is 4 values, six turns each (a day-period clock).
# Timers tab: Name="DayClock", Cycle Length=24, Turns Per Step=1, Start Value=8
if Timer.Value("DayClock") >= 22 or Timer.Value("DayClock") < 6 then
OutputText("It's the dead of night.")
endif
The Adventure Verifier warns (non-fatally) if Cycle Length doesn't divide evenly by Turns Per Step — the engine still runs, it'll just hold the wrapping value slightly longer than the rest.
HINT
HINT (or HINTS) gives a contextual nudge — a
separate command from HELP, which shows general instructions.
Resolves through up to three tiers, checked in order:
| Tier | Description |
|---|---|
Location.Events["OnHint"] | Runs first, if present. If it calls Hint.Continue, or produces no output, falls through to the next tier. Otherwise its output is the hint. |
Adventure.GlobalEvents["OnHint"] | Runs if reached. Its output is the hint. |
| Built-in fallback | "You're not sure what to do next." — only if neither script exists, or neither produced output. |
| Command | Description |
|---|---|
Hint.Continue | Inside a Location's OnHint script — fall through to the Global tier |
Player.HintsUsed | Auto-incrementing counter (R/W) — bumped before either script runs, same ordering as Location.VisitCount before OnEnter |
Topics, Journal, RECAP
ASK NPC ABOUT X / TELL NPC ABOUT X resolve against the
target NPC's Topics list (Topics tab, NPC editor) — a structured alternative to
OnTalk. Resolves through up to three tiers, checked in order:
| Tier | Description |
|---|---|
| A visible Topic matches | Its Response outputs, then its Script runs (if present). First-ever ask on that Topic auto-appends a Journal entry. |
NPC.Events["OnAsk"] | Runs if no Topic matched, if present. |
| Built-in fallback | "{NpcName} doesn't seem to know anything about that." — only if neither produced output. |
| Command | Description |
|---|---|
Topic.Current.Keyword | The matched Topic's keyword, inside its own Script |
Topic.Current.IsDiscussed | True if this Topic was already discussed before this ask (false on the first ask, true on every one after) |
NPC("name").Topic("keyword").IsVisible | Is the Topic currently askable (R/W) — start a Topic hidden by unchecking Visible in the editor, then set this true to unlock it |
NPC("name").Topic("keyword").IsDiscussed | Has the Topic been asked about (R/W) |
NPC("name").HasUndiscoveredTopics | True if that NPC has any visible, not-yet-discussed Topic |
TOPICS NPC / SUBJECTS NPC | Player command — lists that NPC's visible Topics, split into askable vs. already-asked |
| Command | Description |
|---|---|
Journal.Add("text") | Manually append a Journal entry (for clues not tied to a Topic) |
Journal.Count | Number of Journal entries |
RECAP / JOURNAL | Player command — shows every Journal entry, oldest first |
QUICK RECAP / QUICK JOURNAL | Player command — shows the last 4 entries |
LAST ENTRY / RECAP LAST / LAST JOURNAL ENTRY | Player command — shows the single most recent entry |
An empty Journal shows "Nothing to recap yet." for all three RECAP
commands. The journal's in-fiction name ("journal" vs. a sci-fi "pip" device, etc.) is
just wording — add your own synonym to each command's VERB=[...] via your
adventure's own commands, no engine change needed.
The script editor and Verify warn when a script names a member an object does not have, such as Player.Scor.
Problem reports
Players on the web, on a playtest link or on Android can send you a report with the Report button or by typing
report. Your own report command takes priority over the word, but not over the button.
Reports appear under Problem Reports on your adventure's page in the Developer Portal. Each has the
player's note, the place in the game and their last 50 commands, which you can download as a .gni and
replay in the Designer.
Undo
The engine automatically snapshots the game state before each turn.
Players can undo the last 10 actions by typing undo or oops.
The game then describes the current location as look does. The player has not arrived anywhere, so OnEnter and NPC triggers do not run and no visit is counted.
| Input | Effect |
|---|---|
undo | Undo the last action |
oops | Alias for undo |
Pronoun Resolution
The engine remembers the last item or NPC you mentioned and substitutes pronouns automatically:
> examine the silver key
A small silver key...
> take it ← "it" resolved to "silver key"
You take the silver key.
> talk to the guard
The guard says hello.
> give it to him ← "it" = silver key, "him" = guard
You give the silver key to the guard.
| Pronoun | Resolves to |
|---|---|
it, them | Last mentioned item |
him, her | Last mentioned NPC |
that, this | Last mentioned item or NPC |
Parser Strictness
Set in Adventure Settings → Parser Strictness. Controls how the engine handles words it doesn't recognise:
| Level | Behaviour | Best for |
|---|---|---|
| Lenient | Skips all unknown words. "I want to kill the dragon but I'm scared" kills the dragon. | Children's games, casual adventures |
| Standard | Skips unknown words but rejects input containing hedge words (but, maybe, unless) or too many skipped significant words. | Most adventures (default) |
| Strict | Every word must match a word in the command or be a stop word. Unrecognised words cause the match to fail. | Puzzle-heavy, serious IF |
String Features Quick Reference
| Feature | Syntax | Example |
|---|---|---|
| Multi-line string | Just press Enter inside quotes | "Line one |
| New line code | <NL> / <BR> / <CR> | "Hi<NL>There" |
| Tab code | <TAB> or <T> | "A:<TAB>B" |
| Paragraph break | <PARA> | "End.<PARA>Start." |
| Horizontal rule | <HR> | "<HR>" |
| Double quote | <Q> | "He said <Q>hi<Q>" |
| Bold inline | <B>...</B> | "<B>SKILL</B>: 10" |
| Italic inline | <I>...</I> | "<I>whispers...</I>" |
| Silent (no TTS) | <s>...</s> | "HP:<s> 45/80</s>" |
| Voice expression | <EMOTE:Name> | "<EMOTE:Excitedly>Run, quick! <EMOTE:Whispering>Don't make a sound!" |
| Interpolation | {expr.with.dot} | "{Player.Name} arrives." |
| Function interpolation | {func(args)} | "Rolled {Randomise(6)}!" |
Layout Object
| Property | Value |
|---|---|
Layout.NewLine | New line \nAlias: Layout.NL |
Layout.Tab | Tab \t |
Layout.Para | Double new line \n\n |
Layout.Line | ──────────────────────────────── Alias: Layout.HR |
Layout.Line(width) | Horizontal rule of custom width |
Layout.Quote | Literal " |
Layout.Space | Non-breaking space |
Text Formatting Object
| Function | Returns |
|---|---|
Text.Bold("x") | Bold markup around x |
Text.Italic("x") | Italic markup around x Alias: Text.Italics("x") |
Text.Upper("x") | UPPERCASE string (no markup) |
Text.Lower("x") | lowercase string (no markup) |
Text.Colour("x","col") | Colour markup. Colours: red green blue yellow orange white grey gold Alias: Text.Color("x","col") |
Text.Font("x", size) | Font size markup |
Text.Quote | Literal " characterAlias: Text.DoubleQuote |
Audio Object
Audio files must be registered in the Media Manager with an alias before use.
Music, Sound and Sounds are identical aliases
for Audio.
- Sound setting
- Adventure Settings → Audio. Text only, Better with sound or Needs sound. Shown to players on the adventure's page and used by the browser's sound filter. Not available to scripts. See Sound setting.
| Command | Parameters | Description |
|---|---|---|
Audio("alias").Play | — | Play once at registered volume |
Audio("alias").Play(vol%) | vol: 0–100 | Play once at override volume |
Audio("alias").PlayLoop | — | Loop at registered volume |
Audio("alias").PlayLoop(vol%) | vol: 0–100 | Loop at override volume |
Audio("alias").FadeIn(ms) | ms: int | Start at 0, ramp to registered vol over ms |
Audio("alias").FadeIn(vol%, ms) | vol: 0–100, ms: int | Start at 0, ramp to vol% over ms |
Audio("alias").Stop | — | Stop immediately |
Audio("alias").FadeOut(ms) | ms: int | Ramp to 0 over ms then stop |
Audio("alias").Pause | — | Pause, preserve position |
Audio("alias").Resume | — | Resume from pause |
Audio("alias").Volume(vol%) | vol: 0–100 | Set volume immediately |
Audio("alias").VolumeTo(vol%, ms) | vol: 0–100, ms: int | Ramp to vol% over ms |
Audio("alias").Reset | — | Restore registered volume immediately |
Audio("alias").Reset(ms) | ms: int | Ramp back to registered volume over ms |
Audio("alias").IsPlaying | — | Bool — currently playing (no parens) |
Audio.StopAll | — | Stop all audio immediately |
Audio("alias").PlayWait | — | Play at registered volume and block speech until it finishes. Background audio continues. |
Audio("alias").PlayWait(vol%) | vol: 0–100 | Play at override volume and block speech until it finishes. Background audio continues. |
Audio("alias").Wait | alias: string | Block speech until the named alias (already playing) finishes. |
Audio.Wait(ms) | ms: int | Block speech for N milliseconds. No audio started. |
Inline Audio Tags
Embed audio commands directly in strings. Tags are stripped before display and TTS.
| Tag | Parameters | Description |
|---|---|---|
<AUDIO:alias,play> | — | Play once at registered volume |
<AUDIO:alias,play,60> | vol: 0–100 | Play once at override volume |
<AUDIO:alias,loop> | — | Loop at registered volume |
<AUDIO:alias,stop> | — | Stop immediately |
<AUDIO:alias,fadein,500> | ms: int | Start at 0, ramp to registered vol over ms |
<AUDIO:alias,fadein,60,500> | vol: 0–100, ms: int | Start at 0, ramp to vol% over ms |
<AUDIO:alias,fadeout,500> | ms: int | Ramp to 0 over ms then stop |
<AUDIO:alias,vol,60> | vol: 0–100 | Set volume immediately |
<AUDIO:alias,vol,60,500> | vol: 0–100, ms: int | Ramp to vol% over ms |
<AUDIO:alias,reset> | — | Restore registered volume immediately |
<AUDIO:alias,reset,500> | ms: int | Ramp back to registered volume over ms |
<AUDIO_STOP_ALL> | — | Stop all audio immediately |
<AUDIO:alias,60> | vol: 0–100 | Start or adjust to 60% (shorthand) |
<AUDIO:alias,60,loop> | vol: 0–100 | Loop at 60% (shorthand) |
<AUDIO:alias,60,500> | vol: 0–100, ms: int | Ramp to 60% over 500ms (shorthand) |
<AUDIO_PLAYWAIT:alias,vol%> | alias: string, vol: 0–100 | Play alias and block speech until it finishes |
<AUDIO_WAIT:alias> | alias: string | Block speech until named alias (already playing) finishes |
<AUDIO_WAIT:ms> | ms: int | Block speech for N milliseconds (e.g. <AUDIO_WAIT:500>) |
Voice
Controls the spoken voice from a script. See Voice and TTS for how voices, profiles and tags fit together.
| Command | Type | R/W | Description |
|---|---|---|---|
Voice.Set("profile") | Action | — | Switch to the named voice profile for subsequent output this turn |
Voice.Reset() | Action | — | Revert to the narrator / default voice |
Voice.Pause() | Action | — | Pause any in-progress TTS speech |
Voice.Resume() | Action | — | Resume paused speech |
Voice.IsEnabled | Boolean | R | True if TTS is currently enabled |
Language & Localisation
An adventure's narrative language — the words a player types and the responses the engine renders — is set independently from Voice narration and from the Designer's own UI language (the Designer UI itself is English-only; only adventure content is translatable).
| Concept | Where it lives | Notes |
|---|---|---|
| Adventure language tag | Adventure.Language | IETF tag, e.g. en-GB, fr-FR. Defaults to en-GB. Set from the New Adventure dialog or Adventure Settings. |
| Verb/response patterns | GoNorth.Core/Resources/Languages/{tag}/*.patterns | default.patterns (verbs), directions.patterns (exit shortcuts), responses.patterns (built-in outcome text). Loaded with a fallback chain — a specific tag overlays its generic/base language. |
| Voice meta-commands | GoNorth.Core/Resources/Languages/{tag}/voicecommands.txt | Recognises spoken/typed repeat/pause/resume/voice-on/voice-off commands in the player's language — see the Audio section above and GameEngine.TryHandleVoiceMetaCommand. |
| Spoken-input vocabulary | GoNorth.Core/Resources/Languages/{tag}/voice.txt | Sections for spoken input: leading filler words, spoken yes/no, the phrases for the free exits query ("exits", "which way can I go"), number words and homophone groups ("night"/"knight"). Same language fallback chain as the other files. |
| Voice/TTS locale | VoiceProfile.Locale | Per voice profile; falls back to Adventure.Language if a profile doesn't specify one. Drives which device/server TTS voice is used. |
Today only en-GB (full) and en-US (response overrides only) ship
with GoNorth. Adding a new narrative language is currently a manual translation task —
there is no assisted-translation tooling. See
GoNorth.Core/Resources/Languages/LANGUAGES.md for the exact folder layout,
fallback-chain rules, and the voice-command file format.
Input Object
Available in all scripts during a turn. Exposes what the pattern matcher parsed from the player's input. See also the scripting guide for usage examples.
Properties
| Property | Type | Description |
|---|---|---|
Input.Action | String | Canonical action name: "get", "pray", "examine" |
Input.Verb | String | Exact verb the player typed: "take", "grab" |
Input.Noun | String | Noun word(s) the player typed |
Input.NounItem.Exists | Bool | True if an item was matched |
Input.NounItem.Name | String | Matched item's name |
Input.NounItem.IsPickable | Bool | |
Input.NounItem.IsVisible | Bool | |
Input.Target | String | Target word(s) typed |
Input.TargetItem.Exists | Bool | |
Input.TargetItem.Name | String | |
Input.TargetNPC.Exists | Bool | |
Input.TargetNPC.Name | String | |
Input.TargetNPC.IsEnabled | Bool | |
Input.TargetNPC.IsAlive | Bool | |
Input.Adjective | String | Qualifier words from input: "silver", "old rusty" |
Input.Raw | String | Complete unmodified input string |
Input.IsAmbiguous | Bool | True if multiple items matched |
Methods
| Method | Returns | Description |
|---|---|---|
Input.HasAdjective("word") | Bool | True if this qualifier word appeared in the player's input |
Input.Continue | — | Pass control to the next handler in the priority chain |
Input.Redirect("action") | — | Re-process the current input as a different action |
Input.Override("itemName") | — | Replace the matched noun with a named item |
The handler chain
| Priority | Source |
|---|---|
| 1 (highest) | Location command inline script |
| 2 | Item command inline script (items in the room or carried) |
| 3 | NPC command inline script (NPCs present) |
| 4 | Adventure commands |
| 5 | GlobalProcedures["actionName"] override |
| 6 (lowest) | Engine built-in handler |
Action Override Scripts
Any built-in action (get, examine, go, open, look, inventory, etc.) can be completely replaced by an Action Override Script. In the Commands window (Tools → Commands, F9), select any Default command and click Edit Override Script ▶ in the Action Override Script section.
The override script runs instead of the built-in handler. It has full access to Input.*, Player.*, Location.*, Item(), NPC(), and all other script commands.
| Script content | Result |
|---|---|
Script exits normally (no Input.Continue) | Built-in skipped — script is the action |
Script calls Input.Continue | Built-in runs after the script output |
Script calls Input.Redirect("examine") | Re-runs as examine instead |
| No override set | Built-in runs unchanged |
Override scripts are stored as GlobalProcedures["actionName"] (e.g. GlobalProcedures["get"]). The action key is the lowercase action name.
# Completely replace GET for this adventure:
if Item(Input.Noun).Exists = false then
OutputText("There's no {Input.Noun} here.")
exit
endif
Item(Input.Noun).Give(Player)
OutputText("[Player.Name] grabs the {Input.Noun}.")
Flow Control
Keywords for controlling what runs and when.
| Keyword | Description |
|---|---|
exit |
Stop the current script immediately. Any lines after exit are skipped. Useful for early returns when a condition makes the rest of the script irrelevant.Alias: stop, break |
repeat n … endrepeat |
Run the block of code exactly n times. n can be a number or a variable. |
foreach var in collection [ sort by expr [ascending|descending] ] … endforeach |
Loop over every item in a collection. Collections: Items (location items), StackedItems / CarriedStacks (identical items listed once; the loop variable gains StackCount and StackName), CarriedItems (inventory), NPCs (NPCs in current location), VisibleItems / VisibleNPCs (only what the player can see here), AllItems / AllNPCs (every one in the adventure), Links (exits), Locations (all locations). The optional sort by clause iterates in the order of the given expression (ascending by default); see the Foreach Loop Variables section for SortKey. |
BreakLoop |
Exit the current foreach or repeat loop only — the script continues after it. Not the same as exit/stop above, which end the whole script.Alias: StopLoop, ExitLoop |
call "ScriptName" |
Run another named script. Looks up local scripts first, then global scripts. Alias: run "ScriptName", gosub "ScriptName", RunScript("ScriptName") |
Examples
# exit — stop script early
if Player.Variable(HitPoints) <= 0 then
GameOver("You have fallen.")
exit
endif
OutputText("You press on.")
# repeat — do something N times
repeat 3
OutputText("Boom!")
endrepeat
# foreach — loop over items in the room
foreach item in Items
OutputText("You see: " AND item.Name)
endforeach
# foreach with sort by, and BreakLoop to stop only the loop
foreach npc in NPCs sort by npc.Variable("Agility") descending
if npc.SortKey < Player.Variable("Agility") then
BreakLoop
endif
OutputText(npc.Name AND " is faster than you.")
endforeach
OutputText("The rest of the script keeps running.")
# call — run another script
call "CheckHealth"
call "PlayAmbience"
Foreach Loop Variables
Inside a foreach loop, the loop variable exposes these properties:
foreach item in Items / CarriedItems / VisibleItems / AllItems / StackedItems / CarriedStacks
| Property | Type | Description |
|---|---|---|
item.Name | String | Item's name |
item.ShortDescription | String | Short description, or the item's name if none is set Alias: item.ShortDesc, item.Short |
item.Description | String | Full description |
item.Weight | Number | Item weight |
item.Size | Number | Item size |
item.IsPickable | Boolean | Can be picked up |
item.IsVisible | Boolean | Listed in On Location Enter |
item.IsCarried | Boolean | Player is carrying it |
item.IsInLocation | Boolean | On the floor here |
item.Id | Number | Item ID |
item.DisplayName | String | The name the player sees |
item.LocationId | Number | Id of the location the item is in (resolved through containers) |
item.IsHere | Boolean | The item is in the player's current location |
item.StackCount | Number | StackedItems / CarriedStacks only: how many identical items this entry stands for |
item.StackName | String | StackedItems / CarriedStacks only: the name to show for the stack |
item.Variable("name") | Any | Read a custom variable on this item |
foreach npc in NPCs / VisibleNPCs / AllNPCs
| Property | Type | Description |
|---|---|---|
npc.Name | String | NPC's name |
npc.ShortDescription | String | Brief description for room entry lists |
npc.Description | String | Full description |
npc.IsEnabled | Boolean | Visible to player |
npc.IsAlive | Boolean | Alive/dead state |
npc.IsHere | Boolean | In current location |
npc.Id | Number | NPC ID |
npc.LocationId | Number | Current location (alias: npc.CurrentLocationId) |
npc.DisplayName | String | The name the player sees |
npc.IsVisible | Boolean | Can be seen and targeted by name |
npc.Variable("name") | Any | Read a custom variable on this NPC — e.g. npc.Variable("Agility") for a sort by key |
foreach link in Links
| Property | Type | Description |
|---|---|---|
link.Direction | String | The direction name (e.g. "North") |
link.ExitDescription | String | Room description text (e.g. "a shimmering lake") |
link.Description | String | Navigation alias (e.g. "lake") |
link.IsEnabled | Boolean | Exit is accessible |
foreach location in Locations
| Property | Type | Description |
|---|---|---|
location.Name | String | Location name |
location.Id | Number | Location ID |
location.Visited | Boolean | Player has been here |
location.ItemCount / location.VisibleItemCount | Number | Items on the floor / visible items on the floor |
location.NPCCount / location.VisibleNPCCount | Number | Enabled NPCs here / enabled and visible NPCs here |
location.Variable("name") | Any | Read a custom variable on this location |
Position in the loop (every foreach)
| Property | Type | Description |
|---|---|---|
x.Index | Number | Position in the loop, counting from 1 |
x.IsFirst / x.IsLast | Boolean | First / last pass of the loop |
repeat has no loop variable, so it has no Index.
<variable>.SortKey — with a sort by clause
When a loop uses foreach ... sort by expr ..., the loop variable
also gains a SortKey property, available for every collection type above
(item.SortKey, npc.SortKey, link.SortKey,
location.SortKey):
| Property | Type | Description |
|---|---|---|
<variable>.SortKey | Any | The value the loop is currently sorted by, for the current element. null if the loop has no sort by clause. |
next as an alias for endforeach
and endrepeat — it closes the innermost open loop.
String Escapes
| Escape | Produces | Example |
|---|---|---|
\" | A literal quote " | "He said, \"Run!\"" |
\n | New line | "Line one\nLine two" |
\t | Tab character | "Name:\tAlice" |
\\ | A literal backslash \ | "C:\\folder" |
Use OutputText("") to output a blank line for spacing between paragraphs.
Comparison Operators
| Operator | Meaning |
|---|---|
= | Equal to |
!= | Not equal to |
< | Less than |
<= | Less than or equal |
> | Greater than |
>= | Greater than or equal |
Assignment Operators
| Operator | Word form | Meaning |
|---|---|---|
= | — | Assign |
+= | Add | Add to |
-= | Subtract / Take | Subtract from |
*= | Multiply | Multiply by |
/= | Divide | Divide by |