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

I7: The example elevator and- [actor] goes inside

9 views
Skip to first unread message

weevil

unread,
Dec 18, 2009, 2:44:00 PM12/18/09
to
I'm using the elevator example in the Inform 7 manual, and it has the
annoying problem that when another actor other than the player enters
or exits the elevator, it's reported as.

Joe goes inside.

There's a similarly cryptic message for an actor exiting, but I don't
remember what it is offhand.

Is anybody familiar with the elevator example (example 256: Dubai) and
know how I can change the statements to a more descriptive "Joe enters
the elevator"? I've tried a bunch of different methods and all seem to
be ignored.

Mike C

unread,
Dec 19, 2009, 3:49:25 AM12/19/09
to

Not fully tested but you need a report rule for Joe going. Something
along the following lines:

<code>
Report Joe going:
if the location of Joe is the location of the player:
say "Joe arrives in [the location of the player].";
otherwise:
say "Joe leaves [the location of the player].";
stop the action.
</code>

The stop the action line is to prevent the stock phrase being printed
after the custom message.

weevil

unread,
Dec 19, 2009, 5:28:43 PM12/19/09
to
Joe is a stand in for anyone.. I tried to do a report someone exiting
from inside the lift rule, but it seemed to get ignored.

I think your example is too general to use in this case since "joe
leaves the room" doesn't communicate "joe gets in the elevator" which
is inside the room.

Thank you for your suggestion, however.

I can paste the example code in here with a couple of wandering actors
if nobody wants to find it in the manual...

Erik Temple

unread,
Dec 19, 2009, 6:22:44 PM12/19/09
to
It's probably a good idea, in general, to paste the code that you've
tried, if not a complete example. The problem is very often a use of
syntax and easily diagnosed. (Sometimes people will just code up a
solution for you in the absence of any of that, but you have to get
lucky--the problem has to be something they see as interesting or fun!)

I'm going to bet that you are hitting a fairly common issue with the going
action, which is that, by the time you get to the report phase, the actor
has already been moved, and therefore you can't test the same conditions
that you were able to use in the before, instead, and carry out phases.
Does your report rule depend on a condition that is no longer true once
the actor has moved? Since you say that the elevator is inside the room
gone from, my guess is that you are testing whether the actor is going
inside from a place where the elevator is, something like "Report Joe
going inside in the presence of the elevator". You'll want to find another
condition that will work when Joe is no longer in the presence of the
elevator (again, assuming that the elevator you're referring to is a kind
of dummy object in the room).

--Erik


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Lorne

unread,
Dec 20, 2009, 6:14:03 AM12/20/09
to
On 19 Dec, 23:28, weevil <wileywg...@gmail.com> wrote:
> Joe is a stand in for anyone.. I tried to do a report someone exiting
> from inside the lift rule, but it seemed to get ignored.
>
> I think your example is too general to use in this case since "joe
> leaves the room" doesn't communicate "joe gets in the elevator" which
> is inside the room.
>
> Thank you for your suggestion, however.
>
> I can paste the example code in here with a couple of wandering actors
> if nobody wants to find it in the manual...

I would do it like this:
Report someone going to the lift: say "[The actor] enters the
elevator." instead.
Report someone going from the lift: say "[The actor] exits the
elevator." instead.

weevil

unread,
Dec 20, 2009, 1:54:16 PM12/20/09
to
Ah, I hadn't added 'instead' to my rules... maybe that will fix it.

weevil

unread,
Dec 20, 2009, 2:05:10 PM12/20/09
to
Interesting, now it's printing:

Mahatma Gandhi enters the elevator.

Mahatma Gandhi goes inside

I'll paste my code in the group, but I have to cut it off from the
rest of the game and the functioning extensions, so it will take a
little bit.


On Dec 20, 5:14 am, Lorne <lor...@tempinbox.com> wrote:

weevil

unread,
Dec 20, 2009, 2:36:15 PM12/20/09
to
So, when I was packaging up the elevator code, I replaced my npc's
that were using the patrollers extension with 'artemis' the wanders-
every-turn npc example from the manual. That piece of code shows the
much more acceptable 'Artemis heads to the lift.' and 'Artemis arrives
from the lift.'
So I am assuming it's some interaction between the patrollers
extension and the elevator code.

Here's the elevator code, with both the wandering-every-turn npc and
the patrollers-extension enabled npc, so you can see the differences
in their reports. Dropping the patrollers extension isn't a good
solution for me because my game depends on it heavily.

<code>

"elevator test" by Wiley Wiggins

Include Patrollers by Michael Callaghan.

first floor is a room.
second floor is a room.
third floor is a room.

section e - the elevator

Table of Levels
level floor
1 first floor
2 second floor
3 third floor

