intfiction.org

The Interactive Fiction Community Forum
It is currently Thu Oct 18, 2018 12:19 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sat Jun 09, 2018 9:06 am 
Offline

Joined: Sat Jun 09, 2018 8:42 am
Posts: 16
I have a character who is very possessive, so when objects he owns are mentioned, they should be mentioned as his. This is a first attempt at coding that up in I7:

Code:
"Problem with possessives" by osfameron

Section 1 - Mechanism

Ownership relates various things to one person.
The verb to belong to means the ownership relation.
The verb to own means the reversed ownership relation.

Before printing the name of a thing that belongs to the player: say "[our] "

Section 2 - Things

The Office is a room.

The vintage chair is an enterable supporter in the Office.
It belongs to the player.
The player is on the chair.

A badge is here. It belongs to the player.
A gun is here.


When we start play, we see the pronoun "your" correctly, but also the definite or indefinite article:

Quote:
Office (on the your vintage chair)
You can see a your badge and a gun here


I've read through the chapter on "Activities" in Writing With Inform, but I'm not figuring out which activity I need to override.
Or if I need to override the whole listing activity instead?
But I don't think that will add the locale specific text "(on your vintage chair)".

I'm not quite sure how best to go about finding all the texts that need to be overridden.
Any suggestions welcome!

osf'

_________________
osf'


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jun 09, 2018 1:06 pm 
Offline

Joined: Fri Aug 05, 2016 2:46 pm
Posts: 29
Try setting the indefinite article instead. That'll change every "a/an" to whatever you wish.

Code:
"Problem with possessives" by osfameron

Section 1 - Mechanism

Ownership relates various things to one person.
The verb to belong to means the ownership relation.
The verb to own means the reversed ownership relation.

[I took out the "before printing the name", and added this part here]
When play begins:
   repeat with N running through things that belong to the player:
      now the indefinite article of N is "[our]".

Section 2 - Things

The Office is a room.

The vintage chair is an enterable supporter in the Office.
It belongs to the player.
The player is on the chair.

A badge is here. It belongs to the player.
A gun is here.



And whenever a thing changes ownership, you simply set the indefinite article for it to [our], for example:

Code:
After taking something:
   now the noun belongs to the player;
   now the indefinite article of the noun is "[our]";
   continue the action. [to print the report message of the taking action]


And if you ultimately want to change it back, and bereave the player of their possession:

Code:
After dropping something:
   now the noun does not belong to the player;
   now the indefinite article of the noun is "";
   continue the action.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jun 09, 2018 1:54 pm 
Offline

Joined: Sat Jun 09, 2018 8:42 am
Posts: 16
itsgallus wrote:
Try setting the indefinite article instead. That'll change every "a/an" to whatever you wish.


Ooo, that's a step towards it, thanks!

That does now show "your badge".
And if you take it, it's listed as "your badge" still.

BUT if you "x badge" it's listed as "the".

AND we still have "(on the vintage chair)" in the description.

If we stand up, then both the badge and the chair are listed as "your".

BUT if we examine either of them, they are listed with "the".

And that seems to apply for some other actions: e.g. if you sit down again, you sit on "the" chair rather than "your" chair.

So in summary:

  • it looks like the indefinite article tweak works in listings (of room and inventory)
  • but not in other interactions
  • and not to describe e.g. a supporter you're on.

_________________
osf'


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jun 09, 2018 2:19 pm 
Offline

Joined: Fri Aug 05, 2016 2:46 pm
Posts: 29
Fair enough! I didn't realize you wanted to override the definite article as well!

Then you can use your initial approach, albeit with a little tweak. The trick is to make the things proper-named, getting rid of the articles altogether.
I can't bug test it right now, but I think this'll do the trick:

Code:
"Problem with possessives" by osfameron

Section 1 - Mechanism

Ownership relates various things to one person.
The verb to belong to means the ownership relation.
The verb to own means the reversed ownership relation.

[Still need to run a check when play begins]
When play begins:
   repeat with N running through things that belong to the player:
      now N is proper-named.

[Re-added this from your first code]      
Before printing the name of a thing that belongs to the player:
   say "[our] ".

Section 2 - Things

The Office is a room.

The vintage chair is an enterable supporter in the Office.
It belongs to the player.
The player is on the chair.

after taking something:
   now the noun belongs to the player;
   now the noun is proper-named;
   continue the action.

A badge is here. It belongs to the player.
A gun is here.

After dropping something:
   now the noun does not belong to the player;
   now the noun is improper-named; [To revert to using articles]
   continue the action.


This should also work with "x my badge" etc.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jun 09, 2018 3:57 pm 
Offline

Joined: Sat Jun 09, 2018 8:42 am
Posts: 16
Oh yes! That does the trick, thank you.

