[Inform] Jelly babies


01 Dec 1995 14:47:39 GMT

Demon <demon@ih2000.net> wrote:
> I'd like to have the player have a certain object with him at the
> start of the game. How do I do this in Inform 5.5?

Move the object to the player in the `Initialise' routine:

[ Initialise;
location = StartRoom;
move SackOfPotatoes to player;
move Fish to player;
"^^^^^Welcome to the grocery...^^";
];

> Also, how do I code a bag of jelly beans? let's say there are 30 jelly
> beans in a small paper sack, and they are edible. How would I do
> this?

Doctor Who eats jelly babies, not jelly beans. See chapter 21 of the
Designer's Manual for an explanation of the `parse_name' routine.

Class JellyBabyClass
has edible
with short_name "jelly baby",
plural "jelly babies",
parse_name [ w n;
if (parser_action == ##TheSame) return -1;
do {
w = NextWord();
n++;
if (w == 'babies') parser_action == ##PluralFound;
} until (w ~= 'babies' or 'baby' or 'jelly');
return n - 1;
];

Object PaperSack "paper sack"
has container open
with capacity 30,
name "paper" "sack",
before [;
Receive:
if (noun.short_name ~= Jelly1.short_name)
"Suitably witty remark for trying to put something \
that isn't a jelly baby into a paper bag intended \
for keeping jelly babies, assuming you don't want \
the player to use the small paper sack as a handy \
rucksack.";
];

Nearby Jelly1 "j1" class JellyBabyClass;
Nearby Jelly2 "j2" class JellyBabyClass;
...
Nearby Jelly30 "j30" class JellyBabyClass;

> God knows how I'm going to code the Tardis console. I guess I'm going
> to need a "set" verb for commands like "set coordinates for
> <location>". I just now dived into this "Inform" stuff, having read
> the incomprehensible "Designer's guide" and the two tutorials
> available, I'm still confused as heck. Not being a programmer at all,
> a lot of the stuff in the designer's guide was kind of like greek

Take a look at exercise 30 in the Designer's Manual, which describes how
to construct the computer "Zen" from the 1970s BBC TV series "Blake's
Seven". That should give you a start when it comes to designing the
TARDIS. If you continue to have trouble, ask some more questions in
rec.arts.int-fiction (put `[Inform]' or `Inform:' in the subject line).

-- 
Gareth Rees