[INFORM] Microwave

3 views
Skip to first unread message

Hobbes1683

unread,
Oct 10, 1998, 3:00:00 AM10/10/98
to

Hi,

I'm trying to create the following:

A microwave that...
has a description depending on whether it is closed or open.
can be Switched On - displaying a message (not a swithable object though)
if an object is inside, a different message will display
if a particular object (like some food) is inside - it becomes cooked.

This is the code I have so far but, unfortunately, it doesn't work:

Object micro "microwave" Kitchen
with name "micro" "microwave",
description [; if (self hasnt open) "A lovely machine that reduces
cooking time to a matter of seconds. It's closed."; "A lovely machine that
reduces cooking time to a matter of seconds. It's open."; ],
before
[; SwitchOn: if (self has noun) "It's not a good idea with ", (the)
noun, "in there!"; SwitchOn: if (self hasnt open) "A light comes on inside and
the microwave begins to start cooking. A few seconds later, it turns off with a
~DING!~."; "The microwave must be closed before you can turn it on.";
SwitchOff: "It is off.";],
has scenery container openable;

Notice that it's not a switchable item - i want it just to be said as being on
and then turning off automatically but with the relevant message.

From
Chris H

Aris Katsaris

unread,
Oct 10, 1998, 3:00:00 AM10/10/98
to

Hobbes1683 wrote in message <19981010094051...@ng44.aol.com>...

<snip>

>This is the code I have so far but, unfortunately, it doesn't work:

<snip>

> before
> [; SwitchOn: if (self has noun) "It's not a good idea with ", (the)
>noun, "in there!"; SwitchOn: if (self hasnt open) "A light comes on inside
and
>the microwave begins to start cooking. A few seconds later, it turns off
with a
>~DING!~."; "The microwave must be closed before you can turn it on.";
>SwitchOff: "It is off.";],
> has scenery container openable;


Your problem is with 'self has noun'. That makes absolutely no sense. Has
checks the
value of a specific attribute: You used it correctly only in (self hasnt
open). 'Noun' should
also not be there. It would always have the value microwave, and the
resulting command would be the equivalent of 'if (microwave has microwave)'
which of course makes no sense whatsoever. The second 'SwitchOn:' is also
redundant.

Try something like this for your 'before' routine.

!!!!!!

before
[x; SwitchOn: objectloop(x in self)
if (x hasnt edible) "It's not a good idea with ", (the) x,
"in there!";
if (self hasnt open)
if (children(self)~=0) "A light comes on inside and the microwave
begins to start cooking all edible objects within it. A few seconds later,


it turns off with a ~DING!~.";

else "There's nothing inside to cook.";


"The microwave must be closed before you can turn it on.";
SwitchOff: "It is off.";],

has container scenery openable;

!!!!!The above will cook all edible objects inside the microwave and refuse
to cook anything that's not edible.

Aris Katsaris

Schep

unread,
Oct 10, 1998, 3:00:00 AM10/10/98
to Hobbes1683
Hobbes1683 wrote:
>
> Object micro "microwave" Kitchen
> with name "micro" "microwave",
> description [; if (self hasnt open) "A lovely machine that reduces
> cooking time to a matter of seconds. It's closed."; "A lovely machine that
> reduces cooking time to a matter of seconds. It's open."; ],

This part works, right? Note that you could also give it a mention in
the room listing (Look) using when_open and when_closed strings.

> before
> [; SwitchOn: if (self has noun) <snip> ],

> has scenery container openable;

It's not clear what you intended by (self has noun), which won't work.
[self = micro and noun = micro because noun means the object parsed.
'has' should be used for attributes.] I'm guessing you want to know
what's inside the microwave, so use child(self).

Assuming you have some object (tvdinner) the player can cook:

before [ x ;
SwitchOn:
if (self has open) "The microwave must be closed before you
can turn it on.";
if (child(self) == 0) "It's dangerous to turn on an empty
microwave.";
if (child(self) == tvdinner && sibling(tvdinner) == 0) "A
light comes on inside and etc...";
!sibling() lets us know if anything besides tvdinner is in the
! microwave.
x = child(self);
if (x == tvdinner) x=sibling(tvdinner);
"That's not a good idea with ", (the) x, "in there!";
!In case the player put in the dinner and something else,
!the game will only complain about the second object.


SwitchOff: "It is off."; ],

HTH.
--
Schep -----------------------------------------------------
Reply by email should be schepler at pilot dot msu dot edu.
The other automatic one is an anti-spam device.
Nothing against the meat. (yes, spam contains meat)

Branko Collin

unread,
Oct 10, 1998, 3:00:00 AM10/10/98
to
On 10 Oct 1998 13:40:51 GMT, hobbe...@aol.com (Hobbes1683) wrote:

>A microwave that...
> has a description depending on whether it is closed or open.
> can be Switched On - displaying a message (not a swithable object though)
> if an object is inside, a different message will display
> if a particular object (like some food) is inside - it becomes cooked.
>

>This is the code I have so far but, unfortunately, it doesn't work:

[code snipped]

I seem to remember a game with a microwave or oven in it. Maybe
competition two years ago? Or an Infocom game?

If someone can help pinpoint the game, you could contact the author.

--
branko collin, bco...@xs4all.nl
a a de de de de een het the the the
(various artists, gesorteerd op alfabetische
volgorde)

Mark J Musante

unread,
Oct 10, 1998, 3:00:00 AM10/10/98
to
Branko Collin (col...@xs4all.nl) wrote:
> I seem to remember a game with a microwave or oven in it. Maybe
> competition two years ago? Or an Infocom game?

The Lurking Horror.


-=- Mark -=-

Jonadab the Unsightly One

unread,
Oct 10, 1998, 3:00:00 AM10/10/98
to

Hobbes1683 <hobbe...@aol.com> wrote in article

> I'm trying to create the following:

[Straightforward English description of a simple nuker snipped.]

> This is the code I have so far but, unfortunately, it doesn't
work:
>

> Object micro "microwave" Kitchen
> with name "micro" "microwave",
> description [; if (self hasnt open) "A lovely machine
that reduces
> cooking time to a matter of seconds. It's closed."; "A lovely
machine that
> reduces cooking time to a matter of seconds. It's open."; ],

> before
> [; SwitchOn: if (self has noun) "It's not a good idea with
", (the)

You have an attribute named noun?

More likely you want the following:
with before
[ i;
SwitchOn:
i = child(self);
if (i==0) "Never operate an empty microwave! It'll give you an \
Object 0 error!";
if (i hasnt edible)
{ print "It's not a good idea to cook "; DefArt(i); "."; }
if (self has open)
{ print "(First closing the microwave oven.)^"; give self
~open; }
give i general; ! for food items, then, general means cooked.
! If you're alread using general for something else
! then you'd want to use a different attribute for cooked.
print "A light comes on inside and "; DefArt(i); print " begins to
slowly turn around inside. After a few seconds you hear
three loud beeps and the light goes off.";

-- jonadab

(email the above name at bright.net)

TenthStone

unread,
Oct 11, 1998, 3:00:00 AM10/11/98
to
olo...@world.std.com (Mark J Musante) caused this to appear in our
collective minds on Sat, 10 Oct 1998 22:26:44 GMT:

Sins Against Mimesis, as well. Although the scope was more limited
therein out of of the small nature of the game itself.

-----------

The imperturbable TenthStone
tenth...@hotmail.com mcc...@erols.com mcc...@gsgis.k12.va.us

Adam J. Thornton

unread,
Oct 11, 1998, 3:00:00 AM10/11/98
to
In article <362042a0...@news.erols.com>,

TenthStone <mcc...@erols.com> wrote:
>olo...@world.std.com (Mark J Musante) caused this to appear in our
>collective minds on Sat, 10 Oct 1998 22:26:44 GMT:
>>Branko Collin (col...@xs4all.nl) wrote:
>>> I seem to remember a game with a microwave or oven in it. Maybe
>>> competition two years ago? Or an Infocom game?
>>The Lurking Horror.
>Sins Against Mimesis, as well. Although the scope was more limited
>therein out of of the small nature of the game itself.

I also asked for Microwave Sample Code and was referred to C.E. Forman's
_Delusions_. I can't remember if he made the source public or not, though.
So I ended up with a one-button microwave.

It wouldn't be hard to make a better microwave, just a little tedious.

Adam
--
ad...@princeton.edu
"There's a border to somewhere waiting, and a tank full of time." - J. Steinman

Jonadab the Unsightly One

unread,
Oct 11, 1998, 3:00:00 AM10/11/98
to


Mark J Musante <olo...@world.std.com> wrote in article
<F0MuC...@world.std.com>...


> Branko Collin (col...@xs4all.nl) wrote:
> > I seem to remember a game with a microwave or oven in it. Maybe
> > competition two years ago? Or an Infocom game?
>
> The Lurking Horror.

Delusions had a microwave, too.

There was an oven in Enchanter, but it wasn't really a working oven.

david...@hotmail.com

unread,
Oct 13, 1998, 3:00:00 AM10/13/98
to

> It wouldn't be hard to make a better microwave, just a little tedious.

I once recoded the microwave from Lurking Horror, basically just reverse
engineered it's behaviour. I still should have the source lying around here.
If anybody wants it, email me (david...@hotmail.com) and I'll try to dig
it up. I remember I used a dummy object for the different states of the
microwave, probably not the most clever implementation, but as far as I
recall it worked.. well, l8er

David

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

Reply all
Reply to author
Forward
0 new messages