Issue with the objHeld Precond and iobjs (adv3lite)

When I have the preCond = [objHeld] under an action method for an object that I can’t take (e.g. Heavy, Fixture) , the game crashes saying I have a nil object reference. It seems verify still gets checked first, so I could modify those object types to prevent any such thing, but I was wondering if there’s a better solution.

[code]reallyBigRock: Heavy ‘rock; really big’
"It’s really big. "
iobjFor(FuseObjs) { verify() { } }

modify Thing
preCond = [objHeld]

    preCond = [objHeld]
    verify() { illogical('You just can\'t, okay? '); }
    action() { "You fuse {the dobj} with {the iobj}. "; }


‘fuse’ multiDobj ‘with’ singleIobj
: VerbProduction
action = FuseObjs
verbPhrase = ‘fuse/fusing (what) (with what)’
missingQ = ‘what do you want to fuse; what do you want to fuse {the dobj} with’
iobjReply = withSingleNoun

I’m afraid I’m unable to reproduce this error on the basis of the information given. When I tried it, using the code you posted, everything worked fine. Well, almost fine: I did incidentally find another small bug (the game was reporting the wrong object as the one that couldn’t be moved), but it wasn’t causing a run-time error and can be fixed simply by replacing dobj with cobj in all the various definitions of cannotTakeMsg.

I did wonder about the definition of the missingQ property on your VerbRule, since I don’t think the library uses {the dobj} in this context at all (it always uses ‘it’), and it’s possible this could give rise to problems, but it didn’t cause any for me.

It seems to me, then, that there must be something else in your code (i.e. code that you haven’t posted) that’s triggering this problem.

Ah, sorry, I actually forgot to say that happens when you try “Fuse rock with rock” rather than existing as a run-time error (minor detail :-p).

I also changed misssingQ but it didn’t appear to be the issue (though I will certainly keep it in mind).

It looks like the fix I applied to the related bug fixed this one too, i.e. changing {the dobj} to {the cobj} in the various cannotTakeMsg properties.

Of course, if trying to fuse the rock with itself isn’t allowable in your game, you might want to rule that out at the verify stage in any case.

Hm, even removing {the dobj} and {the cobj} completely I still get issues (on line 1072 of messages.t, specifically). I’m fusing rock with rock is mostly for convenience sake, but I still get the error with any other dobj (though I do need to remember to prevent fusing something with itself later on).

Well, once again I’m back unable to reproduce the error with the information you’ve given me, so there’s not much I can do.

You are changing cannotTakeMsg on the Heavy class, right? So it reads:

class Heavy: Fixture
    cannotTakeMsg = BMsg(too heavy, '{The subj cobj} {is} too heavy to move. ')    

That should fix FUSE ROCK WITH ROCK. You’ll then need to find every other cannotTakeMsg and make a similar change (dobj to cobj).

Alternatively, you could just download the latest working version of the library from GitHub.

Ah no that explains it. I kept trying to change the fuse message and couldn’t figure out what I needed to do. I’ll be sure to update the library, thanks!