I’ve been playing around with the I7 source code example Claims Adjustment, getting it to use Jesse McGrew’s Dynamic Objects instead of creating all the photo paper beforehand. There’s one major problem, though (and in fact the original version of the example has the same issue). Although the photographs are distinguishable by their subject, Inform thinks that they’re all identical. This means that X PHOTOGRAPH picks any photo at random, instead of asking which photograph you mean, and that all the photos are automatically grouped together in the inventory instead of being listed separately. How can I get Inform to treat the photos as distinct items?
[code]“Claims Adjustment”
Include Dynamic Objects by Jesse McGrew.
A photograph is a kind of thing. The prototype is a photograph. The printed name of the prototype is “photograph”. Understand “photograph” or “photo” as a photograph.
Appearance relates one thing to various photographs. The verb to be shown by implies the appearance relation.
The description of a photograph is usually “It shows [a random thing which is shown by the item described].”
Understand “of [something related by reversed appearance]” as a photograph.
[This allows the player to refer to any photograph by its subject: useful if we have a large number of them.]
[Now we create an action to let the player use the camera and generate these photograph objects:]
The player carries a cheap instant camera.
Understand “photograph [something] with [camera]” as photographing. Understand “photograph [something] with [something preferably held]” as photographing. Photographing is an action applying to one visible thing and one carried thing, requiring light.
The photographing action has an object called the selected film.
Check photographing:
if the second noun is not the camera, say “You need a camera for that purpose.” instead.
Check photographing:
if the noun is the camera, say “Sadly impossible.” instead.
Carry out photographing:
let the copy be a new object cloned from the prototype;
[if we ran out of memory and couldn’t create a new photo:]
if the copy is nothing:
say “Ack, it looks like you’ve run out of photo paper! I guess you’re not going to be taking any more photos tonight.”;
stop the action;
otherwise:
now the selected film is the copy;
now the noun is shown by the selected film;
move the selected film to the player.
Report photographing:
say “Your camera instantly spits out [a selected film].”
[Now we use two activities from the Activities chapter to describe the photographs to the player more elegantly:]
After printing the name of a photograph (called target):
say " of [a random thing which is shown by the target]".
[After printing the plural name of a photograph (called target):
let N be the holder of the target;
say " of [a list of things which are shown by photographs which are held by N]";
if the number of things which are shown by photographs which are held by N is greater than one, say " (variously)".]
[And finally we provide a brief scenario to give the player something to take pictures of:]
The Treasure Room is a room. “Despite the fancy name, this is no more than a closet – albeit a closet with its own special circuit on the house alarm.”
The Treasure Room contains a small Degas, a Ming vase, and a collection of South African krugerrands.
The description of the forms is “Completely filled out in black ink in block letters: now all you need to do is attach photographic evidence of the objects you wish to insure.”
Test me with “photograph degas / photograph vase / x photograph”.[/code]