Disappearing Room Description

In my recent game Fireboat, I had a problem with disappearing room descriptions.

One “puzzle” had the player character move from a trawler back to the aft deck of the fireboat using the following segment of code:
//
give player defused;
move player to AftDeck;
//

The PC is moved to the after deck as expected. However, the AftDeck room description is not displayed until the PC is moved to another room and then back to the aftdeck.

I was unable to fix this bug and had to publish the game for Ectocomp.

Any ideas?

Thank you.

I might be completely wrong and clueless, but to me it seems obvious that you have to do something like this:

//
give player defused;
move player to AftDeck;
…show description of AftDeck…
//

You know, that might be too simple to be true…

Use PlayerTo(ROOM) when moving the player around.

ETA: (moving the player between rooms is a complicated matter. move X to doesn’t take a lot of this matter into account: that’s why you must use PlayerTo(). )

2 Likes

For complicated reasons (mostly to do with earlier versions of Inform and earlier versions of the Z-machine), the player’s location is not just stored as parent(player) but as a separate global called location. If these get out of sync, weird stuff happens.

(It’s partially because Z3 wants the location to always be stored in a global, and partially because it requires extra opcodes to look up the parent of the player compared to using a register, and partially because “I want the room the player’s in, not the object they’re in” is a very commonly-needed operation so it’s faster not to delegate it to a separate routine.)

So when moving the player, as Marco says, best to use PlayerTo(), which makes sure to keep them in sync, and also handles logistics like printing room descriptions and such.

2 Likes

PlayerTo() also recomputes light, moves floating objects into place, and does various other paperwork that you don’t want to skip.

If you want to move the player without printing a room description, call PlayerTo(dest, true).

4 Likes

I will bet PlayerTo() is the answer. I will give this a try and get back with the results.

PlayerTo() did the trick. Thank you for the help! :slight_smile:

2 Likes