Newsgroups: rec.arts.int-fiction
Subject: [TADS] Adding 'her' as an adjective
From: gdighton@geocities.com (Garth Dighton)
User-Agent: Xnews/03.04.11
X-no-productlinks: yes
Message-ID: <3bb3a22c$1_5@goliath2.newsgroups.com>
Date: 27 Sep 2001 17:03:24 -0500
Lines: 194
X-Authenticated-User: gdighton
X-Comments: This message was posted through Newsfeeds.com
X-Comments2: IMPORTANT: Newsfeeds.com does not condone, nor support,  spam or any illegal or copyrighted postings.
X-Comments3: IMPORTANT: Under NO circumstances will postings containing illegal or copyrighted material through this service be tolerated!!
X-Report: Please report illegal or inappropriate use to <abuse@newsfeeds.com> You may also use our online abuse reporting from: http://www.newsfeeds.com/abuseform.htm
X-Abuse-Info: Please be sure to forward a copy of ALL headers, INCLUDING the body (DO NOT SEND ATTACHMENTS)
Organization: Newsfeeds.com http://www.newsfeeds.com 73,000+ UNCENSORED Newsgroups.
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!newsfeed.wirehub.nl!local-out2.newsfeeds.com!goliath2.newsgroups.com
Xref: news.duke.edu rec.arts.int-fiction:93004

I've been trying to add a system of possessives to my game, such that
whenever an Actor holds an object, the appropriate possessives ("Bob's",
"Jill's", "his", "her", "my", etc.) can be used to refer to the object:

=========================================================
(Using Tads 2.5.5, code presented at end of mail

Testing Room
	You're in the testing room.
	You see a green box, a blue box, and a red box here.
	Bob is here.
	Jill is here.

>get green box
Taken.

>x my box
It looks like an ordinary green box to me.

>give bob green box
He accepts the green box.

>x red box
It looks like an ordinary red box to me.

>x bob's box
It looks like an ordinary green box to me.

>x his box
It looks like an ordinary green box to me.

>take red box
Taken.

>x jill
There's nothing in Jill.

>give her red box
She accepts the red box.

>x jill's box
It looks like an ordinary red box to me.

>x her box
I don't recognize that sentence.

======================================================

Obviously, the last command is the problem - "her" is a special word in
TADS 2.5, which cannot be used as any other part of speech ("him" is the
male equivalent, so "his" doesn't present any conflict.)

What I need to do is hook into the parser with preparseCommand or one of
the other parser hooks (parseNounPhrase, maybe?), so that "her" is
transformed into some other word. The problem I'm having is that I'm not
sure how to distinguish whether "her" is a pronoun or a modifier:

>give her red box

>take her red box

"Give" takes two nouns, so "her" is the indirect object, but the second
sentence takes one, so "her" is just a modifier.

What's the best way to figure out which use of "her" is intended?

Also, is there any way to figure out who the current "him", "her", "it",
and "them" objects are?

--
Garth Dighton
Code for test program follows:

=====================================================
#include <adv.t>
#include <std.t>
#pragma C+

startroom: room
	sdesc = "Testing Room"
	ldesc = "You're in the testing room."
;

modify thing
	// Add an Accept(obj) hook to moveInto:
    moveInto(obj) =
    {
        local loc;

        /*
         *   For the object containing me, and its container, and so forth,
         *   tell it via a Grab message that I'm going away.
         */
        loc = self.location;
        while (loc)
        {
            loc.Grab(self);
            loc = loc.location;
        }

        if (self.location)
            self.location.contents = self.location.contents - self;
        self.location = obj;
        if (obj) {
            obj.contents = obj.contents + self;

			loc = self.location;
			while (loc)
			{
				loc.Accept(self);
				loc = loc.location;
			}
		}
    }
    	// default Accept does nothing
    Accept(obj) = {}

;
modify Actor
	Grab(obj) = {
		local i;
		for (i = 1; i <= length(self.possessives); i++) {
			delword(obj, &adjective, self.possessives[i]);
		}
	}
	Accept(obj) = {
		local i;
		for (i = 1; i <= length(self.possessives); i++) {
			addword(obj, &adjective, self.possessives[i]);
		}
	}
	possessives = []

	// To allow free manipulation of boxes:
	verGrab(item) = {}
	actorAction(v,d,p,i) = {}
	ioGiveTo(actor, obj) = {
		obj.moveInto(self);
		"\^<<self.fmtYou>> accept<<self.fmtS>> <<obj.thedesc>>.";
	}
;

greenBox: thing
	adjective = 'green'
	noun = 'box'
	sdesc = "green box"
	location = startroom
;

blueBox: thing
	adjective = 'blue'
	noun = 'box'
	sdesc = "blue box"
	location = startroom
;

redBox: thing
	adjective = 'red'
	noun = 'box'
	sdesc = "red box"
	location = startroom
;

modify Me
	possessives = ['my' 'your']
;

Bob: Actor
	isHim = true
	noun = 'Bob'
	sdesc = "Bob"
	adesc = "Bob"
	thedesc = "Bob"
	location = startroom
	possessives = ['Bob\'s' 'his']
;

Jill: Actor
	isHer = true
	noun = 'Jill'
	sdesc = "Jill"
	adesc = "Jill"
	thedesc = "Jill"
	location = startroom
	possessives = ['Jill\'s' 'her' 'R']
    	// I've tried 'R' because that's what TADS substitutes for "her"
;



-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----
