after move to .92 adv3Lite library, actor can no longer sit

There are couches and chairs in various locations in Harry’s world, and he’s always been able to sit in them, until now, following an update from the .91 to .92 adv3Lite library.

With the adv3Lite_0.91 library…

With the adv3Lite_0.92 library…

The only thing in the .92 changelog that looks to me like it might be related is this…

Here’s the test bed source used to generate both of the above-listed sample transcripts…

#charset "us-ascii"

#include <tads.h>
#include "advlite.h"

versionInfo: GameID
    IFID = '445C38A3-AD1B-4729-957A-F584600DE5C1'
    name = 'test'
    byline = 'by Jerry Ford'
    htmlByline = 'by <a href="mailto:jerry.o.ford@gmail.com">
                  Jerry Ford</a>'
    version = '1'
    authorEmail = 'Jerry Ford <jerry.o.ford@gmail.com>'
    desc = 'Testing sit on.'
    htmlDesc = 'Testing sit on.'

;

gameMain: GameMainDef
    /* the initial player character is 'harry' */
    initialPlayerChar = harry
    paraBrksBtwnSubcontents = nil
    usePastTense = true
    
;

// harry, main character
harry: Actor 'Harry;;man self;him' @livingRoom
    "Harry. <.p>"
    globalParamName = 'harry'
    person = 3   

    day = 1
;

livingRoom: Room 'Living Room' 'living room'
    "The living room."
;
+ couch: Thing, Fixture, Container 'couch;;sofa furnishings'
    "Once plush and brilliantly colored, the couch had seen its better days pass
    by.  Now it was threadbare and muted, its cushions somewhat lumpy. <<first
      time>>
    <.p>
    Periodically, {the subj harry}---or his son, Max, during his
    occasional visits when his mother could be persuaded to entrust him to {the
    subj harry}'s care---would scour beneath the cusions for coins and the odd
    dollar bill but the treasures were never very great, and the lastest
    excursion was too fresh for there to be any current accumulation. 
    <.p>
    {the subj harry} had joint custody of Max, but truth be told he did not
    disagree with Shirley that the {the subj harry}'s little slice of the big 
    city was no place for a rebellious 15-year-old already skirting the edges 
    of delinquency. Max was always welcome, but {the subj harry} did not raise 
    vigorous arguments when Shirley suggested father-son bonding could take 
    place just as easily in suburban Walnut Creek as it could on the gritty 
    streets of San Francisco. <<only>>"
    
    bulk = 5001
    
    canSitOnMe = true
    canLieOnMe = true
    
    dobjFor(SitIn) asDobjFor(SitOn)

    dobjFor(LookAt) asDobjFor(Examine)
    dobjFor(Examine)
    {
        action()
        {
            if(gCommand.dobjInfo.np.tokens[1].compareIgnoreCase('furnishings') ==
               0)
                "The furnishings were a mixed collection of thrift-shop
                treasures---armchair of one style, couch of another, brass lamp
                from out in left field---collected during several post-divorce
                trips to the many thrift shops in and around the city. ";
            else
                inherited;
        }
    }
;

Jerry

I don’t know how you were able to get Harry to sit on the couch before, but the reason he can’t now is that you’ve defined it as a Container, not a Platform, and a Container is something you can put things in, not on. Also, to be able to get on something you have to define isBoardable = true or else make it a Platform, as just stated.

If you change the beginning of the definition of the couch object like so:

+ couch: Platform, Fixture 'couch;;sofa furnishings'

You’ll find it works just fine.

Including Thing in the class list for the couch was redundant, since Platform, Fixture (and Container) all descend from Thing in any case.

I’m sceptical that this issue has anything to do with the change from 0.91 to 0.92, since it looks to me like the code you posted could never have worked.

Then how do you account for this…

That’s an unedited copy-and-paste from the game window when running the posted code using the .91 library.

When I swap the .92 library for the .91 library, do a full recompile, and run the same code again, he is no longer able to get on the couch.

