error: '=' is not allowed with a method definition

Hello, all. I’m using TADS3, and I’m still fairly new to it. I’m trying to create an exit to a room which is only accessible once an object in it is broken. I’ve successfully managed to send the offending object to location nil when dropped, and replace it with a broken version, but I’m having trouble making an exit open.

A tutorial (http://www.tads.org/t2doc/doc/tads-10.html) I read suggested I ought to be able to do something like this:

cave2: Room 'Dead End'
        "It appears there's no way out. You're trapped."
        north = 
        {
            if (blueMarble.location = nil)
            {
                "You step through the newly revealed exit.";
                return( cave3 );
            }
            else
            {
                return( nil );
            }
        }
     ;

But when compiling, I get the error message, “error: ‘=’ is not allowed with a method definition.” I tried using the exact code from the example (modified with my own rooms and objects, of course, to avoid referencing things that don’t exist), but got the same error.

It’s occurred to me that the tutorial was written for TADS2, and there may be differences in the way this works in TADS3. If this is the case, I’d appreciate it if someone could explain to me how to do the same thing in TADS3. If it’s just wrong, I’d be grateful for any advice about how to fix it, or what to do instead.
Thanks,
-Maika

I figured it out. It turns out, it is a difference between TADS2 and 3. The code should be:

     cave2: Room 'Dead End'
        "It appears there's no way out. You're trapped."
        north
        {
            if (blueMarble.location == nil)
            {
                "You step through the newly revealed exit.";
                return( cave3 );
            }
            else
            {
                return( nil );
            }
        }
     ;

Problem solved! Thanks anyway.

Right. You beat me to it. I was just adding that information.

I have a new problem now, though. The messages during travel are all printed 3 times. I don’t understand what’s going on.

I think it’s because simply reading your ‘north’ property as it is defined in your code will print text, even when not actually travelling (the system might call the property to just see where it leads to without actually wanting to travel there, but your implementation will print text regardless.)

Don’t print text there. Look up what the recommended way is to print travel messages (I don’t remember what it was.)

Various books and tutorials written by several fine people should have some good advise on how to do traveling:

tads.org/t3doc/doc/

In this situation, I think what you want is a TravelBarrier object. This class is described pretty well in the Tour Guide.

Thank you! That worked perfectly!