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

CommandTypeR/WDescription
Player.NameStringR/WThe player's name (set via Game.Ask() or directly)
Player.ScoreNumberR/WShorthand 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—WSet 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")NumberRRead the current value for key. Returns 0 if not yet set.
Player.Score.TotalNumberRSum of all named score entries (including "default") — the player's current total score.
Player.Score.ResetAction—Clear all named score entries (resets Player.Score.Total to 0).
Player.LocationIdNumberR/WCurrent location ID. Setting this teleports the player.
Player.TurnCountNumberRNumber of turns elapsed since game start
Player.ItemCountNumberRNumber of items being carried
Player.CarryWeightNumberRTotal weight of all carried items
Player.CarrySizeNumberRTotal size of all carried items
Player.CarriedItemsTextStringRThe carried items as a spoken list (“a key, a lamp and three coins”); empty if none
Player.HasItem(id|"name")BooleanRTrue if player is carrying this item
Player.HasAll("item1", "item2", ...)BooleanRTrue if player is carrying every listed item. Accepts any number of item names or IDs.
Player.HasAny("item1", "item2", ...)BooleanRTrue if player is carrying at least one of the listed items. Accepts any number of item names or IDs.
Player.HasVisited(locationId)BooleanRTrue if player has been to this location
Player.Variable("name")AnyR/WRead 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")NumberRHow 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()ActionNumberPick 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()ActionNumberDrop 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 "!")
Why use Player.Score("key") instead of adding a number directly?
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.

CommandTypeR/WDescription
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.IdNumberRID of the current location
Location.NameStringRName of the current location
Location.LongDescriptionStringR/WOverride the long description at runtime
Alias: .Description, .Desc, .LongDesc
Location.ShortDescriptionStringR/WOverride the short description at runtime
Alias: .Short, .ShortDesc
Location.VisitCountNumberR/WHow 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.VisitAbsoluteNumberRThe true, permanent count of every visit to this location. Unlike VisitCount, never reset by a description change.
Location.PreviousIDNumberRId 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.ItemCountNumberRNumber of items in the current location
Location.VisibleItemCountNumberRNumber of visible items in the current location (excludes items where IsVisible = false)
Location.VisibleNPCCountNumberRNumber of NPCs the player can see here (enabled and visible)
Location.Script("OnEvent").ExistsBooleanRTrue 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.VisitedBooleanRHas the player been here before
Location.Variable("name")AnyR/WRead or write a variable on the current location
Location(id).Variable("name")AnyR/WVariable on a specific location
Location.HasItem(id|"name")BooleanRIs 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")BooleanRIs this NPC in the current location
Location.HasExit("direction")BooleanRIs this exit currently accessible
Location.ExitEnabled("dir", bool)Action—Open or close an exit dynamically. true = open, false = blocked.
Location.FurnitureCountNumberRNumber of furniture items defined on the current location
Location.Furniture("name").ExistsBooleanRDoes a furniture item matching this name or alias exist
Location.Furniture("name").NameStringRPrimary name of the matched furniture item
Location.Furniture("name").DescriptionStringR/WGet or update the examine text of a furniture item at runtime
Location.Furniture("name").AliasStringR/WGet 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.ExitsCountNumberRCount of currently enabled exits from the current location
Location.NPCCountNumberRCount of currently enabled NPCs at the current location
Location(id).Furniture("name").DescriptionStringR/WAccess 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.

