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

[INFORM] Elevator

3 views
Skip to first unread message

Joe Merical

unread,
Jul 31, 1999, 3:00:00 AM7/31/99
to
I need to implement an elevator that needs to go to six different floors. I
just can't figure out the best and quickest way to do this. I've tried to
adapt elevator.inf to my game, but it's too complex for someone like me to
do. Any help is appreciated.

- Joe M.


-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----

jdb...@my-deja.com

unread,
Aug 3, 1999, 3:00:00 AM8/3/99
to
In article <37a3...@news5.newsfeeds.com>,

"Joe Merical" <jmer...@citynet.net> wrote:
> I need to implement an elevator that needs to go to six different
floors. I
> just can't figure out the best and quickest way to do this. I've
tried to
> adapt elevator.inf to my game, but it's too complex for someone like
me to
> do. Any help is appreciated.

Forgive this unthought through shell of a hack, but I think it would
work with a little(?) tinkering:

Set a global variable ELEVATOR_ON_FLOOR_NUMBER = 1 (or whatever)

In a before[], check for the push (button) command, get the number
pushed and assign it to ELEVATOR_ON_FLOOR_NUMBER.

In a s_to[] (or whatever direction), use the switch command with
ELEVATOR_ON_FLOOR_NUMBER and return whatever room location is
accessible from that floor.

ex.
s_to [; switch(ELEVATOR_ON_FLOOR_NUMBER)
{
1: return basement;
2: return foyer;
3: return balcony_above_foyer;
4: return chimera_lair;
5: return connie_chungs_dressing_room;
6: if (self has coolness)
return fonzies_garage;
else
{
print "~Hey, nerd, beat it.~ You return to the \
5th floor in fear \
of getting a knuckle sandwich.";
return connie_chungs_dressing_room;
}
}
],


I wouldn't worry about a door unless you need it as part of a
specific sequence (the door closing just in time to keep out the
bad guy). Even then just supply the narrative and assume the
player knows how an elevator door works. Otherwise it's just a
nuisance for you and the player.

But now you're really getting opinions ;-)

Jimbo


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Alan Trewartha

unread,
Aug 3, 1999, 3:00:00 AM8/3/99
to
In article <7o75an$nf9$1...@nnrp1.deja.com>, <URL:mailto:jdb...@my-deja.com>
wrote:

> Set a global variable ELEVATOR_ON_FLOOR_NUMBER = 1 (or whatever)

Or just use the elevator object's number property.

