Finding the current room?

Stupid question, really, but my google-fu fails me and nothing I’ve tried works out:

How do I refer to the room currently occupied by the player? What I’m trying to do now is something like this:

The home is a room that varies.

and further down, letting the player designate a home:

Carry out settling: now the home is the current room.

Inform doesn’t accept “the current room” as an input, and I can’t seem to figure out what else is supposed to go there. I’m sure it’s something blindingly obvious…

Inform calls the current room “the location”.

Thank you!

Note that this is short for “the location of the player”; “the location of [any thing]” returns the room that thing is in.

But “The location” can also be a container or supporter, right? What’s the phrase for getting the room again?

No, “the location” is always the room. Testing for “in” gives the direct container so the gotcha is when you have something like “if the player is in the lounge” which is not true if the player is for example sitting on a chair in the lounge. (Which leads to curiosities like “if the player is in the location of the player” not being always true.)

No, “the location” and “the location of X” are always rooms.

(Unless X is off-stage, and then I forget what happens. Probably evaluates to “nothing”.)

The “holder of X” is the room or container or supporter or person that it’s in, or the thing that it’s a part of.

That’s not quite true, as “the location” is a variable that is updated when going and “the location of the player” is a phrase that calls an I6 function that calculates the location of the player on the fly. In some cases, “the location” and “the location of the player” can mismatch, like so.


A persuasion rule: persuasion succeeds.

Every turn (this is the display location variables rule):
say “[The location] -> The location.[line break][The location of the player] -> The location of the player.”.

First Room is west of Second Room. Second Room is north of Third Room. Third Room is east of Fourth Room. Fourth Room is south of First Room.

Clark Gable is a person in the first room. The cage is in the first room. The cage is an enterable, pushable between rooms container. The automobile is in the first room. The automobile is a transparent vehicle.

Test me with “get in cage / clark, get in automobile / clark, push cage east / clark, push cage south / clark, push cage west / clark, push cage north”.[/code]

For this reason, it is recommended to use “the location of the player” rather than “the location” when the location of the player is needed.

Hope this helps.

Hrmph … Guess that qualifies as a bug.

Yes, it’s filed. (604.)

You can use this as a temporary fix for the mismatch.

Carry out an actor going (this is the update player movement rule): if the location is not the location of the player begin; now the location is the location of the player; surreptitiously reckon darkness; update backdrop positions; end if.

Hope this helps.

That’s interesting. I can see the reason for this. I don’t think it’s a bug and see a reason to change the behavior if people knows it does this.

If I have an object called the foo, can I specify “the location of the foo” or can I also do this with an NPC? And again, does this call a function on the fly? Does each object have a location variable or does “the location” only exist for the player?

Can I move an object this way, such as “the location of the foo is now the Beautiful Room.” ?

It’s clearly a bug in the sample code that climbingstars cited. You wind up with the player in the cage and the cage in SecondRoom, but the location variable is stuck as FirstRoom.

Yes. This is all laid out in the Phrasebook Index tab, by the way.

It is a phrase, that is, a function. Takes an object, returns a room.

“The location” is a global variable, and, as such, is global. :slight_smile: There’s only one.