CommandTypeR/WDescription
Item("x").NameStringRItem's primary name
Item("x").DescriptionStringR/WItem's full description
Alias: .Desc, .LongDesc, .LongDescription
Item("x").ShortDescriptionStringR/WItem'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").IsWearableBooleanR/WWhether the item can be worn (WEAR / REMOVE)
Item("x").IsWornBooleanR/WWhether the player is currently wearing it. Only true while the item is carried
Item("x").DisplayNameStringR/WThe 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").InteractedBooleanR/WFalse 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").WeightNumberRItem's weight
Item("x").SizeNumberRItem's size
Item("x").LastSeenLocationStringRName of the location where the player last saw or carried this item (empty if never seen)
Item("x").LastSeenLocationIdNumberR/WId of that location; -1 if never seen
Item("x").LastSeenTurnNumberR/WThe turn the player last saw or carried this item
Item("x").HasBeenSeenBooleanRTrue once the player has seen or carried this item
Input.NounItem.IsHereBooleanRFalse when the command named an item that is somewhere else (inside an item's OnAbsent script)
Item("x").IsPickableBooleanR/WWhether the player can pick this item up
Item("x").IsVisibleBooleanR/WWhether the item is visible to the player (hidden items can't be picked up or examined)
Item("x").IsOpenBooleanR/WFor container items — whether the container is currently open
Item("x").ContentsVisibleBooleanRTrue if this is an open container (read-only shorthand for IsOpen)
Item("x").ExistsBooleanRTrue if player is carrying this item
Item("x").IsCarriedBooleanRAlias for .Exists
Item("x").IsInLocationBooleanRIs item in the current location (not carried)
Item("x").Variable("name")AnyR/WRead 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")AnyR/WRead or write an item variable. Supports unquoted name: Item("x").Variable(Fuel)
Item("x").Contents.HasItem("y")BooleanRDoes 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.CountNumberRHow many items are inside container x

NPC

CommandTypeR/WDescription
NPC("x").NameStringR/WNPC's name
NPC("x").ShortDescriptionStringR/WShort description (e.g. shown after death)
Alias: .ShortDesc, .Short
NPC("x").DescriptionStringR/WLong description, also what EXAMINE shows
Alias: .Desc, .LongDesc, .LongDescription
NPC("x").DisplayNameStringR/WThe 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").InteractedBooleanR/WFalse 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").IsEnabledBooleanR/WWhether the NPC is active and visible to the player. Set false to hide.
Alias: .Enabled
NPC("x").IsAliveBooleanR/WAlive/dead state
NPC("x").IsHereBooleanRIs this NPC in the current location
NPC("x").WhereaboutsStringR/WWhere the player believes this NPC went. Used when the player names them while they're away.
NPC("x").LastSeenLocationStringRName of the location where the player last saw this NPC (tracked automatically; empty if never seen)
NPC("x").LastSeenLocationIdNumberR/WId of that location; -1 if never seen
NPC("x").LastSeenTurnNumberR/WThe turn the player last saw this NPC
NPC("x").HasBeenMetBooleanRTrue once the player has seen this NPC
Input.TargetNPC.IsHereBooleanRFalse when the command named an NPC who is somewhere else (inside an OnAbsent script)
NPC("x").LocationIdNumberR/WWhich 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")BooleanRDoes NPC carry this item
NPC("x").Variable("name")AnyR/WRead 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").LocationsStringR/WGet 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").ClearLocationsAction—Remove all permitted locations and reset directional momentum — the NPC stops moving on the next turn
NPC("x").MovementModeNumber/StringR/WGet (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").LeaveMessageStringR/WDeparture announcement template, output whenever this NPC's location changes. Placeholders: {NpcName}, {LocationName}, {DirectionName}. Empty string = silent (the OnLeave event still fires).
NPC("x").EnterMessageStringR/WArrival 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:

ModeBehaviour
StationaryThe 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 ListEach 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).
WanderEach turn the NPC picks any enabled exit at random and wanders freely — no permitted-location restriction.
Weighted RandomEach 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 RouteEach 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.
ScriptedThe 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 relationshipWeightEffect
Continuing the same direction40Very likely — NPCs tend to keep going
Perpendicular turn20Occasional — a natural turn
Diagonal10Less common
Reversing (back the way they came)5Rare — avoids obvious ping-pong
No prior direction (first move, or after a custom exit)EqualAll 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

CommandDescription
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.

CommandTypeR/WDescription
Global.Variable("name")AnyR/WRead or write a global variable
Alias: Game.Variable()
Global.Ask("question")StringRPrompt 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")BooleanRTrue if the player's input contains this text
GameOver("message")Action—End the game with a message
Match.Group("name")StringRGet a captured group from the current pattern match
Match.HasGroup("name")BooleanRTrue 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

