Putting Things Under - Object Put Under Itself

I’m attempting to have the player able to put something Under something else, using a pre-generated project in the Workbench with adv3Lite. With the below code, I get the reponse: “You can’t put the item under itself.” I cannot for the life of me figure out why this is occurring.

#charset "us-ascii"

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

versionInfo: GameID
    name = 'TEST'
;

gameMain: GameMainDef
    initialPlayerChar = me
;

startroom: Room 'The Starting Location'
    "Add your description here. "
;

+ me: Thing 'you'   
    isFixed = true       
    person = 2  // change to 1 for a first-person game
    contType = Carrier    
;

+ table: Thing 'table'
    contType = Under
    canPutUnderMe = true
;

++ item: Thing 'item';

Typing “put item under table” generates the response. Making the contType In presents no problems.

I followed the logic through to the implementation of the dobjFor(PutUnder) method in thing.t in the library and noticed that within the verify function, if(gVerifyIobj == gIobj) is the check for self actions, which is elsewhere gVerifyIobj == self - although I cannot say I know enough how any of this works to allege that anything might be wrong there!

Would appreciate any help in how to correctly structure an Under containment relationship.

4 Likes

I’m not looking at the Lite code at the moment, but if it reads as you posted, I think you may have found a bug that needs correcting…

1 Like

Yes, this is a bug in the library. As Sigston suggests

 if(gVerifyIobj == gIobj) 

Should be

 if(gVerifyIobj == self) 

I’ve now made this change in the library and uploaded it to GitHub. In the meantime you can fix this problem by making this change at line 5843 in thing.t (in the verify section of dobjFor(PutUnder).

4 Likes

Brilliant, thanks so much Eric!

Can I say that your tutorials have been so brilliant in getting me up and started with adv3lite and TADS? I’ve always been interested in writing IF but found implementing a parser to be a hugely daunting task - I never thought to look for other systems until a few weeks ago. A community so generous with its time!

3 Likes

Let me publicly second your thoughts, Sigston… Eric’s incredible docs and references were what initiated me into the land of programming and I found them so hugely helpful! So much effort of his on a voluntary basis!

3 Likes