So the issue is just that some library messages use the indefinite article, and others the definite?
Is there a good reason for that, or is that just a quirk?

_________________
osf'


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat Jun 09, 2018 4:39 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5768
It's not a good idea to use proper-named for an object unless it truly is a name -- that is, begins with a capital letter. The library assumes that proper-named objects can be freely used at the beginning of a sentence.

So you can get stuff like this:

Code:
The bag is a closed proper-named container.
The printed name of the bag is "your bag".


Quote:
>search bag
your bag is empty.

>put rock in bag
your bag is closed.


In general, any message that uses "[The noun]" will fail for such an object. The library has a handful of messages which do that. (Though not as many as use "[the noun]".

There's no perfect solution for what you want to do. The safe option is to go with the indefinite article solution, and just accept that some library messages use "the" or "The".


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jun 10, 2018 5:16 am 
Offline

Joined: Sat Jun 09, 2018 8:42 am
Posts: 16
zarf wrote:
It's not a good idea to use proper-named for an object unless it truly is a name -- that is, begins with a capital letter. The library assumes that proper-named objects can be freely used at the beginning of a sentence.
...
There's no perfect solution for what you want to do. The safe option is to go with the indefinite article solution, and just accept that some library messages use "the" or "The".


That's very interesting, thanks! Presumably my requirement is rarer than I expected, in any case, I'm glad it wasn't just me failing to spot something obvious ;-)

So, I'll probably end up with what you've both suggested, thanks again.
But it's probably worth idly chipping away at it for a bit so, two thoughts are:

  1. The quixotic option: could you override the actions that print "[the]" and "[The]" to make this change globally?
  2. If I want to override just a few of the texts, how do I best go about finding where they are generated?
    For example, if the "(on the vintage chair)" text is the opening situation of the game and I want to establish the possessive nature of the character early, but the default text breaks the illusion. How do I go about finding just that one text?
    e.g. Do I need to start getting familiar with the source code, or are there short-cuts to finding which text to play with?

_________________
osf'


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jun 10, 2018 11:00 am 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5384
Location: Burlington, VT
osfameron wrote:
If I want to override just a few of the texts, how do I best go about finding where they are generated?
For example, if the "(on the vintage chair)" text is the opening situation of the game and I want to establish the possessive nature of the character early, but the default text breaks the illusion. How do I go about finding just that one text?
e.g. Do I need to start getting familiar with the source code, or are there short-cuts to finding which text to play with?


If you start up a game in the IDE and type "responses all," it'll give you a massive dump of all the rule responses in the game--you can look through there to find the message that you're concerned with. In this case, searching for the text "(on [the", it looks as though what you need to change is:

Code:
    room description heading rule response (B): " (on [the intermediate level])"


You can make special capitalized and uncapitalized substitutions to print "your" and "Your" appropriately for these cases:

Code:
Lab is a room. The throne is in the Lab. The player is on the throne. The indefinite article of the throne is "your". A rock is in the Lab. A chair is an enterable supporter in the Lab. A box is a container in the lab. The indefinite article of the box is "your". 

Room description heading rule response (B) is " (on [the-special intermediate level])".
Examine containers rule response (B) is "[The-special noun] [are] empty."

To say the-special (item - an object):
   if the item is the throne or the item is the box:
      say "your [item]";
   otherwise:
      say "[the item]".
      
To say The-special (item - an object):
   if the item is the throne or the item is the box:
      say "Your [item]";
   otherwise:
      say "[The item]".


Quote:
Lab (on your throne)
You can see a rock, a chair and your box (empty) here.

>sit on chair
(getting off the throne)
You get onto the chair.

>look
Lab (on the chair)
You can see your throne, a rock and your box (empty) here.

>x box
Your box is empty.


Note the proper capitalization of "your," and that it says "on the chair." Of course if you had a bunch of these things you'd want to do something like checking whether the thing belongs to the player, as you did in your original code. And you can substitute "the-special" for "the" in as many rule responses as you need to. (But I think anything that involves lists with definite articles will be too deep in the internals to be doable this way... though there may not be any such responses built in to the standard rules.)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jun 10, 2018 3:11 pm 
Offline

Joined: Sat Jun 09, 2018 8:42 am
Posts: 16
Thanks matt w!

And sorry, I realise that "responses" is in fact suggested in the I7 manual/tutorial, but I hadn't figured out that that (rather than an activity) was the thing I needed to look at here.

All the best,
osf'

_________________
osf'


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Jun 19, 2018 11:19 am 
Offline

Joined: Fri Oct 18, 2013 10:13 am
Posts: 2659
Location: The Midwest
You could also alter the object-name-printing code directly. Look in the English extension.

_________________
Daniel Stelzer


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group