I believe this does exactly what you want.
[spoiler][code]“Claims Adjustment”
Include Dynamic Objects by Jesse McGrew.
Include (-
Attribute photo;
-) after “Definitions.i6t”.
Include (-
[ Identical o1 o2 p1 p2 n1 n2 d1 d2 i j flag;
if (o1 == o2) rtrue; ! This should never happen, but to be on the safe side
if (o1 == 0 || o2 == 0) rfalse; ! Similarly
if (o1 ofclass K3_direction || o2 ofclass K3_direction) rfalse; ! Saves time
! What complicates things is that o1 or o2 might have a parsing routine,
! so the parser can't know from here whether they are or aren't the same.
! If they have different parsing routines, we simply assume they're
! different. If they have the same routine (which they probably got from
! a class definition) then the decision process is as follows:
!
! the routine is called (with self being o1, not that it matters)
! with noun and second being set to o1 and o2, and action being set
! to the fake action TheSame. If it returns -1, they are found
! identical; if -2, different; and if >=0, then the usual method
! is used instead.
if (o1 has photo && o2 has photo) {
d1 = noun; d2 = second;
noun = o1; second = o2;
ProcessRulebook((+ the photograph comparison rule +));
noun = d1; second = d2;
if (RulebookSucceeded()) {
!print "Identical!^";
rtrue;
}
else if (RulebookFailed()) {
!print "Different!^";
rfalse;
}
}
if (o1.parse_name ~= 0 || o2.parse_name ~= 0) {
if (o1.parse_name ~= o2.parse_name) rfalse;
parser_action = ##TheSame; parser_one = o1; parser_two = o2;
j = wn; i = RunRoutines(o1,parse_name); wn = j;
if (i == -1) rtrue;
if (i == -2) rfalse;
}
! This is the default algorithm: do they have the same words in their
! "name" (i.e. property no. 1) properties. (Note that the following allows
! for repeated words and words in different orders.)
p1 = o1.&1; n1 = (o1.#1)/WORDSIZE;
p2 = o2.&1; n2 = (o2.#1)/WORDSIZE;
! for (i=0 : i<n1 : i++) { print (address) p1-->i, " "; } new_line;
! for (i=0 : i<n2 : i++) { print (address) p2-->i, " "; } new_line;
for (i=0 : i<n1 : i++) {
flag = 0;
for (j=0 : j<n2 : j++)
if (p1-->i == p2-->j) flag = 1;
if (flag == 0) rfalse;
}
for (j=0 : j<n2 : j++) {
flag = 0;
for (i=0 : i<n1 : i++)
if (p1-->i == p2-->j) flag = 1;
if (flag == 0) rfalse;
}
! print "Which are identical!^";
rtrue;
];
-) instead of “Identical” in “Parser.i6t”.
This is the photograph comparison rule:
let image one be a random thing which is shown by the noun;
let image two be a random thing which is shown by the second noun;
if image one is image two begin;
[say “([image one] == [image two])[line break]”;]
rule succeeds;
otherwise;
[say “([image one] != [image two])[line break]”;]
rule fails;
end if.
Carry out taking inventory (this is the print advanced inventory rule):
issue library message taking inventory action number 2;
say “:[if the player holds less than two photographs][line break][end if]”;
list the contents of the player, with newlines, indented, including contents, giving inventory information, with extra indentation.
The print advanced inventory rule is listed instead of the print standard inventory rule in the carry out taking inventory rulebook.
A photograph is a kind of thing. The description of a photograph is usually “It shows [a random thing which is shown by the item described].”. Understand “photograph”, “photo” and “of” as a photograph. Understand “[something related by reversed appearance]” as a photograph.
Include (- has photo, -) when defining a photograph.
The prototype is a photograph. The printed name of the prototype is “photograph”.
Appearance relates one thing to various photographs. The verb to be shown by implies the appearance relation.
[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.
Photographing is an action applying to one visible thing and one carried thing, requiring light. Understand “Photograph [something] with [camera]” as photographing. Understand “Photograph [something] with [something preferably held]” as photographing.
Does the player mean photographing a photograph: it is very unlikely.
The photographing action has an object called the selected film.
Setting action variables for photographing:
let the copy be a new object cloned from the prototype;
now the selected film is the copy.
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.
Check photographing:
if the selected film 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.” instead.
Carry out photographing:
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].”.
Before listing contents: group photographs together.
Rule for grouping together photographs:
say “some photographs of various items”.
After printing the name of a photograph (called target) while not grouping together:
say " of [a random thing which is shown by the target]".
After printing the plural name of a photograph (called target) while not grouping together:
say " of [a random thing which is shown by the target]".
The Treasure Room is A Room. The description of the treasure room is “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, a collection of south african krugerrands and some forms.
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 “x forms / i / photograph degas / x photograph / i / photograph degas / x photograph / i / photograph vase / x photograph / vase / i / photograph krugerrands / x photograph / krugerrands / i”.[/code][/spoiler]
It’s quite a fiddly solution, but it does treat photos of different items as distinct and photos of the same item as identical.
Hope this helps.