The elevator exterior is a backdrop. It is not scenery. The initial
appearance of the elevator exterior is "There is an open elevator door
here." It is in first floor, second floor, and third floor.
Before entering the elevator exterior, try going inside instead.
Instead of going inside in the presence of the elevator exterior:
if there is a level corresponding to a floor of the location in the
Table of Levels:
let the present level be the level corresponding to a floor of the
location in the Table of Levels;
change the current level of the Lift to the present level;
move the player to the Lift.
The description of the lift is "A panel of buttons is just low enough
for you to reach if you stand on your toes. The buttons are listed 1
(first floor) through 3 (third floor).".
The Lift has a number called current level. The current level of the
Lift is 1. Instead of going up in the Lift: say "You'll have to select
a specific floor; your options range from 1 to 3." Instead of going
down in the Lift: try going up instead. First floor is outside from
the Lift.

Before going outside in the Lift:
if there is a floor corresponding to a level of the current level of
the Lift in the Table of Levels:
let the other place be the floor corresponding to a level of the
current level of the Lift in the Table of Levels;
move the player to the other place instead.

Understand "push [number]" as pressing button. Understand "push
[number] button" as pressing button. Understand "push button [number]"
as pressing button. Pressing button is an action applying to one
number.

Check pressing button:
if the player is not in the Lift, say "You cannot control the lift
unless you are yourself inside." instead;
if the number understood is the current level of the Lift, say "The
pauses and reopens its doors, since you are already on floor [number
understood]." instead;
if the number understood is greater than 3, say "There are only 3
floors." instead;
if the number understood is less than 1, say "You cannot go below the
first floor in this elevator." instead.

Carry out pressing button:
change the current level of the Lift to the number understood;
say "You press button [the number understood]. The lift whirs into
action and moves to the correct level."

Understand "leave" as exiting while player is inside the lift.

section 2 - some dudes

Artemis is a woman in first floor.
Every turn:
if Artemis is in a room (called the current space):
let next space be a random room which is adjacent to the current
space;
if Artemis is visible, say "Artemis heads to [the next space].";
move Artemis to next space;
if Artemis is visible, say "Artemis arrives from [the current
space]."

Johan is a patroller in first floor. Johan is aimless and active. The
turn frequency of Johan is 1.
</code>

Erik Temple

unread,
Dec 20, 2009, 3:07:39 PM12/20/09
to
On Sun, 20 Dec 2009 13:36:15 -0600, weevil <wiley...@gmail.com> wrote:

> So, when I was packaging up the elevator code, I replaced my npc's
> that were using the patrollers extension with 'artemis' the wanders-
> every-turn npc example from the manual. That piece of code shows the
> much more acceptable 'Artemis heads to the lift.' and 'Artemis arrives
> from the lift.'
> So I am assuming it's some interaction between the patrollers
> extension and the elevator code.
>

It's not an interaction between the elevator code and the Patrollers
extension, it's that Patrollers handles reporting of Patroller movements
using user-customizable phrases. Per the extension documentation, you'll
need to write your own phrases describing departure and arrival, e.g.:


To report departure of (Bod - a patroller) going (way - a direction) to
(place - a room):
if place is the lift and way is inside:
say "[The Bod] enters the lift.";
otherwise:
say "[The Bod] goes [way] to [place]."


--Erik

weevil

unread,
Dec 20, 2009, 10:30:23 PM12/20/09
to
That works for entering the elevator, but what about exiting, since
the place could be a number of rooms and the code only specifies where
you are going to, not from?

Erik Temple

unread,
Dec 20, 2009, 10:44:07 PM12/20/09
to

This is covered in the documentation for Patrollers. You just need to
rewrite the appropriate phrase (there are something like 5 different
phrases that may need customization) in the same way as the example I gave
for going into the elevator.

--Erik

Erik Temple

unread,
Dec 20, 2009, 10:54:59 PM12/20/09
to
On Sun, 20 Dec 2009 21:44:07 -0600, Erik Temple <ek.t...@gmail.com>
wrote:

Ah, I was assuming that you know about the "room gone from" variable,
which is set by the going action, but you probably wouldn't have asked the
question if that were the case. You should be able to test what room is
the "room gone from" in the Patroller-style phrases as well as directly in
report rules. You can see the other action variables set by going in the
Actions tab of the Index.

--Erik

weevil

unread,
Dec 20, 2009, 11:27:31 PM12/20/09
to
I should have checked the patrollers docs first. I'll take a look.

weevil

unread,
Dec 20, 2009, 11:48:26 PM12/20/09
to
I tried:
<code>
to report departure of (Bod - a patroller) going (way - a direction)
from (place - a room):
if place is the lift and way is outside:
say "[The Bod] exits the elevator.".
</code>

but it has no effect. The way an actor exits the elevator is weird
though, if you look at the code, could that be interfering with my
report rule, or did I just write it incorrectly?

On Dec 20, 9:54 pm, "Erik Temple" <ek.tem...@gmail.com> wrote:
> On Sun, 20 Dec 2009 21:44:07 -0600, Erik Temple <ek.tem...@gmail.com>  
> wrote:

0 new messages