Room compile error - TADS3

What’s wrong with this picture? I’m starting to put together my TADS3 game and I’m getting a compile error that I can’t understand. Heres the code:

#charset “us-ascii”

/*******************************************************************************

  • Copyright © 1999, 2002 by Michael J. Roberts. Permission is granted
  • to anyone to copy and use this file for any purpose.
    *******************************************************************************/

/* Includes ** Adds source files and sets language. **************************/

#include <adv3.h>
#include <en_us.h>

/*******************************************************************************

  • User-Defined Classes.
    *******************************************************************************/

class DynamicTravelMessage: TravelMessage
travelDesc()
{
if(!destination.seen) //Our destination isn’t seen.
return firstTravelDesc;
else //It is seen.
return secondTravelDesc;
}
;

/*******************************************************************************

  • Templates
    *******************************************************************************/

DynamicTravelMessage template
->destination
“firstTravelDesc”
“secondTravelDesc”;

/*******************************************************************************

  • Modifications
    *******************************************************************************/

modify Lockable
replace examineStatus()
{
/* Inherit the default handling. /
inherited();
/
If our lock status is visually apparent, and we want to mention the

  • lock status in our current state, show the lock status. */
    if(lockStatusObvious&&lockStatusReportable)
    say(isLocked?currentlyLockedMsg:currentlyUnlockedMsg);
    }
    currentlyLockedMsg=(gLibMessages.currentlyLocked)
    currentlyUnlockedMsg=(gLibMessages.currentlyUnlocked)
    ;

replace VerbRule(Drink)
(‘drink’|‘quaff’|‘imbibe’|‘sip’|‘gulp’|‘swallow’)dobjList
:smiley:rinkAction
verbPhrase=‘drink/drinking(what)’
;

replace VerbRule(AttachTo)
(‘attach’|‘connect’|‘hook’|‘fasten’)dobjList’to’singleIobj
:AttachToAction
askIobjResponseProd=toSingleNoun
verbPhrase=‘attach/attaching(what)(to what)’
;

modify grammar predicate(Take):
(‘take’|‘pick’ ‘up’|‘get’|‘grab’|‘handle’|‘lift’)
dobjList
|‘pick’dobjList’up’:
verbPhrase=‘take/taking(what)’
;

modify Room
desc()
{
/Has the room been seen before?/
if (!seen)
return(roomFirstDesc);
else
return(shortDesc);
}
;

The error is on the return(shortDesc); line and is stated as the “shortDesc” is undefined. I am only providing the code down to the error. Could I be missing something further on that is the cause of this error?

RonG

You are getting that message because shortDesc is undefined. :slight_smile: It’s not defined anywhere in adv3 and you haven’t declared it as a property on any object or class.

At a minimum, you need to do something like this, somewhere:

foo: Object
    shortDesc = nil
;

(Defining a property anywhere defines it everywhere.)

However, for this specific effect, you can put your short description in desc (as a dquote or function) and your first description in roomFirstDesc (as another dquote or function).

Like:

myRoom: Room 'ROOM'
    "This is my short description for subsequent visits. "
    roomFirstDesc = "This is the longer description for the first visit. "
;

Thanks again for your help. Once I got my first room installed, It has helped things to start falling into place. Now I can move onward and upward. The whole TADS3 thing is getting progressively easier as I struggle along.

RonG

The first time I tried to learn T3, I got more and more frustrated and eventually gave up. The problem was, I was trying to do complicated stuff before I learned to do simple stuff.

The second time, I got much more methodical, and the fog gradually cleared. It does get progressively easier. Even so, I sometimes found myself crying, “Classes and templates and macros, oh my!”