Jerry

I got curious and tested Jerry’s example code with 0.91 version (on Linux, with frobTADS 1.2.3), and indeed I got:

	compile ../adv3Lite-0.91/actor.t -> obj/actor.t3o
t3make: tads3/tct3stm.cpp:2042: virtual void CTPNAnonFunc::gen_code(int, int): Assertion `0' failed.

It compiles and runs without any problem with 0.92 version.

Edit: It doesn’t seem to be related to Jerry’s example though, as none of the story files compiles with adv3Lite 0.91 here…

Perversely, if it worked in 0.91 then that must have been a bug in version 0.91 that got fixed as a side-effect of fixing something else (maybe related to the bit of the change log you quoted in your original post). For the reasons stated in my previous post, the code you posted shouldn’t work.

The current definition for the action-handling defined on Thing for the SitOn action is now:

[code]
dobjFor(SitOn)
{
verify()
{
if(!canSitOnMe)
illogical(cannotSitOnMsg);
else
verifyDobjBoard();

        logicalRank(sitOnScore);
    }
}[/code]

My best guess (without going back to compare with the 0.91 code which I don’t have to hand right now) is that I fixed the SitOn bug referred to in the change log by adding this:

          else
              verifyDobjBoard(); 

Since I can see how this would also have the side-effect of fixing a bug that allowed an actor to sit on something that wasn’t boardable (and thus allowed your code to work when it shouldn’t).

So, sorry for any confusion here, but it now looks to me as if the 0.92 behaviour is correct and that the 0.91 behaviour was a bug that allowed your code to work even thought it shouldn’t have! I should have pointed out in the change log that I was also fixing this bug, but I seem to have done so without realizing that it was there in the first place!

Anyway, I’m afraid you will have to change your chairs and sofas along the lines indicated in my previous post, since, as I said, your code as posted really shouldn’t work, and it seems that it was only a bug in previous versions of adv3Lite that allowed it to. I do believe the current 0.92 behaviour is correct, even though that may, I’m afraid, be a bit inconvenient for you.

EDIT: I suspect the reason this didn’t come to light before is that the library defines:

canSitOnMe = isBoardable
canStandOnMe = isBoardable
canLieOnMe = isBoardable

And so long as these definitions aren’t overridden, or only overridden to nil, the problem wouldn’t have manifested itself. The purpose of these properties is to limit what commands can be used to GET ON something, not to allow commands that otherwise wouldn’t work, and perhaps this needs to be made clearer somehow, both in the comments in the code, and perhaps in the manual. With the wisdom of hindsight it might have been better if I’d kept things simpler and just defined:

dobjFor(SitOn) asDobjFor(Board)
dobjFor(StandOn) asDobjFor(Board)
dobjFor(LieOn) asDobjFor(Board)

And had left it at that, but to revert to that now would remove functionality that’s there and risk introducing new bugs at a point where I’m trying to get to a stable 1.0 release. Perhaps what I could do for the next release is introduce a check that warns game authors if they’ve used values of canSitOnMe, isBoardable and contType that are mutually inconsistent.

In order to be able to GET ON (i.e. BOARD) something, both isBoardable must be true and contType must be On. Sitting on something is just getting on it with the additional constraint that canSitOnMe must also be true.

Done.

That would be a nice to have, but I’d be happy with clear documentation that Platform is the class to use for sit/lie capability.

I used Thing, Surface, Container and, I discovered in one of the sofas when I was retrofitting to implement your correction, even Booth because it’s what worked after considerable experimentation with various classes and canSit/Lie properties. Had I found a clear indicator in the documentation that Platform is the correct choice, I would have used it.

In any event, you have once again put me on the right track and all is working as expected once more. Thanks.

Jerry

Booth might be a viable alternative, depending on what exactly you’re trying to achieve. You’d use Booth if you wanted the actor to end up described as in the chair, sofa or other piece of furniture and Platform if you wanted the actor to be described as on it. I suspect Platform will be the more usual choice in practice.