Help with defining an item with a possessive proper name (e.g. Fred's chair)

Hello again friends.

Still working through modernizing the code of this old game, which was in fact modernized from a published game I did when I was 13 back in 1982. I guess I have time on my hands and a sense for nostalgia. :slight_smile:

So there is an item that I want to describe as belonging to somebody. It’s a beer stein that is the property of an NPC named Big Ern.

So the code is

Big Ern's stein is a fluid container.  

Big Ern's stein has printed name "[if Big Ern is known]Big Ern's silver stein[otherwise]the large, smelly gnome's stein".  

Understand "[Big Ern's stein]" as Big Ern's stein.

Understand "silver stein" and "Big Ern's stein" and "Ern's stein" as "[Big Ern's stein]".

My problem is the game won’t recognize the player’s input “Big Ern’s stein” because of its processing of the apostrophe.

Any suggestions? I’m using unabbreviated object names, by the way.

I’ve tried

Understand "Big Ern[']s stein" as "[Big Ern's Stein]" and that doesn't work either.

Thanks so much!

1 Like

Are you using Emily Short’s punctuation removal extension? Out of the box, the code you provided allows the player to refer to the stein as “Big Ern’s stein” since Inform doesn’t have trouble processing apostrophe’s out of the box. Or maybe your keyboard is typing an ` when Inform is expecting an '?

(NB that you could replace your two Understand statements with just:

Understand “silver stein” as Big Ern’s Stein.

The other options are understood by default since they’re part of the aforementioned object name.

lab is a room.

A stein-owner is a kind of person.
Big Ern is a stein-owner in the lab.
A stein is a kind of container.
Every stein-owner carries a stein (called its stein).

The description of Big Ern's stein is "Commensurately big."

Test me with "x big ern's stein"
2 Likes

Thanks, Mike!

So it’s interesting. I am not using any extensions. I couldn’t for the life of me get this to work. So I set up a new project to test the concept. Simplest code I could think of – all of four lines.

Example Location is a room. 
Fred is a person in Example Location.
Fred's jug is a thing in Example Location.
Larry's jug is a thing in Example Location.

I then go to play this, and the following happens:

Example Location
You can see Fred, Fred's jug and Larry's jug here.

>take fred’s jug
You can't see any such thing.

>showme fred’s jug
There seems to be no such object anywhere in the model world.

>take jug
Which do you mean, Fred's jug or Larry's jug?

>fred's
Taken

Seems like it doesn’t handle it the way we would think it would.

Zed’s solution is a fix I will try – thank you, Zed! – but I’m curious as to what the issue is with Inform’s handling of the proper name. Seems weird, right?

Thanks, Zed!

So I tried this as well, and it didn’t work. I’m using Inform v 10.1.2, by the way.

So here’s what happened for me with the code you helpfully suggested:

lab
You can see Big Ern here.

>examine big ern
You see nothing special about Big Ern.

>take big ern’s stein
You can't see any such thing.

>showme big ern
Big Ern - stein-owner
    Big Ern's stein - stein
location: in lab
unlit, inedible, portable; transparent, male; singular-named, proper-named
description: none
initial appearance: none
carrying capacity: 100
printed name: "Big Ern"
printed plural name: "stein-owners"
indefinite article: none
list grouping key: none

>x big ern’s stein
You can't see any such thing.

>x stein
Commensurately big

It recognizes “stein” but doesn’t recognize the possessive version, either directly in-game or with the meta-command showme.

Strange, right?

I can always give up and call it the silver stein in my game versus Big Ern’s stein, but I think it’s odd that it doesn’t seem to be working in a predicable way for me.

I’m on a Mac, if that matters. Perhaps it does?

Works for me in 10.1.2. Being on a Mac shouldn’t affect this.

Very strange. I wonder why mine is misbehaving?

I literally used your exact code. Interesting.

Well, thanks for trying! :slight_smile: I definitely appreciate your help!

I think it fails because you are not using a '…

The latter command does use a ’ and that one succeeds.
Loading your scenario into Borogove:

>take Fred's jug
You already have that.
 
>take Fred's jug
You already have that.
 
>take Fred’s jug
You can't see any such thing.
 
> 

I only have the one apostrophe key though…I assure you I’m using it the same way each time.

I even thought it might be a memory thing (I have a 285,000 word source code) so I closed Inform, powered down and back up, opened a fresh project and tried just those four lines again. Same result.

Example Location
You can see Fred, Fred's jug and Larry's jug here.

>take fred’s jug
You can't see any such thing.

>showme fred’s jug
There seems to be no such object anywhere in the model world.

>take jug
Which do you mean, Fred's jug or Larry's jug?

>fred's
Taken

I guess I’ll give up. Really weird. though!

From your transcript, it looks like sometimes when you type an apostrophe, it is straight, and sometimes it is curly. I don’t know why. It looks like Inform is not treating them interchangeably. The object name has a straight apostrophe. Does it make a difference if you add a synonym with a curly apostrophe?

Understand "Fred’s" as Fred's jug.

I’m guessing there’s a better solution, though I don’t know what it is.

1 Like

The curly apostrophe thing seems to be a Mac-specific issue; it has come up several times.

Inform will build a dictionary and name objects using the character codes typed in the source (I’m pretty sure). If these are curly apostrophes in the source, that is what the interpreter will be looking for in player input.

This code will convert curly apostrophes in player input to straight apostrophes:

Include (-

[ ReplaceInputChar  inp rep     i j ;
	for (i = buffer+WORDSIZE, j = buffer+INPUT_BUFFER_LEN: i < j: i++)
		if (i->0 == inp) i->0 = rep;
];

-).

To replace curly apostrophes:
	(- ReplaceInputChar(63, 39); -)

After reading a command:
	replace curly apostrophes.

If you would rather convert straight apostrophes to curly, switch the arguments in the call to ReplaceInputChar().

EDIT: Oh, oops. That code isn’t really a proper solution. I had forgotten that the interpreter is already converting curly apostrophes into question mark characters, so what this code is doing is converting question marks to straight apostrophes.

It can be modified to only replace a question mark followed by a 's', which might work well enough.

1 Like

Here’s a kludge from the AIF world which often involves interacting with possessives and body parts:

If you make a kind, and then make one of every kind part of every person (or a specific person) Inform will automatically name it as belonging to the person it is attached to.

If you rip it off of them when play begins, it retains that nomenclature, including the player.

@Hanon, thanks!

Unfortunately…same issue. Here’s the result that code gets me:

Lab
You can see Fred and Mary here.

>take fred’s stein
You can't see any such thing.

>showme fred’s stein
There seems to be no such object anywhere in the model world.

>showme fred
Fred - man
    Fred's stein - stein
location: in Lab
unlit, inedible, portable; transparent, male; singular-named, proper-named
description: none
initial appearance: none
carrying capacity: 100
printed name: "Fred"
printed plural name: "men"
indefinite article: none
list grouping key: none

>take stein
Which do you mean, Fred's stein, Mary's stein or your stein?

>fred's
That seems to belong to Fred.

@bg, thanks! Unfortunately even copy and pasting from your post converts to the straight apostrophe. The code is all straight apostrophes, and when typed from the keyboard during play, it appears straight as well, but they must be interpreted as curly somewhere along the way perhaps? This must be the problem.

@otisdog, thanks to you as well, including for making me not feel like I’m the only person with this problem. Was starting to think I was losing it lol. :wink:

I think perhaps some variation of the character replacement code might work, although this has reached the point of being a rather long walk for a short drink, so to speak.

Maybe you could try

Understand "Fred?s" as Fred's jug.

I don’t know if it’ll work, but it might be worth a try.

@bg, that doesn’t compile. It also won’t let me use a token like “Fred[']s” or “Fred[?]s”

You are having the “curly quote” problem. ’ vs ' as defined above. You might wish to turn off auto-correct on your keyboard, or go into the auto-correct definitions and delete the translation from a straight quote to a curly quote.

This is just standard Inform rules you can override and not a problem with nomenclature.


>actions

Actions listing on.

>take Fred's stein

[taking Fred's stein]

That seems to belong to Fred.

[taking Fred's stein - failed the can't take people's possessions rule]
1 Like

Oh, here’s a workaround from another thread:

This works for me:

Lab is a room.

Fred's mug is here.

Understand "Fred s" as Fred's mug.

After reading a command:
	remove question marks.
1 Like

We have a winner, bg!

Thanks everyone! This does seem to be an issue associated with Macs, from what I have been able to research.

Onward!

1 Like