FunctionReturnsDescription
OutputText("text")—Output a line of text to the player. Empty string outputs a blank line.
InputText("text")BooleanTrue if the player's raw input contains the given text (case-insensitive). Useful in outcome scripts and global handlers.
random(a, b, c, ...)AnyReturn one of the supplied values at random
Randomise(n)NumberReturn 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)BooleanTrue N% of the time, e.g. chance(30) = 30% chance
DiceRoll(notation)NumberRoll 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)NumberSmaller of two numbers
max(a, b)NumberLarger of two numbers
abs(x)NumberAbsolute value (removes negative sign)
round(x)NumberRound to nearest whole number
round(x, dp)NumberRound to dp decimal places
floor(x)NumberRound down
ceil(x)NumberRound up
clamp(x, lo, hi)NumberKeep a value between lo and hi
sqrt(x)NumberSquare root
upper(s)StringConvert to uppercase
lower(s)StringConvert to lowercase
proper(s)StringSentence case — capitalise first letter and first letter after each .
length(s)NumberNumber of characters in string
trim(s)StringRemove leading/trailing spaces
contains(s, sub)BooleanTrue if s contains sub
startswith(s, prefix)BooleanTrue if s starts with prefix
endswith(s, suffix)BooleanTrue if s ends with suffix
replace(s, old, new)StringReplace all occurrences of old with new
substring(s, start, len)StringExtract part of a string
str(x)StringConvert number or boolean to string
num(x)NumberConvert string to number
int(x)NumberConvert 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:

CallPrints
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 only prints. 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

