getting 'nil object reference' for TIAction - Solved

#1

Edit: I figured it out. The original post below has the error. It was on the VerbRule of the TIAction line. Instead of:

VerbRule(TickleWith)(‘tickle’ | ‘stroke’) dobjList (‘with’) singleDobj : TickleWithAction

I had to change it to

VerbRule(TickleWith)(‘tickle’ | ‘stroke’) dobjList (‘with’) singleIobj : TickleWithAction

I’ve defined the following verbs:

[code]DefineTAction(Tickle);
VerbRule(Tickle)(‘tickle’ | ‘stroke’) dobjList : TickleAction
verbPhrase = ‘tickle/tickling (what)’
;

DefineTIAction(TickleWith);
VerbRule(TickleWith)(‘tickle’ | ‘stroke’) dobjList (‘with’) singleDobj : TickleWithAction
verbPhrase = ‘tickle/tickling (what) (with what)’
;

modify Thing
dobjFor(Tickle){
preCond = [objHeld]
verify(){ illogical(cannotTickleMsg); }
}
dobjFor(TickleWith){
preCond = [objHeld]
verify() { illogical(cannotTickleMsg); }
}
iobjFor(TickleWith){
preCond = [objHeld]
verify(){ illogical(cannotTickleWithMsg); }
}
cannotTickleMsg = '{You/he} cannot tickle {that dobj/him}. ’
cannotTickleWithMsg = '{You/he} cannot tickle anything with {that iobj/him}. ’
defaultTickleMsg = 'Nothing obvious happens. ’
defaultTickleWithMsg = 'Nothing obvious happens. ’
;[/code]

Next, I’ve defined a skeletal game where I’m just using the verb as is

startRoom: Room 'start room' 'start room' "Start room. "; +me: Actor; ++feather: Thing 'feather' 'feather' "A large feather. "; +npc: Actor 'npc' 'npc' "Npc ";

When I run the game and invoke the tickle verb, it works fine:

Start room
Start room.

The npc is standing here.

tickle npc
You cannot tickle that.

However, if I try to ‘tickle with’ (i.e., >tickle npc with feather) the code crashes in file action.t

    //method called on line 4145
    resolveNouns(issuingActor, targetActor, results)
    {
        [...]
        
        //error is here on line 4246. objMatch1 is nil (error: 'nil object reference)
        self.(objList1) = objMatch1.resolveNouns(
            self.(getResolver1)(issuingActor, targetActor, true), results);

What am I missing?

Thanks

0 Likes