askForIobj nil object reference

I am working on resurrecting a long-in-progress TADS 3 game of mine.

I detected a bug that I don’t know how to fix. If I include the below implementation of the “Give” action, and then I compile the game and type GIVE ROCK (where there are two characters nearby, Bob and Dave), instead of asking who I want to give the rock to, it gives me a nil reference error. Can anyone help me figure out why?

Before telling me I shouldn’t need an answer to this question: yes, I know that the below implementation of the “Give” action is pointless and stupid by any normal measure, and that just omitting the code below causes the problem to go away. I want to know the answer to this question anyway, for two reasons:
(1) My work-in-progress does a lot of weird crap, and I think I put the code below into my game for a reason. For example, there’s one object in my game that is very unusual in that, if you try to refer to it using a sentence of more than two words, it gives you an error message (only for that one object, not for other objects). I think I might have put the code below in as some way of handling that scenario, but I’m not sure, because I didn’t write adequate comments. Sigh.
(2) Also, I don’t see anything wrong with the code below, and simple academic curiosity makes me want to know why it isn’t working.

I’m going to try to include the full code to reproduce this, if I can get to take attachments…

(‘give’ | ‘offer’) dobjList
: GiveAction
verbPhrase = ‘give/giving (what)’
askIobjResponseProd = toSingleNoun
modify Thing
dobjFor(Give) {
preCond = [objHeld]
action() {

Attachment included … compile and type GIVE ROCK to reproduce my error.
givedemo.txt (1.2 KB)

I can’t tell what causes it, but it seems that the GiveTo action in general is not suitable for use with askForIobj(). If you replace askForIobj(GiveTo) with askForIobj(ShowTo), askForIobj(ThrowAt), etc, it works fine. So it seems the GiveTo action just happens to be implemented in a way that prevents it from being used with askForIobj().

1 Like

Thanks for the reply. Based on your response, sounds like this is an obscure adv3 library bug. Modifying Resolver.cacheScopeList() fixes the issue, and I’ve just submitted a bug fix request. If anyone stumbles across this and needs a fix, see the link for more details.