Bit of a problem with enteringRoom(traveler)

I’d been using this quite extensively in a project where only the player character moved around, and it didn’t dawn on me how much more complicated things would get once I made somebody else move.

Long story short: my character enters room while followed by another NPC that has an AccompanyingState. When entering a room for the first time, a scene is supposed to play, and then never again. This is quite easy with a single traveller:

[code]place1: Room ‘Random Room’
“This is a place”
north = place2
;

place2: Room ‘Random Room 2’
“This is a place too!”
south = place1
enteringRoom(traveler)
{
if (sceneDone == true)
;
else
{
"Scene goes here. ";
sceneDone = true;
}
}
sceneDone = nil
;
[/code]

My problem is when I have a character following me. For some reason, having someone following me causes the event not to trigger… or perhaps trigger too many times. I notice that if I remove the line that sets sceneDone to True, the scene triggers correctly (every time I enter the room, which is not desirable). I’m guessing the NPC with accompanyingState enters the room before the PC does, causing the scene to play invisibly for the NPC, and so sceneDone is already set to True by the time my character steps inside.

…or so I’m guessing. The question would be: if I’m right about what’s causing this, is It possible to make enteringRoom(traveller) trigger ONLY when the one walking in is a specific character (the PC in this case)? Or am I getting the whole situation wrong?

Check the value of traveler, and only run the rest of your code if the traveler is the PC:

enteringRoom(traveler) { if (traveler == gPlayerChar) { // ...

…well, that makes me feel bloody stupid. Yeah, that worked just fine, thanks.

Actually, I’ve been tangling with a completely different problem for a while, so since people might still see this thread, I might as well ask:

How do I call the RESTORE option from somewhere that isn’t typing “restore” in the game or the finishOptionRestore?

One of my projects has a quite lengthy intro, so showIntro() triggers a menu with the usual “New Game - Restore - Quit” options before the intro itself. I called the RESTORE function by mangling code from the finishOptionRestore, like so:

        if (RestoreAction.askAndRestore())
        {
            ;
        }
        else
            gameStartChoice.select();    

This ALMOST works just fine. I can either restore a saved game, or not restore anything, in which case the else clause just throws you back to the menu.

But here’s one weird thing: when I restore a game from this option, the full room description is shown twice, one after the other. As if the player had typed “Look” twice. It’s not a thing with the savefile itself, since restoring it from within the game results in normal output. It’s ONLY when I restore a game from this start menu that the room description is shown twice. Any idea what’s wrong?