Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Alice3.inf

Helping routines and grammar (lines 10-90)

010  ! Possible values for a kitten's state property:
011   
012  Constant HELD_STATE = 0;     ! Being held
013  Constant QUEEN_STATE = 1;    ! Playing with the Red Queen
014  Constant WOOL_STATE = 2;     ! Playing with the worsted
015  Constant CHAIR_STATE = 3;    ! In the way of the chair
016   
017  Include "parser";
018  Include "verblib";
019  Include "grammar";
020   
021  [ Initialise;
022      location = Drawing_Room;
023      StartDaemon(white_kitten);
024      StartDaemon(black_kitten);
025      print "^^^^^It's a cold winter day outside, but in the
026          looking-glass house it's summer. All you need to do is
027          pretend there's a way of getting through into it
028          somehow...^^";
029  ];
030   
031  [ Inside x y;
032      do {
033          x = parent(x);
034      } until (x == 0 or y);
035      if (x == 0) rfalse;
036  ];
037   
038  [ UntangleSub; "What curious ideas you have!"; ];
039   
040  [ ReflectSub;
041      if (second ~= mirror) "What a strange idea!";
042      if (noun == hearth or mirror || (player notin mantelpiece && 
043          player notin armchair))
044          "You can't see that in the looking-glass.";
045      print "The looking-glass ";
046      if (noun == player) print "Alice";
047      else print (name) noun;
048      if (player in mantelpiece) " looks very misty and blurred.";
049      print " looks just like the real ";
050      if (noun == player) print "Alice";
051      else print (name) noun;
052      " only all reversed, left for right.";
053  ];
054   
055  Extend "look"
056      * "at" noun "in" noun -> Reflect;
057   
058  Extend "examine"
059      * noun "in" noun -> Reflect;
060   
061  Verb "roll" "untangle" "wind"
062      * noun -> Untangle
063      * "up" noun -> Untangle
064      * noun "up" -> Untangle;
065   
066  Verb "pet" "stroke" = "rub";
067   
068  Object  Drawing_Room "Drawing room"
069   has    light
070   with   name "snow",
071          description "The gentle sound of snow against the window pane
072              suggests that it's cold outside, and you're glad to be
073              here in the warmth. The drawing-room is reflected in the
074              large looking-glass on the wall above the mantelpiece,
075              and a very comfortable room it is too, with a warm
076              hearth, a soft rug and an arm-chair that you can curl up
077              and sleep in.",
078          before [;
079              if (player notin Mantelpiece) rfalse;
080           Exit,Go:
081              if (noun == d_obj or out_obj)
082                  "That's not the way to get down from a mantelpiece!";
083           Examine,Enter,ThrowAt,ThrownAt,Reflect: ;
084           default:
085              if (inp1 ~= 1 && noun ~= 0 && Inside(noun,mantelpiece) == 0)
086                 "You can't reach ", (the) noun, " from up here.";
087              if (inp2 ~= 1 && second ~= 0 && Inside(second,mantelpiece) == 0)
088                 "You can't reach ", (the) second, " from up here.";
089          ];
090   


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.