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 intfiction.org to take attachments…
DefineTAction(Give)
;
VerbRule(Give)
(‘give’ | ‘offer’) dobjList
: GiveAction
verbPhrase = ‘give/giving (what)’
askIobjResponseProd = toSingleNoun
;
modify Thing
dobjFor(Give) {
preCond = [objHeld]
action() {
askForIobj(GiveTo);
}
}
;