'Give' and Possessives

Once again I have encountered a problem that can be resolved using the StringPreParser, and once again I am hoping to find a different solution.

The trouble arises when I enter commands of the form GIVE X TO Y’S Z. Here is my code:

[rant][code]room: Room ‘room’ ‘Room’
;

me: Actor
location = room
;

  • key: Thing ‘key’ ‘key’
    ;

monster: Actor ‘two-headed monster’ ‘two-headed monster’
location = room
;

  • leftHead: Head ‘left head’ ‘left head’
    ;

  • rightHead: Head ‘right head’ ‘right head’
    ;

Head: Component
iobjFor(GiveTo)
{
verify() { }
action()
{
replaceAction(GiveTo,gDobj,monster);
}
}
;[/code][/rant]
And here is my transcript:
[rant]Room

The two-headed monster is standing here.

give key to right head
The two-headed monster does not appear interested.

put key on monster’s right head
There’s no good surface on the right head.

give key to monster’s right head
[At this point I receive an error: “nil object reference”][/rant]
Any thoughts?

This is the giveMeToAskFor remapping in action again. This time it probably deserves a bug report - the action.canIobjResolveTo(issuingActor) test eventually causes the nil reference error.

You can work around the bug by modifying the earlier giveMeToAskFor code to skip the remapping if the issuingActor and targetActor are the same.

modify giveMeToAskFor
	getRemapping(issuingActor, targetActor, action)
	{
		if (!(action.isRemapped()) && !(issuingActor == targetActor))
			return inherited(issuingActor, targetActor, action);
		else
			return nil;
	}
;

You have solved the problem. Thank you!

The giveMeToAskFor bug will be fixed in the 3.1 release.

Thank you for reporting the bug, bcressey. Also, kudos to Michael Roberts for addressing the matter so quickly.