! Routines and Entry Points ! ! (Fuller examples of which can be found in the "Advent" example game.) ! ! Initialise() just sets up the initial state of the game. ! We are required to set "location" to the start location of the ! player; the rest is optional. ! ! StartDaemon(balloon) starts the process which blows the balloon back ! and forth. ! ---------------------------------------------------------------------------- [ Initialise; location=chair; move satchel to player; print "^^^^^~What's so special about Inform,~ is the last thing you remember saying to the mad alchemist. Big mistake...^^"; StartDaemon(balloon); ]; ! ---------------------------------------------------------------------------- ! Print names of tasks out (when the library asks us to). Note that they ! are numbered from 0 to NUMBER_TASKS-1. ! ---------------------------------------------------------------------------- [ PrintTaskName achievement; switch(achievement) { 0: "eating a sweet"; 1: "driving the car"; 2: "shutting out the draught"; 3: "building a tower of four"; 4: "seeing which way the mantelpiece leans"; 5: "writing on the blackboard"; } ]; [ PrintRank; print ", earning you the rank of "; if (score >= 6) "Toyshop manager."; if (score >= 5) "management trainee."; if (score >= 4) "undergraduate."; if (score >= 3) "schoolchild."; if (score >= 2) "nursery-school child."; if (score >= 1) "toddler."; "newborn baby."; ]; ! ---------------------------------------------------------------------------- ! Now (as promised earlier) we provide the replacement for BurnSub, ! specially adapted to the rules of the Toyshop: ! ---------------------------------------------------------------------------- [ BurnSub; if (match hasnt light) "You have no source of flame."; if (noun has animate) <>; if (noun==padded_floor) { deadflag=1; "A gong sounds, but before a sepulchral voice finishes clearing its throat, the whole padded floor goes up in an inferno."; } "A gong sounds, and a sepulchral, rather disappointed voice says: ~It is forbidden to play with fire in the Toyshop.~"; ]; ! ---------------------------------------------------------------------------- ! And we provide one new action, "Burst", which in fact just passes over to ! "Attack", plus one for writing on the board: ! ---------------------------------------------------------------------------- [ BurstSub; <>; ]; Include "Grammar"; Verb "burst" "pop" "prick" "stab" "pierce" * noun -> Burst; Verb "write" * QuotedText -> Write; ! ----------------------------------------------------------------------------