T3: Changing a Direction Property at Run-Time

Depending on conditions in the game, I want to make the east property of a room either another room or a NoTravelMessage. I’ve defined a suitable NoTravelMessage object, but the code that is supposed to swap it in (or out) of the east property isn’t doing anything.

In other words, given that the room is defined with

east = otherRoom

…putting this line in my game code does nothing:

thisRoom.east = impassableConnectorObject;

Going the other direction doesn’t work either. It appears that you can’t change these properties at run-time.

One way around this is to give otherRoom suitable canTravelerPass() and explainTravelBarrier() methods – but if I do it that way, the east exit still shows up in the status line, which is not desirable at all. Can anyone suggest a way to set this up?

I also tried this:

east { if (someCondition) return impassableConnectorObject; return otherRoom; }
That didn’t work either. If the condition is true, the game reports, “Nothing obvious happens.”

Changing direction properties seems to work ok here:

firstRoom: Room {
    'first room'
    "First Room "
    south = R1;

+ me: Actor {
        if (firstRoom.south == R1)
            firstRoom.south = noTravel;
            firstRoom.south = R1;
        "Swapped. ";

R1: Room {
    'room 1'
    "Room 1"
    north = firstRoom;

X ME swaps firstRoom.south between R1 and noTravel. (“noTravel” is a pre-defined TravelConnector instance provided by adv3.) So it should work for you too :-/

Thanks for the reassurance. I’m setting up some rather complex test conditions, so it took me a while to sort it out. I think I’ve got it working now. (I hope.)

Along the way I discovered that the parser seems only to look at the first 8 letters of a word. I had defined both ‘farshore’ and ‘farshore2’ as testing commands, and the latter was getting called when I used the former, which did rather contribute to the confusion.

Can you offer any suggestions on the query I posted yesterday, about the delay in moving NPCs when the PC moves into a NestedRoom?

You can change this by overriding the default value of parserTruncLength in your gameMain object.