Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Toyshop.inf

Christopher (lines 644-718)

644  ! >CH  A guest appearance by my cousin Christopher, aged six (*), who plays
645  !      with one thing at a time (easily forgetting which). Being "transparent"
646  !      (no reflection on him!) means the parser allows the player to examine
647  !      whatever he's playing with... but not to take it from him.
648  !      (* In 1993, when this game was first written.)
649  ! ----------------------------------------------------------------------------
650   
651  Object -> Chris "Christopher"
652    with name "child" "boy" "chris" "christopher",
653         describe
654         [;  print "^A boy called Christopher sits here";
655             if (child(Chris) ~= nothing)
656                 print ", playing with ", (a) child(Chris);
657             ".";
658         ],
659         life
660         [ x;
661             Ask:
662                switch(second)
663                {   'juggling', 'fluorescent', 'ball': "~That's mine!~";
664                    'helium', 'balloon': "Christopher yawns.";
665                    'cube', 'cubes': "~Bet I can make a higher tower than you.~";
666                    'toys', 'toyshop': "~Isn't it fabulous here?~";
667                    default: "~Dunno.~";
668                }
669             Answer:
670                switch(noun)
671                {   'hello', 'hallo', 'hi':
672                         "~Hello,~ says Christopher cheerfully.";
673                    default: "Christopher seems preoccupied.";
674                }
675             Attack: remove self;
676               "Christopher makes a run for it, effortlessly slipping past you!";
677             Kiss: "~That's soppy, that is.~";
678             Give:
679               if (noun==balloon) "He's too bored by the balloon.";
680               x=child(Chris);
681               if (x~=0)
682               {   move x to location;
683                   print "He forgets about ", (the) x, " and ";
684               }
685               else print "He ";
686               print "eagerly grabs ", (the) noun; move noun to Chris; ".";
687         ],
688         orders
689         [;  Drop: if (noun in Chris) "~Won't!  It's mine!~";
690             Take: "Christopher can't be bothered.";
691             Give: if (second==player) "~Get your own!~";
692             Go: "~But I like it here!~";
693             PutOn: if (noun notin Chris) "He is mightily confused.";
694                   if (~~(noun ofclass Block && second ofclass Block))
695                       "He can't see the point of this.";
696                   print "Christopher leans over with great concentration 
697                       and does so.^";
698                   move noun to player; give self general;
699                   <PutOn noun second>;
700                   give self ~general; rtrue;
701         ],
702         each_turn
703         [;  if (random(3)~=1) rtrue;
704             print "^Christopher ";
705             switch(random(4))
706             {  1: "yawns.";     2: "frowns.";
707                3: "stretches."; 4: "hums tonelessly.";
708             }
709         ],
710    has  animate proper transparent;
711   
712  Object "fluorescent juggling ball" Chris
713    with initial "On the floor is a fluorescent juggling ball!",
714         name "fluorescent" "juggling" "ball",
715         description "It glows with soft light."
716    has  light;
717   
718  ! ----------------------------------------------------------------------------


Last updated 23 June 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.