JACL Reference Card

Function Syntax

{nameAssociated function (on the preceding object or location).
{+nameGlobal function.
{*nameExplicitly named function (no auto-suffix).
{a : b : cMultiple names for the same function.
}Closes a function.
execute fn<arg0<arg1Run a function with arguments. Available inside as arg[n] (integer) and string_arg[n] (string).
call fnLike execute, but does not error if the function is missing.
return [value]Exit the function. Default return is true.
@fnCall-count of fn. Bare @ is the running function's own count.

Data Definitions

object Label : Name1 Name2…
  plural PluralName1…
  has Attribute1 Attribute2…
  short Article Description
  definite DefiniteArticle
  long Description | function
  parent ItemLabel
  mass N | heavy | scenery
  capacity N
  player
  static

location Label : Name1 Name2…
  <direction> DestLabel
  short Article Description
  has Attribute1…

integer Label [Value]
string Label ["Value"]
constant Label Value
attribute Label1 [Label2…]
grammar Syntax >CoreFunction
synonym OldWord NewWord
filter Word
parameter Name Target [min max]

Grammar scope tokens: *held *here *present *inside *anywhere (single noun); **held**anywhere (multi-noun). $integer / $string / $location capture literal player input.

Function Dispatch

grammar verb >fn
  1. +before_fn — if it returns true, jump to step 7.
  2. fn_here — associated with the current location.
  3. Otherwise +fn — the global function.
  4. If +fn hits override, look for fn_override_here.
  5. Otherwise +default_fn.
  6. Otherwise the rest of +fn after the override runs.
  7. +after_fn.
grammar verb *Obj1 >fn
  1. +before_fn (as above).
  2. fn_Obj1.
  3. Otherwise +fn.
  4. On override: fn_override_Obj1.
  5. Otherwise +default_fn.
  6. Otherwise continue +fn.
  7. +after_fn.
grammar verb *Obj1 prep *Obj2 >fn
  1. +before_fn.
  2. fn_Obj2_Obj1.
  3. Otherwise +fn.
  4. On override: fn_Obj2_override_Obj1.
  5. Otherwise +default_fn.
  6. Otherwise continue +fn.
  7. +after_fn.

Text Macros

Applied as noun{macro}. Capitalise the macro name (e.g. {The}) for sentence-initial form.

{list} {plain} {long} {the} {label} {names} {sub} {obj} {that} {it} {is} {isnt} {does} {doesnt} {s}

Object Elements

0parent 8index
1capacity / quantity9status
2mass 10timer
3bearing 11counter
4velocity 12points
5next 13class
6previous 14x
7child 15y

Object Attributes

1CLOSED 17BURNING
2LOCKED 18LOCATION
3DEAD 19ON
4IGNITABLE 20DAMAGED
5WORN 21FEMALE
6CONCEALING 22POSSESSIVE
7LUMINOUS 23OUT_OF_REACH
8WEARABLE 24TOUCHED
9CLOSABLE 25SCORED
10LOCKABLE 26SITTING
11ANIMATE 27NPC
12LIQUID 28DONE
13CONTAINER 29GAS
14SURFACE 30NO_TAB
15PLURAL 31NOT_IMPORTANT
16FLAMMABLE

Location Attributes

1VISITED 9POLLUTED
2DARK 10SOLVED
3ON_WATER 11MID_WATER
4UNDER_WATER 12DARKNESS
5WITHOUT_AIR 13MAPPED
6OUTDOORS 14KNOWN
7MID_AIR 18LOCATION
8TIGHT_ROPE

Pointers

player The object that is the player.
here The player's current location.
noun1, noun2First and second objects in the player's command.
noun3 Default loop iterator.
noun4 Free pointer.
self Object the running function is associated with.
destinationWhere the player is moving to (set before +movement).

Flow Control

if e1 [: e2…]True if any expression is true.
ifall e1 [: e2…]True if all are true.
ifstring e1 [: e2…]String version of if.
ifexecute fnTrue if fn exists and returns true.
else / endifBranch / close.
endallClose every open if/ifall at once.
loop [var] … endloopIterate every defined object.
select obj … endselectIterate the children of an object.
repeat … until eLoop while e is false.
while e … endwhileLoop while e is true.
iterate csv … enditerateWalk a CSV file row by row.
update csv … endupdateWalk a CSV file with write-back.
breakExit the innermost loop.
return [v]Exit the function.

Operators

= == != <>Integer equality / inequality.
> < >= <=Numeric comparison.
has / hasnt Attribute is / isn't set on an object.
is / isnt Object is / isn't in a scope (*held, *here, etc.).
grandof / !grandofTests deep parent relationships.
locationof / !locationofLeft is the enclosing location of right.
childof / !childofLeft is a direct child of right.

Common Verb Functions

Define {verb_label for an object-specific response, or {+default_verb for a global override. See Appendix B of the Author's Guide for the full list of 216 verb functions.

examinetakedrop opencloselock unlockwearremove insert_ininsert_onlook_in look_underlook_behindlook_through talk_toask_aboutask_for tell_aboutgive_toshow_to pullpushmove readeatdrink_from turn_onturn_offuse throw_atbreakcut listen_tosmelltaste climbenterjump lightextinguishburn tieuntieattack

Command Summary

Output / state

setensuremovewrite printprint:stylecursor clearmoreflushupdatestatus setstringaddstringescapestringpadstring lengthsplitpointsterminate undomove

Flow

ififallelseendif endallifstringifexecuteloop endloopselectendselectrepeat untiluntilallwhileendwhile iterateenditerateupdateendupdate breakreturnexecutecall

Special / I-O

proxyoverridepositionbearing distancedir_tonpc_torandom asknumbergetnumbergetstringgetyesorno savegamerestoregametimersound imagevolumestopgetenv

Web (cgijacl / fcgijacl)

hyperlinkhiddenpromptbutton optionappendappend_fcappend_nt append_lcinsert

Library Hooks

+intro Runs once at game start (and re-runs while web-side pending questions are unresolved).
+eachturn After every turn-consuming command.
eachturn On a location, fires when the player is there.
+timer Periodic, scheduled by the timer opcode.
+movement Global pre-movement hook; return true to block.
movement On a location, fires when the player tries to leave.
+title Optional header printed before each look.
+before_look / +after_lookWrap every look with custom content.
+no_light Replaces output when the location has DARKNESS.
+update_status_windowDraw the status window (Glk grid & web).
+rpc Web only: catches arbitrary ?rpc=… calls.
+game_intro webinterface scaffold (calls +game_dedication and +game_scene).