Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Advent.inf

34. Grammar: the usual grammar and some extensions (lines 3771-3955)

3771  Include "Grammar";
3772   
3773  ! ------------------------------------------------------------------------------
3774   
3775  [ OffSub;
3776      if (brass_lantern notin player) "You have no lamp.";
3777      <<SwitchOff brass_lantern>>;
3778  ];
3779   
3780  [ OnSub;
3781      if (brass_lantern notin player) "You have no lamp.";
3782      <<SwitchOn brass_lantern>>;
3783  ];
3784   
3785  Verb 'off'
3786      *                       -> Off;
3787   
3788  Verb 'on'
3789      *                       -> On;
3790   
3791  ! ------------------------------------------------------------------------------
3792   
3793  [ CatchSub; "You can't catch ", (the) noun, "."; ];
3794   
3795  [ ReleaseSub; "You can't release ", (the) noun, "."; ];
3796   
3797  Verb 'catch' 'capture'
3798      * creature              -> Catch
3799      * creature 'with' held  -> Catch;
3800   
3801  Verb 'release' 'free'
3802      * creature              -> Release;
3803   
3804  ! ------------------------------------------------------------------------------
3805   
3806  [ WaterSub;
3807      if (bottle in player) <<Empty bottle>>;
3808      "Water? What water?";
3809  ];
3810   
3811  [ OilSub;
3812      if (bottle in player) <<Empty bottle>>;
3813      "Oil? What oil?";
3814  ];
3815   
3816  Verb 'water'
3817      * noun                  -> Water;
3818   
3819  Verb 'oil' 'grease' 'lubricate'
3820      * noun                  -> Oil;
3821   
3822  Verb 'pour' 'douse'
3823      * 'water' 'on' noun     -> Water
3824      * 'oil' 'on' noun       -> Oil
3825      * noun                  -> Empty;
3826   
3827  ! ------------------------------------------------------------------------------
3828   
3829  [ BlastSub;
3830      if (location ~= At_Sw_End or At_Ne_End) "Frustrating, isn't it?";
3831      if (location == At_Sw_End && parent(black_mark_rod) == At_Ne_End) {
3832          score = score + 35;
3833          deadflag = 2;
3834          "There is a loud explosion, and a twenty-foot hole appears in the far wall,
3835           burying the dwarves in the rubble.
3836           You march through the hole and find yourself in the main office,
3837           where a cheering band of friendly elves carry the conquering adventurer off into the sunset.";
3838      }
3839      if (location == At_Ne_End && parent(black_mark_rod) == At_Sw_End) {
3840          score = score + 20;
3841          deadflag = 1;
3842          "There is a loud explosion, and a twenty-foot hole appears in the far wall,
3843           burying the snakes in the rubble.
3844           A river of molten lava pours in through the hole, destroying everything in its path, including you!";
3845      }
3846      deadflag = 1;
3847      "There is a loud explosion, and you are suddenly splashed across the walls of the room.";
3848  ];
3849   
3850  [ BlastWithSub;
3851      if (second ~= black_mark_rod) "Blasting requires dynamite.";
3852      "Been eating those funny brownies again?";
3853  ];
3854   
3855  Verb 'blast'
3856      *                       -> Blast
3857      * noun 'with' held      -> BlastWith;
3858   
3859  ! ------------------------------------------------------------------------------
3860   
3861  [ XyzzySub; "Nothing happens."; ];
3862   
3863  [ PlughSub; "Nothing happens."; ];
3864   
3865  [ PloverSub; "Nothing happens."; ];
3866   
3867  [ FeeSub; FthingSub(0); ];
3868   
3869  [ FieSub; FthingSub(1); ];
3870   
3871  [ FoeSub; FthingSub(2); ];
3872   
3873  [ FooSub; FthingSub(3); ];
3874   
3875  [ FthingSub i;
3876      if (feefie_count ~= i) {
3877          feefie_count = 0;
3878          "Get it right, dummy!";
3879      }
3880      if (feefie_count++ == 3) {
3881          feefie_count = 0;
3882          if (golden_eggs in In_Giant_Room) "Nothing happens.";
3883          if ((golden_eggs in player) || (golden_eggs in location))
3884              print "The nest of golden eggs has vanished!^";
3885          else
3886              print "Done!";
3887          if (golden_eggs in player) score = score - 5;
3888          if (golden_eggs in Inside_Building)
3889              score = score - golden_eggs.depositpoints;
3890          move golden_eggs to In_Giant_Room;
3891          if (location == In_Giant_Room)
3892              "^^A large nest full of golden eggs suddenly appears out of nowhere!";
3893      }
3894      else
3895          "Ok.";
3896  ];
3897   
3898  [ OldMagicSub; "Good try, but that is an old worn-out magic word."; ];
3899   
3900  Verb 'xyzzy'
3901      *                       -> Xyzzy;
3902   
3903  Verb 'plugh'
3904      *                       -> Plugh;
3905   
3906  Verb 'plover'
3907      *                       -> Plover;
3908   
3909  Verb 'fee'
3910      *                       -> Fee;
3911   
3912  Verb 'fie'
3913      *                       -> Fie;
3914   
3915  Verb 'foe'
3916      *                       -> Foe;
3917   
3918  Verb 'foo'
3919      *                       -> Foo;
3920   
3921  Verb 'sesame' 'shazam' 'hocus' 'abracadabra' 'foobar' 'open-sesame' 'frotz'
3922      *                       -> OldMagic;
3923   
3924  Extend 'say' first
3925      * 'blast'               -> Blast
3926      * 'xyzzy'               -> Xyzzy
3927      * 'plugh'               -> Plugh
3928      * 'plover'              -> Plover
3929      * 'fee'                 -> Fee
3930      * 'fie'                 -> Fie
3931      * 'foe'                 -> Foe
3932      * 'foo'                 -> Foo
3933      * 'sesame'/'shazam'/'hocus'/'abracadabra'/'foobar'/'open-sesame'/'frotz'
3934                              -> OldMagic;
3935   
3936  ! ------------------------------------------------------------------------------
3937   
3938  [ CountSub;
3939      if (noun has multitude) "There are a multitude.";
3940      "I see one (1) ", (name) noun, ".";
3941  ];
3942   
3943  [ KickSub;  <<Attack noun>>; ];         ! For kicking dwarves
3944   
3945  [ UseSub; "You'll have to be a bit more explicit than that."; ];
3946   
3947  Verb 'count'
3948      * noun                  -> Count;
3949   
3950  Verb 'kick'
3951      * noun                  -> Kick;
3952   
3953  Verb 'use'
3954      *                       -> Use;
3955   


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.