Inform - Resources - Examples

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing Adventureland.inf

Classes for treasure, signs and rooms (lines 28-77)

028  Class Treasure
029   with depositpoints 7,
030        after
031        [; Take: if (location==Inside_Stump) "Taken!";
032           Drop: if (location==Inside_Stump) "Safely deposited.";
033        ];
034   
035  Class Sign
036   with name "sign",
037        short_name
038        [;  print "sign reads- ", (object) self; rtrue;
039        ],
040    has static;
041   
042  Class ScottRoom
043   with initial
044        [;  give self ~visited;
045        ],
046        describe
047        [ i c d;  print (string) self.description;
048            print "^^Obvious exits: ";
049            for (i=n_to: i<=d_to: i++)
050                if (self.i ~= 0) c++;
051            if (c==0) print "none!";
052            else
053            {   for (i=n_to: i<=d_to: i++)
054                    if (self.i ~= 0)
055                    {   if (d++>0) print ", ";
056                        if (i==n_to) print "North";
057                        if (i==s_to) print "South";
058                        if (i==e_to) print "East";
059                        if (i==w_to) print "West";
060                        if (i==u_to) print "Up";
061                        if (i==d_to) print "Down";
062                    }
063                print ".";
064            }
065            new_line;
066            c=0; d=0;
067            objectloop (i in self)
068                if (i ~= player) { c++; give i concealed; }
069            if (c==0) rtrue;
070            print "^You can also see: ";
071            objectloop (i in self)
072                if (i ~= player)
073                {   if (d++>0) print " - "; PrintShortName(i);
074                }
075            new_line; rtrue;
076        ];
077   


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.