Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
At End

Plain
Coloured
Gaudy

This code
in plain text

Browsing Toyshop.inf

Routines and Entry Points (lines 863-942)

863  !   Routines and Entry Points
864  !
865  !   (Fuller examples of which can be found in the "Advent" example game.)
866  !
867  !   Initialise() just sets up the initial state of the game.
868  !   We are required to set "location" to the start location of the
869  !   player; the rest is optional.
870  !
871  !   StartDaemon(balloon)  starts the process which blows the balloon back
872  !   and forth.
873  ! ----------------------------------------------------------------------------
874   
875  [ Initialise;
876    location=chair;  move satchel to player;
877   
878    print "^^^^^~What's so special about Inform,~ is the last thing you 
879           remember saying to the mad alchemist. Big mistake...^^";
880   
881    StartDaemon(balloon);
882  ];
883   
884  ! ----------------------------------------------------------------------------
885  !   Print names of tasks out (when the library asks us to).  Note that they
886  !   are numbered from 0 to NUMBER_TASKS-1.
887  ! ----------------------------------------------------------------------------
888   
889  [ PrintTaskName achievement;
890    switch(achievement)
891    {   0: "eating a sweet";
892        1: "driving the car";
893        2: "shutting out the draught";
894        3: "building a tower of four";
895        4: "seeing which way the mantelpiece leans";
896        5: "writing on the blackboard";
897    }
898  ];
899   
900  [ PrintRank;
901    print ", earning you the rank of ";
902    if (score >= 6)  "Toyshop manager.";
903    if (score >= 5)  "management trainee.";
904    if (score >= 4)  "undergraduate.";
905    if (score >= 3)  "schoolchild.";
906    if (score >= 2)  "nursery-school child.";
907    if (score >= 1)  "toddler.";
908    "newborn baby.";
909  ];
910   
911  ! ----------------------------------------------------------------------------
912  !   Now (as promised earlier) we provide the replacement for BurnSub,
913  !   specially adapted to the rules of the Toyshop:
914  ! ----------------------------------------------------------------------------
915   
916  [ BurnSub;
917      if (match hasnt light) "You have no source of flame.";
918      if (noun has animate) <<Attack noun>>;
919      if (noun==padded_floor)
920      {   deadflag=1;
921          "A gong sounds, but before a sepulchral voice finishes clearing 
922           its throat, the whole padded floor goes up in an inferno.";
923      }
924      "A gong sounds, and a sepulchral, rather disappointed voice says: 
925       ~It is forbidden to play with fire in the Toyshop.~";
926  ];
927   
928  ! ----------------------------------------------------------------------------
929  !   And we provide one new action, "Burst", which in fact just passes over to
930  !   "Attack", plus one for writing on the board:
931  ! ----------------------------------------------------------------------------
932   
933  [ BurstSub; <<Attack noun>>; ];
934   
935  Include "Grammar";
936   
937  Verb "burst" "pop" "prick" "stab" "pierce"
938                  * noun                           -> Burst;
939   
940  Verb "write"    * QuotedText -> Write;
941   
942  ! ----------------------------------------------------------------------------


Last updated 23 June 2004. This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation. Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.