> s_to [; switch(ELEVATOR_ON_FLOOR_NUMBER)

switch(self.number)

> {
> 1: return basement;
> 2: return foyer;
> 3: return balcony_above_foyer;

--
Mail to alant instead of no.spam


Neil Cerutti

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Call me a honger, but I'd just create, for a 6 story building, 6
different elevator class objects, one on each floor. You push the
button to start the daemon that calls the routine that calls PlayerTo
then moves the objects to the elevator-class room that's contained in
the house that Jack built.

--
Neil Cerutti (ne...@norwich.edu)
"If anything could make me agree with Plato's vision
of Utopia, it is Aristotle's arguments against it."
-- Bertrand Russell

Andrew Plotkin

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Neil Cerutti <ne...@norwich.edu> wrote:
> Call me a honger, but I'd just create, for a 6 story building, 6
> different elevator class objects, one on each floor. You push the
> button to start the daemon that calls the routine that calls PlayerTo
> then moves the objects to the elevator-class room that's contained in
> the house that Jack built.

You're a honger. A single dynamic exit-routine is a lot easier to get
right than a bunch of object movement. At least for me.

--Z (what's a honger?)

"And Aholibamah bare Jeush, and Jaalam, and Korah: these were the
borogoves..."

Ross Presser

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
alt.distingui...@netcom.com (Andrew
Plotkin).wrote.posted.offered:

What do you do when you have 343,216 floors for your elevator? (Besides
cry, that is.)

Andrew Plotkin

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Ross Presser <ross_p...@nospamimtek.com> wrote:
> alt.distingui...@netcom.com (Andrew
> Plotkin).wrote.posted.offered:
>
>>Neil Cerutti <ne...@norwich.edu> wrote:
>>> Call me a honger, but I'd just create, for a 6 story building, 6
>>> different elevator class objects, one on each floor. You push the
>>> button to start the daemon that calls the routine that calls PlayerTo
>>> then moves the objects to the elevator-class room that's contained in
>>> the house that Jack built.
>>
>>You're a honger. A single dynamic exit-routine is a lot easier to get
>>right than a bunch of object movement. At least for me.
>>
>>--Z (what's a honger?)
>
> What do you do when you have 343,216 floors for your elevator? (Besides
> cry, that is.)

Well, the Z-machine can't handle that many objects, but if you mean "a lot
of floors", I basically have an array

Array floor_lobbies --> Lobby1 Lobby2 Lobby3 [...];

and the exit routine tests (floor_lobbies-->current_floor).

--Z

Gareth Rees

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Ross Presser <ross_p...@NOSPAMimtek.com> wrote:
> What do you do when you have 343,216 floors for your elevator?

If you have many floors, interesting things aren't happening on very
many of the floors, so you can reuse objects to give the illusion of
space. See http://www.deja.com/getdoc.xp?AN=424526118&fmt=text

--
Gareth Rees

Neil Cerutti

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
In article <7o9i7e$j...@dfw-ixnews17.ix.netcom.com>, Andrew Plotkin

<erky...@netcom.com> wrote:
> Neil Cerutti <ne...@norwich.edu> wrote:
> > Call me a honger, but I'd just create, for a 6 story building,
> > 6 different elevator class objects, one on each floor. You
> > push the button to start the daemon that calls the routine
> > that calls PlayerTo then moves the objects to the
> > elevator-class room that's contained in the house that Jack
> > built.
>
> You're a honger. A single dynamic exit-routine is a lot easier
> to get right than a bunch of object movement.

Yeah, I guess. But I didn't wanna suggest the same 'ol
solution. Mine is better, because it "sucks". Also, it is more
object-oriented since it requires more objects. ;-)

> --Z (what's a honger?)

honger n. (pronounced HONgger) -- A person acting like a dork
in a unique, and often mildly annoying, way. For example, while
riding in the back seat of a car a honger would remove the
head-reast and put it back in backwards.

As far as I know, me and my tiny D&D gaming group are the only
ones who use this word. That made it an excellent candidate
for cryptic net use. Here's another:

skrote n. -- An inconsiderate person.

These words were invented to describe various M.U.L.E. playing
styles. A honger would go around marking plots for sale and
then raise the price so that nobody could buy them. A skrote
might hoard energy, thus "skronggling" the whole colony.

I often find it amusing to be a honger, but never a skrote.
My code is often skronggled.

Philip W. Darnowsky

unread,
Aug 4, 1999, 3:00:00 AM8/4/99
to
Neil Cerutti (ne...@norwich.edu) wrote:
: Call me a honger, but I'd just create, for a 6 story building, 6
: different elevator class objects, one on each floor. You push the
: button to start the daemon that calls the routine that calls PlayerTo
: then moves the objects to the elevator-class room that's contained in
: the house that Jack built.

What's wrong with just having a property called, say, "floor", and having
the number of the current floor stored in that? Then, when the player
exits the elevator, just switch on that and return the appropriate
location. You honger.

--
----------------------------------------------------
Phil Darnowsky pdar...@spameggsbaconandspam.qis.net
Remove spam, eggs, bacon, spam, and dot to reply.

The human brain is a remarkable organ: it begins
working the moment you wake up, and does not stop
until you get to the office.

Marnie Parker

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
I have done this with TWO numbers, one for the floor (number) and one for the
elevator (cur_floor).

The elevator buttons (1-6 or whatever) set the elevator.cur_floor, ++ or -- a
counter for each turn of the elevator daemon (starting it at
elevator.cur_floor) when the elevator.cur_floor == floor.number then the doors
open. That is a very brief summary.

Doe :-)


-----------------------------
doea...@aol.com
The Doepage - http://members.aol.com/doepage/index.htm
IF Art Gallery - http://members.aol.com/iffyart/gallery.htm
"I can live for two months on a good compliment." Mark Twain

Nick Sonneveld

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
On 05 Aug 1999 06:56:25 GMT, doea...@aol.com (Marnie Parker) wrote:

>Doe :-)

a deer... a female deer.

- Nick

TenthStone

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
On Wed, 4 Aug 1999 15:31:13 GMT, Gareth Rees <gar...@cre.canon.co.uk>
wrote:

Just to be a pissant, I'll note that dropping an object on floor 172
shouldn't make that object suddenly, magically appear on floors 3-65
and floors 66-194 as well, unless you want to make it a magical hotel
which instead of consuming random objects replicates them so that
everyone has them. Or maybe it has those science-museum mirrors
which make everything within the triangle appear in infinite quantity
all around the room.

The best way I can think of accomplishing this would be to... no, I
can't think of any particularly good way of accomplishing this.
Noting a floor number on the dropped object, maybe, but that would
play hell with contents lists.

Of course, you could always have a hotel cleaning staff which zooms by
and puts everything in the Lost and Found instantaneously, but realism
problems arise.

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

Daniel Schepler

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
I don't see what would be so hard about it. The code would probably
look something like (completely untested):

Constant MAX_DROPPED_ITEMS = 50;

Global num_dropped_items;
Array dropped_items --> (2 * MAX_DROPPED_ITEMS);

[ InsertDroppedItem obj floor;
dropped_items-->(num_dropped_items * 2) = obj;
dropped_items-->(num_dropped_items * 2 + 1) = floor;
num_dropped_items = num_dropped_items + 2;
];

[ RemoveDroppedItem obj i;
for (i = 0 : i < 2 * num_dropped_items : i = i + 2)
if (dropped_items-->i == obj)
break;
if (i == 2 * num_dropped_items)
"** Programming error: no floor for ", (object) obj, " **^";
dropped_items-->i = dropped_items-->(num_dropped_items - 2);
dropped_items-->(i + 1) = dropped_items-->(num_dropped_items - 1);
num_dropped_items = num_dropped_items - 2;
];

[ MoveDroppedItems floor i;
for (i = 0 : i < 2 * num_dropped_items : i = i + 2) {
if (dropped_items-->(i + 1) == floor)
move (dropped_items-->i) to FakeFloors;
else
remove (dropped_items-->i);
}
];

Object FakeFloors
with number 0, ! For storing the current floor number
short_name [;
print "Floor ", self.number;
rtrue;
],
description "...",
after [;
Go:
MoveDroppedItems(self.number);
Drop:
InsertDroppedItem(noun, self.number);
],
before [;
Drop:
if (num_dropped_items == MAX_DROPPED_ITEMS)
"Perhaps you should stop littering in the hotel.";
Take:
if (noun in self)
RemoveDroppedItem(noun);
],
d_to [;
if (self.number == 2)
return Lobby;
else {
(self.number)--;
return self;
}
],
u_to [;
if (self.number < 200) {
(self.number)++;
return self;
}
else
"The stairs go no higher.";
],
has light;

Hmm, you'd probably want to update the 'objects' code also, or just
disable it. It also might or might not be a good idea to do something
about the 'visited' attribute...
--
Daniel Schepler "Please don't disillusion me. I
sche...@math.berkeley.edu haven't had breakfast yet."
-- Orson Scott Card

TenthStone

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
On 06 Aug 1999 00:08:52 -0700, Daniel Schepler
<dan...@frobnitz.hip.berkeley.edu> wrote:

>I don't see what would be so hard about it. The code would probably
>look something like (completely untested):

Okay...

>Constant MAX_DROPPED_ITEMS = 50;
>
>Global num_dropped_items;
>Array dropped_items --> (2 * MAX_DROPPED_ITEMS);
>
>[ InsertDroppedItem obj floor;
> dropped_items-->(num_dropped_items * 2) = obj;
> dropped_items-->(num_dropped_items * 2 + 1) = floor;
> num_dropped_items = num_dropped_items + 2;
>];

I think that last line should end "+ 1;", since you're multiplying
by 2 already.

Alright. So we're using an array for this, storing dropped objects
in an array, format [ object floornumber object floornumber etc. ]
And we're doing this after the object has been dropped in the
room, and preventing more than 50 objects from being dropped
so we won't have any problems with array length. Fair enough.

I presume Drop goes ahead and places the object in the
inventory of the room...

>[ RemoveDroppedItem obj i;
> for (i = 0 : i < 2 * num_dropped_items : i = i + 2)
> if (dropped_items-->i == obj)
> break;
> if (i == 2 * num_dropped_items)
> "** Programming error: no floor for ", (object) obj, " **^";
> dropped_items-->i = dropped_items-->(num_dropped_items - 2);
> dropped_items-->(i + 1) = dropped_items-->(num_dropped_items - 1);
> num_dropped_items = num_dropped_items - 2;
>];

Okay, it searches through the array until it finds the right object,
and then breaks from the loop. The next line catches the case of the
array having been completely searched without the object having been
found, and then (I guess) somehow ends the function. So far, so good.

Now you copy the entries for the last object in the array over the
entries for the object being removed (assuming that those should be
2 * num_dropped_items) and decrement num_dropped_items (it should
be a single decrement, I think, not a double). This doesn't do
anything if num_dropped_items is 1, but that's not a problem since
it doesn't make an error.

Anyway, this is a good way of doing it. In TADS, I'd be inclined to
put an attribute on the object (or maybe just generate new floors),
but I don't know what that involves in Inform...

Alan Trewartha

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
In article <si3dxz3...@cre.canon.co.uk>, Gareth Rees

<URL:mailto:gar...@cre.canon.co.uk> wrote:
> Ross Presser <ross_p...@NOSPAMimtek.com> wrote:
> > What do you do when you have 343,216 floors for your elevator?
>
> If you have many floors, interesting things aren't happening on very
> many of the floors, so you can reuse objects to give the illusion of
> space. See http://www.deja.com/getdoc.xp?AN=424526118&fmt=text
>

"Snowball 9" anyone? I loved that game. It was a marketing tag that the
game contained over 10000 locations or something.

0 new messages