Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inform 7 5Z71: How to suppress message of device being switched on?

11 views
Skip to first unread message

Biagio

unread,
Dec 24, 2009, 3:25:00 AM12/24/09
to
I have a radio which needs a battery to run. Only problem, if the
radio is left switched on and the battery is removed, the game still
reports the radio as "switched on." I'd like to either have it not do
that, or create a custom message like "Although switched on, the
radio's useless without a battery."

Searched through the manual but haven't been able to figure this one
out.

TIA!
Biagio

Al

unread,
Dec 24, 2009, 10:07:25 AM12/24/09
to
On Dec 24, 1:25 am, Biagio <biagio...@gmail.com> wrote:
> I have a radio which needs a battery to run.  Only problem, if the
> radio is left switched on and the battery is removed, the game still
> reports the radio as "switched on." I'd like to either have it not do
> that, or create a custom message like "Although switched on, the
> radio's useless without a battery."
>

This should do the trick for you:

<code>

"Radio Test"

after printing the name of an open container:
omit contents in listing.

Living Room is a room.

a supporter called a table is scenery in Living Room.

an open container called a radio is in Living Room.
"Your battery-operated radio sits on a table in the corner.".
the description is "The radio is switched [if radio is on]on
[otherwise]off.[end if]"

the radio is either on or off.
the radio is off.

a battery is in the radio.

instead of switching on the radio:
if the battery is in the radio begin;
now the radio is on;
say "You switch on the radio and it begins playing music from a pop
station.";
otherwise;
say "The radio has no battery in it so it remains silent.";
end if.

instead of switching off the radio:
if the radio is on and the battery is in the radio begin;
say "The radio goes silent.";
now the radio is off;
otherwise;
say "The radio is already off.";
end if.

instead of taking the battery when the radio is on:
now the battery is carried by the player;
say "You remove the battery from the radio and it goes silent.";

instead of taking the battery when the radio is off:
now the battery is carried by the player;
say "You remove the battery from the radio.".

instead of inserting the battery into the radio:
now the battery is in the radio;
if the radio is on begin;
say "You replace the battery back in the radio and it resumes
playing.";
otherwise;
say " You replace the battery back in the radio.";
end if.

<code>

Biagio

unread,
Dec 24, 2009, 6:13:20 PM12/24/09
to
Thanks so much for this kind holiday gift! Very helpful. Think what
I'll do is create a class of open container called "gadget" so that my
other open containers in the game still behave as expected.

It is interesting, though: I'd wondered if I simply had to avoid the
built in "device" and create an object that acted like a device minus
the reporting. Funny that there doesn't seem to be a way to just not
report the switched state of a standard device.

In any case, I assume creating an object from scratch, as you've done
above, will always be the most flexible approach, correct?

Thanks again!
Biagio

0 new messages