Inform 7 question: problem with two identical objects

Hello. I’m using Inform 7 and would like to create two identical objects. This code seems to have done the trick:

A dollar bill is a kind of thing. One dollar bill is in the envelope. One dollar bill is on the plate.

Later I perform a test to see if the player is carrying either dollar bill:

if player carries dollar bill: move donut to player;

which works as well.

What doesn’t work is when I try to move one dollar bill from the player to somewhere else:

if player carries dollar bill: move donut to player; move dollar bill to baker;

It seems like I’m missing something very simple, like making sure the dollar bill to move refers to one carried by the player.

Thanks for any help!
Caleb

“a kind of thing” is not an object. It’s a whole class of objects. So you can’t write “if player carries dollar bill.” The player never carries a class of objects.

I’ll leave it to more experienced Inform users to tell you what syntax to use – my Inform is very rusty.

I think that is my exact problem: after creating a “kind of thing” I’m not sure how how to refer to a specific object of that class. (Particularly the one being carried by the player, or, if both are, then either one, I suppose…)

If the objects of the kind are all identical, you can use “a random kindname” (possibly with some restrictions, such as “a random dollar bill carried by the player”) which is a little counterintuitive if you happen to know that there’s only one, but you can be assured that in that case you know exactly which one the random choice picks. :slight_smile:

I think Inform accepts that syntax, bit if it doesn’t you could test “the number of dollar bills carried by the player”.

Try this:

Let the cash be a random dollar bill carried by the player; move the cash to the diner.

Try it and let us know.

“a random dollar bill carried by the player”

This was just the ticket. Thanks very much, everyone!

This might also work:

If the player carries a dollar bill (called George): move George to the baker.