I'm not sure about the newsgroup policy on posting source code, but I'd
like some feedback on this before uploading it to gmd.
It is a couple of routines and a table, which together recognize and
actively disencourage any reference to any bodypart. I know that at
least Leather Goddesses of Phobos does this.
It works by creating an object of class BodyPart for each NPC and making
the NPC a parent of it, i.e. every NPC carries a dummyobject that
represents all his/her bodyparts.
Three things are of note:
1. THE POSSESSOR PROPERTY.
To work properly, every NPC has to provide a couple of special
dictionary words in its POSSESSOR property. Basically these words should
be the same that are in the NPC's NAME property followed by an
apostrophe (written as a "^") and a "s", e.g. 'fred^s' 'man^s'.
As the parser automatically handles words like 'his' and 'my', you'd
think it should handle the aforementioned case as well, but alas.
2. THE NPCS MUST BE TRANSPARENT OR SUPPORTER.
The dummyobjects that are put in the NPCs as children rather than in the
otherwise convenient ADD_TO_SCOPE property.
"EXAMINE HIS LEGS" will primarily look for the object referred to by
'legs' in the possessions of the objects referred to by 'his'. If his
legs are in his ADD_TO_SCOPE property, however, they are not among his
possessions, and will not be found as easily by the parser.
To be able to refer to the possessions of an NPC, he or she must be
either TRANSPARENT or a SUPPORTER. The InitBodyParts routine below makes
every NPC in the game a supporter.
3. THE PLAYERS BODYPARTS SHOW UP ON INVENTORY.
Because the bodyparts are carried, they reduce the capacity of every NPC
by one, including the player if he or she has any bodyparts.
The player should really have a bodyparts object, but to stop this from
showing up in every inventory listing, you really have to replace the
InvSub routine in the parser or trap every inventory action to
temporarily remove the bodyparts object.
The code below doesn't dynamically create an object for the player. It
does, however, create one for every creature the player might change
into during the game.
Well, is there any improvement I could easily make?
--
Petter Sjölund
----------------------------------------------------
Stockholmsvägen 53
S-182 74 Stocksund
Sweden
Phone +46 (8) 85 43 34
Beeper +46 740 455 606
----------------------------------------------------
BodyParts.h begins here:
property possessor;
!---------------------------------------------------------------------
! Every NPC should provide an array of dictionary words like 'fred^s' !
and 'fox^s' in its possessor property, so these words can be use to !
indicate the ownership of the bodypart referred to.
! "My", "his", "her" "its" and "theirs" are already taken care of by
! the parser.
!---------------------------------------------------------------------
Array Bodyparts table 'head' 'forehead' 'brow' 'eyelashes' 'eyelash'
'eyebrow' 'eyebrows' 'face' 'eyelid' 'eyelids' 'eyes' 'eye' 'lip' 'lips'
'nostril' 'nostrils' 'mouth' 'teeth' 'nose' 'cheek' 'chin' 'hand'
'cheek' 'cheeks' 'hands' 'finger' 'fingers' 'arm' 'arms' 'leg' 'legs'
'stomach' 'ass' 'tits' 'breasts' 'breast' 'clothes' 'jaw' 'hair' 'skin'
'body' 'foot' 'feet' 'nipples' 'nipple' 'genitals' 'dick' 'penis' 'cock'
'vulva' 'vagina' 'clitoris' 'pussy' bellybutton' 'asshole';
class BodyPart(25) !Increase if you have more than 25 NPCs
with parse_name
[ scr theWord;
theWord=NextWord();
if (WordInProperty(theWord, parent(self), possessor))
{
scr++;
theWord=NextWord();
}
if (WordInArray(theWord, Bodyparts))
scr++;
else return 0;
self.n_to = theWord;
return scr;
],
short_name
[;
if (self.n_to ~= null)
{
if (parent(self) == player) print "your";
else
print (the)parent(self),"'s";
print " ",(address) self.n_to;
rtrue;
}
],
each_turn
! "Him" and "her" should refer to the owner of the bodypart
! last mentioned
[; if (PronounValue('it')==self)
PronounNotice(parent(self));
],
before
[;
default:
"[ There is no need to refer to parts of people's bodies in this
game, e.g. type EXAMINE FRED rather than EXAMINE FRED'S HEAD ]";
],
n_to null, !stores addr of dict word naming mentioned bodypart
has animate concealed neuter proper;
!---------------------------------------------------------------------
! Word-finding in table routine
!---------------------------------------------------------------------
[ WordInArray theWord theArray i l;
if (~~theWord) return false;
l=theArray-->0;
for (i=1:i<=l:i++)
if (theWord==theArray-->i) rtrue;
rfalse;
];
!---------------------------------------------------------------------
! Initialization. Puts a BodyPart object in every animate object and !
makes the owner a supporter so that you can actually see his or her !
bodyparts.
!---------------------------------------------------------------------
[ InitBodyparts x;
objectloop (x has animate && ~~(x ofclass Bodypart))
if (x ~= player) ! Delete this if you want bodyparts in yoursef
{
if (Bodypart.remaining () == 0)
"^Bodyparts.h: The programmer needs to add more instances
to the BodyPart class definition.^";
move BodyPart.create() to x;
give x supporter;
}
];
--
Nicholas Daley
<mailto:dal...@ihug.co.nz>
FD :-) Thanks. (The real question is what names to put in for body parts,
hehehe.)
------------------------------------------------------------------------------
Femal...@aol.com "Good breeding consists in
concealing how much we think of ourselves and how
little we think of the other person." Mark Twain
>2. THE NPCS MUST BE TRANSPARENT OR SUPPORTER.
>The dummyobjects that are put in the NPCs as children rather than in the
>otherwise convenient ADD_TO_SCOPE property.
>"EXAMINE HIS LEGS" will primarily look for the object referred to by
>'legs' in the possessions of the objects referred to by 'his'. If his
>legs are in his ADD_TO_SCOPE property, however, they are not among his
>possessions, and will not be found as easily by the parser.
>To be able to refer to the possessions of an NPC, he or she must be
>either TRANSPARENT or a SUPPORTER. The InitBodyParts routine below makes
>every NPC in the game a supporter.
You should probably make the NPCs transparent, not supporters. You don't
want to be able to set things (books, anvils, grand pianos) on top of
NPCs; you just want to be able to see what they're carrying, i.e., arms,
legs, etc.
--
KEN FAIR - U. Chicago Law | <http://student-www.uchicago.edu/users/kjfair>
Of Counsel, U. of Ediacara | Power Mac! | CABAL(tm) | I'm w/in McQ - R U?
"Any smoothly functioning technology will be
indistinguishable from a rigged demo." Isaac Asimov
I have names for all of my body parts, don't you FD? ;-)
Jarbigruen
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
>Well, there was some discussion recently about allowing the player to
>refer to the individual bodyparts of other NPCs (or of him/herself).
[...]
>3. THE PLAYERS BODYPARTS SHOW UP ON INVENTORY.
>Because the bodyparts are carried, they reduce the capacity of every NPC
>by one, including the player if he or she has any bodyparts.
>The player should really have a bodyparts object, but to stop this from
>showing up in every inventory listing, you really have to replace the
>InvSub routine in the parser or trap every inventory action to
>temporarily remove the bodyparts object.
>The code below doesn't dynamically create an object for the player. It
>does, however, create one for every creature the player might change
>into during the game.
Make the bodypart conceled. This way it won't show up on the inventory
(I think).
also I think the following
>class BodyPart(25) !Increase if you have more than 25 NPCs
> with parse_name
> [ scr theWord;
> theWord=NextWord();
>
> if (WordInProperty(theWord, parent(self), possessor))
> {
> scr++;
> theWord=NextWord();
> }
should be
>class BodyPart(25) !Increase if you have more than 25 NPCs
> with parse_name
> [ scr theWord;
> theWord=NextWord();
>
> while (WordInProperty(theWord, parent(self), possessor) !<<<<<<
> {
> scr++;
> theWord=NextWord();
> }
so that "examine the big man's head" would work
as well as "examine the man's head".
anyway, this is a very nice and would be very usefull to me,
until now I created a single object for each body part and this
way I could use one object for all the body parts.
If you do upload it, please post a notice to r.a.i-f.
[posted and mailed]
/NL
--
Nir Levy, The above opinions are my own,
nlevy @ usa.net not my employer's.
--
I didn't do it; Nobody saw me do it;
You can't prove anything; -Bart Simpson
--