ActionOutcomeMeaning
getsucceedItem picked up (by the standard pick-up, or by the item's OnPickUp script calling DefaultPickUp())
failedNo such item here
alreadyAlready carrying it
cantIsPickable = false
ambiguousSeveral items match — the which-did-you-mean question
succeedallTAKE ALL picked something up ([MATCHES:list])
failedallTAKE ALL found nothing to pick up
nonounVerb typed with no object ("take")
dropsucceedItem dropped (by the standard drop, or by the item's OnDrop script calling DefaultDrop())
failedNot carrying it
wornIt's being worn — take it off first
succeedallDROP ALL dropped something ([MATCHES:list])
failedallDROP ALL: carrying nothing (worn items are skipped)
nonounVerb typed with no object ("take")
putsucceedItem moved into the container (PUT IN; or via its OnPutIn script calling DefaultPutIn()), or the target's OnPutOn printed something (PUT ON)
nonounNo item named, or not carrying it
notargetNo container / target named
notcontainerPUT IN: the target isn't a container
cantputonPUT X ON Y: the target has no OnPutOn event, or it printed nothing
usesucceedOnUse / OnUseOn printed something
failedThe item has no OnUse / OnUseOn event
nonounVerb typed with no object ("take")
givesucceedThe NPC took the item (its OnGive script called DefaultGive())
failedThe NPC has no OnGive event; the player keeps the item
noitemNo item named, or not carrying it
nonpcNo NPC named
eatsucceedThe item's OnEat event printed something
failedNo OnEat event, or it printed nothing — or the noun names nothing here
nonounVerb typed with no object ("take")
drinksucceedThe item's OnDrink event printed something
failedNo OnDrink event, or it printed nothing — or the noun names nothing here
nonounVerb typed with no object ("take")
breaksucceedThe item's OnBreak event printed something
failedNo OnBreak event, or it printed nothing — or the noun names nothing here
nonounVerb typed with no object ("take")
pushsucceedThe item's OnPush event printed something
failedNo OnPush event, or it printed nothing — or the noun names nothing here
nonounVerb typed with no object ("take")
pullsucceedThe item's OnPull event printed something
failedNo OnPull event, or it printed nothing — or the noun names nothing here
nonounVerb typed with no object ("take")
climbsucceedThe item's OnClimb (item, then location) event printed something
failedNo OnClimb (item, then location) event, or it printed nothing — or the noun names nothing here
nonounVerb typed with no object ("take")
wearsucceedNow worn (by the standard wear, or by the item's OnWear script calling DefaultWear())
failedIsWearable = false
alreadyAlready wearing it
notcarriedNot carrying it
nonounVerb typed with no object ("take")
removesucceedTaken off (by the standard take-off, or by the item's OnRemove script calling DefaultRemove())
failedCarried but not worn (not carried → treated as GET)
nonounVerb typed with no object ("take")
looksucceedRoom described (unless the location's OnExamine printed something)
failedNo current location (shouldn't happen)
examinesucceedItem/NPC/location described (its OnExamine or description)
nothingEXAMINE with no noun
sceneryThe noun isn't an item, NPC, location or furniture
nothingspecialItem has no description
failedThe noun names nothing visible
nonounVerb typed with no object ("take")
readsucceedOnRead printed something, or the item was examined
failedThe noun names nothing visible
nonounVerb typed with no object ("take")
opensucceedContainer opened (or OnOpen printed something)
alreadyContainer already open
failedNot a container and no OnOpen event
nonounVerb typed with no object ("take")
closesucceedContainer closed (or OnClose printed something)
alreadyContainer already closed
failedNot a container and no OnClose event
nonounVerb typed with no object ("take")
listensucceedOnTalk / location OnListen printed something
failedNothing to hear
talksucceedNPC has no OnTalk output
failedNo such NPC here, or it's disabled
asksucceedTopic answered or OnAsk printed something
unknownThe NPC knows nothing about it
failedNo such NPC here, or it's disabled
topicsunaskedTopics not yet asked about
askedTopics already asked about
noneThe NPC has nothing to discuss
failedNo such NPC here, or it's disabled
gosucceedMoved — the new room is described
failedNo enabled exit that way
blockedExit exists but no destination condition passes
entersucceedMoved — the new room is described
failedCan't enter that
blockedExit exists but no destination condition passes
inventorysucceedCarried items listed ([INVENTORY:list])
emptyCarrying nothing
hintnoneNo OnHint event printed anything
recapemptyThe journal is empty
waitsucceedA turn passes
helpsucceedHelp text (unless OnHelp is defined)
scoresucceedScore shown
savesucceedGame saved
errorSaving failed ([ARG:error])
undosucceedLast turn reversed
failedNothing to undo
errorUndo failed
quitconfirmAsks whether to save first
savedSaved, goodbye
nosaveGoodbye without saving
againfailedNothing 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.

FunctionReturnsDescription
Syndetic("text", "word")StringReplaces 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

FormSyntaxNotes
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.

SyntaxNotes
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

  1. The current location's Events dictionary
  2. The adventure's GlobalEvents dictionary
  3. The adventure's GlobalProcedures dictionary
  4. The adventure's script library (.gnl), if it has one
  5. 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 look prints (heading plus indented lines). The default library's DescribeRoom is 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 look override it runs the built-in look.
look (library script)
Runs for the look command instead of the built-in handler, unless the adventure has its own look override or the location has an OnExamine script.

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

FormNotes
let x = function.Name(arg1, arg2)Capture return value
function.Name(arg1, arg2)Call discarding return value
if function.Name(arg) thenUse return value as condition
let x = function("Name", arg1, arg2)String-name variant

Rules

RuleDetail
ScopeAll variables in a function are local — cleaned on return. Parameters are also local.
ParametersPassed by value. Available as local variables inside the function body.
Returnreturn value exits and returns that value. return alone returns null (0 in numeric context).
PersistenceUse Game.Variable() / Global.Variable() for data that must survive the function call.
RecursionAllowed. Max depth 16 (shared with call). Exceeding it prints an error and returns null.
HoistingFunctions can be defined anywhere in the script and are available throughout — order does not matter.
NestingNested 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.

CommandTypeR/WDescription
Item("x").IsOpenBooleanR/WWhether the container is currently open. Items inside a closed container are invisible and untargetable.
Item("x").ContentsVisibleBooleanRTrue if the container is open and has contents
Item("x").Contents.HasItem("y")BooleanRDoes 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.CountNumberRHow 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.

CommandDescription
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.

CommandDescription
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:

TierDescription
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.
CommandDescription
Hint.ContinueInside a Location's OnHint script — fall through to the Global tier
Player.HintsUsedAuto-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:

TierDescription
A visible Topic matchesIts 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.
CommandDescription
Topic.Current.KeywordThe matched Topic's keyword, inside its own Script
Topic.Current.IsDiscussedTrue if this Topic was already discussed before this ask (false on the first ask, true on every one after)
NPC("name").Topic("keyword").IsVisibleIs 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").IsDiscussedHas the Topic been asked about (R/W)
NPC("name").HasUndiscoveredTopicsTrue if that NPC has any visible, not-yet-discussed Topic
TOPICS NPC / SUBJECTS NPCPlayer command — lists that NPC's visible Topics, split into askable vs. already-asked
CommandDescription
Journal.Add("text")Manually append a Journal entry (for clues not tied to a Topic)
Journal.CountNumber of Journal entries
RECAP / JOURNALPlayer command — shows every Journal entry, oldest first
QUICK RECAP / QUICK JOURNALPlayer command — shows the last 4 entries
LAST ENTRY / RECAP LAST / LAST JOURNAL ENTRYPlayer 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.

InputEffect
undoUndo the last action
oopsAlias 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.
PronounResolves to
it, themLast mentioned item
him, herLast mentioned NPC
that, thisLast mentioned item or NPC

Parser Strictness

Set in Adventure Settings → Parser Strictness. Controls how the engine handles words it doesn't recognise:

LevelBehaviourBest 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

FeatureSyntaxExample
Multi-line stringJust press Enter inside quotes"Line one
Line two"
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

PropertyValue
Layout.NewLineNew line \n
Alias: Layout.NL
Layout.TabTab \t
Layout.ParaDouble new line \n\n
Layout.Line────────────────────────────────
Alias: Layout.HR
Layout.Line(width)Horizontal rule of custom width
Layout.QuoteLiteral "
Layout.SpaceNon-breaking space

Text Formatting Object

FunctionReturns
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.QuoteLiteral " character
Alias: 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.
CommandParametersDescription
Audio("alias").Play—Play once at registered volume
Audio("alias").Play(vol%)vol: 0–100Play once at override volume
Audio("alias").PlayLoop—Loop at registered volume
Audio("alias").PlayLoop(vol%)vol: 0–100Loop at override volume
Audio("alias").FadeIn(ms)ms: intStart at 0, ramp to registered vol over ms
Audio("alias").FadeIn(vol%, ms)vol: 0–100, ms: intStart at 0, ramp to vol% over ms
Audio("alias").Stop—Stop immediately
Audio("alias").FadeOut(ms)ms: intRamp to 0 over ms then stop
Audio("alias").Pause—Pause, preserve position
Audio("alias").Resume—Resume from pause
Audio("alias").Volume(vol%)vol: 0–100Set volume immediately
Audio("alias").VolumeTo(vol%, ms)vol: 0–100, ms: intRamp to vol% over ms
Audio("alias").Reset—Restore registered volume immediately
Audio("alias").Reset(ms)ms: intRamp 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–100Play at override volume and block speech until it finishes. Background audio continues.
Audio("alias").Waitalias: stringBlock speech until the named alias (already playing) finishes.
Audio.Wait(ms)ms: intBlock speech for N milliseconds. No audio started.

Inline Audio Tags

Embed audio commands directly in strings. Tags are stripped before display and TTS.

TagParametersDescription
<AUDIO:alias,play>—Play once at registered volume
<AUDIO:alias,play,60>vol: 0–100Play once at override volume
<AUDIO:alias,loop>—Loop at registered volume
<AUDIO:alias,stop>—Stop immediately
<AUDIO:alias,fadein,500>ms: intStart at 0, ramp to registered vol over ms
<AUDIO:alias,fadein,60,500>vol: 0–100, ms: intStart at 0, ramp to vol% over ms
<AUDIO:alias,fadeout,500>ms: intRamp to 0 over ms then stop
<AUDIO:alias,vol,60>vol: 0–100Set volume immediately
<AUDIO:alias,vol,60,500>vol: 0–100, ms: intRamp to vol% over ms
<AUDIO:alias,reset>—Restore registered volume immediately
<AUDIO:alias,reset,500>ms: intRamp back to registered volume over ms
<AUDIO_STOP_ALL>—Stop all audio immediately
<AUDIO:alias,60>vol: 0–100Start or adjust to 60% (shorthand)
<AUDIO:alias,60,loop>vol: 0–100Loop at 60% (shorthand)
<AUDIO:alias,60,500>vol: 0–100, ms: intRamp to 60% over 500ms (shorthand)
<AUDIO_PLAYWAIT:alias,vol%>alias: string, vol: 0–100Play alias and block speech until it finishes
<AUDIO_WAIT:alias>alias: stringBlock speech until named alias (already playing) finishes
<AUDIO_WAIT:ms>ms: intBlock 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.

CommandTypeR/WDescription
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.IsEnabledBooleanRTrue 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).

ConceptWhere it livesNotes
Adventure language tagAdventure.LanguageIETF tag, e.g. en-GB, fr-FR. Defaults to en-GB. Set from the New Adventure dialog or Adventure Settings.
Verb/response patternsGoNorth.Core/Resources/Languages/{tag}/*.patternsdefault.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-commandsGoNorth.Core/Resources/Languages/{tag}/voicecommands.txtRecognises 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 vocabularyGoNorth.Core/Resources/Languages/{tag}/voice.txtSections 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 localeVoiceProfile.LocalePer 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

PropertyTypeDescription
Input.ActionStringCanonical action name: "get", "pray", "examine"
Input.VerbStringExact verb the player typed: "take", "grab"
Input.NounStringNoun word(s) the player typed
Input.NounItem.ExistsBoolTrue if an item was matched
Input.NounItem.NameStringMatched item's name
Input.NounItem.IsPickableBool
Input.NounItem.IsVisibleBool
Input.TargetStringTarget word(s) typed
Input.TargetItem.ExistsBool
Input.TargetItem.NameString
Input.TargetNPC.ExistsBool
Input.TargetNPC.NameString
Input.TargetNPC.IsEnabledBool
Input.TargetNPC.IsAliveBool
Input.AdjectiveStringQualifier words from input: "silver", "old rusty"
Input.RawStringComplete unmodified input string
Input.IsAmbiguousBoolTrue if multiple items matched

Methods

MethodReturnsDescription
Input.HasAdjective("word")BoolTrue 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

PrioritySource
1 (highest)Location command inline script
2Item command inline script (items in the room or carried)
3NPC command inline script (NPCs present)
4Adventure commands
5GlobalProcedures["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 contentResult
Script exits normally (no Input.Continue)Built-in skipped — script is the action
Script calls Input.ContinueBuilt-in runs after the script output
Script calls Input.Redirect("examine")Re-runs as examine instead
No override setBuilt-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.

KeywordDescription
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

PropertyTypeDescription
item.NameStringItem's name
item.ShortDescriptionStringShort description, or the item's name if none is set
Alias: item.ShortDesc, item.Short
item.DescriptionStringFull description
item.WeightNumberItem weight
item.SizeNumberItem size
item.IsPickableBooleanCan be picked up
item.IsVisibleBooleanListed in On Location Enter
item.IsCarriedBooleanPlayer is carrying it
item.IsInLocationBooleanOn the floor here
item.IdNumberItem ID
item.DisplayNameStringThe name the player sees
item.LocationIdNumberId of the location the item is in (resolved through containers)
item.IsHereBooleanThe item is in the player's current location
item.StackCountNumberStackedItems / CarriedStacks only: how many identical items this entry stands for
item.StackNameStringStackedItems / CarriedStacks only: the name to show for the stack
item.Variable("name")AnyRead a custom variable on this item

foreach npc in NPCs / VisibleNPCs / AllNPCs

PropertyTypeDescription
npc.NameStringNPC's name
npc.ShortDescriptionStringBrief description for room entry lists
npc.DescriptionStringFull description
npc.IsEnabledBooleanVisible to player
npc.IsAliveBooleanAlive/dead state
npc.IsHereBooleanIn current location
npc.IdNumberNPC ID
npc.LocationIdNumberCurrent location (alias: npc.CurrentLocationId)
npc.DisplayNameStringThe name the player sees
npc.IsVisibleBooleanCan be seen and targeted by name
npc.Variable("name")AnyRead a custom variable on this NPC — e.g. npc.Variable("Agility") for a sort by key

foreach link in Links

PropertyTypeDescription
link.DirectionStringThe direction name (e.g. "North")
link.ExitDescriptionStringRoom description text (e.g. "a shimmering lake")
link.DescriptionStringNavigation alias (e.g. "lake")
link.IsEnabledBooleanExit is accessible

foreach location in Locations

PropertyTypeDescription
location.NameStringLocation name
location.IdNumberLocation ID
location.VisitedBooleanPlayer has been here
location.ItemCount / location.VisibleItemCountNumberItems on the floor / visible items on the floor
location.NPCCount / location.VisibleNPCCountNumberEnabled NPCs here / enabled and visible NPCs here
location.Variable("name")AnyRead a custom variable on this location

Position in the loop (every foreach)

PropertyTypeDescription
x.IndexNumberPosition in the loop, counting from 1
x.IsFirst / x.IsLastBooleanFirst / 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):

PropertyTypeDescription
<variable>.SortKeyAnyThe value the loop is currently sorted by, for the current element. null if the loop has no sort by clause.
Note: Use next as an alias for endforeach and endrepeat — it closes the innermost open loop.

String Escapes

EscapeProducesExample
\"A literal quote ""He said, \"Run!\""
\nNew line"Line one\nLine two"
\tTab character"Name:\tAlice"
\\A literal backslash \"C:\\folder"

Use OutputText("") to output a blank line for spacing between paragraphs.

Comparison Operators

OperatorMeaning
=Equal to
!=Not equal to
<Less than
<=Less than or equal
>Greater than
>=Greater than or equal

Assignment Operators

OperatorWord formMeaning
=—Assign
+=AddAdd to
-=Subtract / TakeSubtract from
*=MultiplyMultiply by
/=DivideDivide by