** Programming error: tried to find the "." of (something) *


#1

I have encountered one of these errors in the past (this post) and the problem was that I addressed the “asking it about” action as having a second noun, instead of some text.

In the current case, an improvised exercise on using relations, something doesn’t work with “giving it to.”

The scenario: you have bought one gift for each of your employees, without knowing their preference. When play begins, a random gift is assigned to each non-player character. Also, a random preference is picked for each NPC. Then, you can GIVE the gifts to each person and get positive or negative reactions, according to whether you got the preference right.

This is what I get, though, when I give something to someone:

I get this, even if the preference is guessed correctly. Can you offer some advice, please?

Thanks!

[rant=Code here][code]“Bearing Gifts—an exercise (simplified version)”

Use serial comma.

Identity is a kind of value. The identities are musical instruments, explosives, books, and uncategorised.

A thing has an identity. The identity of a thing is usually uncategorised.

Loving relates various people to one identity. The verb to love means the loving relation.

Receiving relates one person (called the taker) to one thing. The verb to receive means the receiving relation.

A thing can be assigned or unassigned. A thing is usually unassigned.

Definition: a thing is non-living if it is not a person.

When play begins:
now everything is unassigned;
repeat with P running through people who are not the player:
now P loves a random identity (called id) that is not uncategorised;
now P receives a random unassigned non-living thing (called gift);
say “You have bought [a gift] for [P]. [They] likes [id].”; [This is a testing output, just to see how this works. It is not supposed to be included in the final draft.]
now the gift is assigned.

[About giving]

The block giving rule is not listed in the check giving it to rules. [I understand that this is what I am supposed to write in order to allow the player to give stuff to people.]

Check giving it to:
if the noun is unassigned, say “You have decided to keep [the noun] for yourself, even though you are not crazy about [the identity of the noun].” instead;
if the second noun receives the noun, continue the action; [This syntax, because I am not allowed to write “if __ does not receive __” ]
else say “No, this is not [regarding the second noun][their] present.” instead.

[Now, this is the rule that triggers the error:]

After giving something to a person:
say "[The second noun] unwraps your present with anticipation. Seeing that it is [a noun], [regarding the second noun][they] ";
if the second noun loves the identity of the noun:
say “shouts with glee: ‘Yippee! I was dreaming about having my own [noun]!’[paragraph break]You are beaming.”;
else:
say “frowns with indifference. ‘Oh. [A noun]. Thanks.’[paragraph break]You probably didn’t hit a nerve, here, boss.”

Carry out examining an assigned thing:
let T be the taker of the noun;
say “Oh, you can’t wait to see [T] open [the noun] you bought for [regarding T][them]! You hope [they] like[s] [identity of the noun]!” instead.

Carry out examining an unassigned non-living thing:
say “You haven[’]t bought this for anyone.” instead.

Carry out examining a person:
say “[regarding the noun][They] looks excited…”

The Office is a room.

The Treasure Island is in the office. The indefinite article of Treasure Island is “a copy of”. The printed name is “[italic type]Treasure Island[roman type]”. The identity of Treasure Island is books. The Ulysses is in the office. The printed name is “[italic type]Ulysses[roman type]”. The identity of Ulysses is books. The indefinite article of Ulysses is “a copy of”.

Some TNT is in the office. The indefinite article is “a package of”. Understand “package” as the TNT. The identity of the tnt is explosives. Some nitroglycerin is in the office. The indefinite article is “a small tank of”. Understand “tank” or “small tank” as the nitroglycerin. The identity of the nitroglycerin is explosives.

The trumpet is in the office. The identity of the trumpet is musical instruments. The oboe is in the office. The identity of the oboe is musical instruments. The bandoneon is in the office. The identity of the bandoneon is musical instruments.

Mary, Beth, and Svetlana are women in the office. John and Ferguson are men in the office. In the office is a man called The Dude.[/code][/rant]


#2

Not sure why but the problem arises when you declare that a thing can have an identity without giving it its own name.

This causes the error:

[code]“Presents” by Aika

Identity is a kind of value. The identities are musical instruments, explosives, books, and uncategorised.

A thing has an identity. [PROBLEM LINE]

Loving relates various people to one identity. The verb to love means the loving relation.

Start is a room.

When play begins:
if yourself loves explosives, say “Bingo”.[/code]

This does not:

[code]
“Presents” by Aika

Identity is a kind of value. The identities are musical instruments, explosives, books, and uncategorised.

Loving relates various people to one identity. The verb to love means the loving relation.

Start is a room.

When play begins:
if yourself loves explosives, say “Bingo”.[/code]

Neither does this:

[code]
“Presents” by Aika

Identity is a kind of value. The identities are musical instruments, explosives, books, and uncategorised.

Loving relates various people to one identity. The verb to love means the loving relation.

A thing has an identity called the DifferentName.

Start is a room.

When play begins:
if yourself loves explosives, say “Bingo”.[/code]

This fixes the error appearing in your code:

[code]“Presents Fixed” by Aika

Use serial comma.

Identity is a kind of value. The identities are musical instruments, explosives, books, and uncategorised.

A thing has an identity called the ThingIdentity. The ThingIdentity of a thing is usually uncategorised.

Loving relates various people to one identity. The verb to love means the loving relation.

Receiving relates one person (called the taker) to one thing. The verb to receive means the receiving relation.

A thing can be assigned or unassigned. A thing is usually unassigned.

Definition: a thing is non-living if it is not a person.

When play begins:
now everything is unassigned;
repeat with P running through people who are not the player:
now P loves a random identity (called id) that is not uncategorised;
now P receives a random unassigned non-living thing (called gift);
say “You have bought [a gift] for [P]. [They] likes [id].”; [This is a testing output, just to see how this works. It is not supposed to be included in the final draft.]
now the gift is assigned.

[About giving]

The block giving rule is not listed in the check giving it to rules. [I understand that this is what I am supposed to write in order to allow the player to give stuff to people.]

Check giving it to:
if the noun is unassigned, say “You have decided to keep [the noun] for yourself, even though you are not crazy about [the ThingIdentity of the noun].” instead;
if the second noun receives the noun, continue the action; [This syntax, because I am not allowed to write “if __ does not receive __” ]
else say “No, this is not [regarding the second noun][their] present.” instead.

[Now, this is the rule that triggers the error:]

After giving something to a person:
say "[The second noun] unwraps your present with anticipation. Seeing that it is [a noun], [regarding the second noun][they] ";
if the second noun loves the ThingIdentity of the noun:
say “shouts with glee: ‘Yippee! I was dreaming about having my own [noun]!’[paragraph break]You are beaming.”;
else:
say “frowns with indifference. ‘Oh. [A noun]. Thanks.’[paragraph break]You probably didn’t hit a nerve, here, boss.”

Carry out examining an assigned thing:
let T be the taker of the noun;
say “Oh, you can’t wait to see [T] open [the noun] you bought for [regarding T][them]! You hope [they] like[s] [ThingIdentity of the noun]!” instead.

Carry out examining an unassigned non-living thing:
say “You haven[’]t bought this for anyone.” instead.

Carry out examining a person:
say “[regarding the noun][They] looks excited…”

The Office is a room.

The Treasure Island is in the office. The indefinite article of Treasure Island is “a copy of”. The printed name is “[italic type]Treasure Island[roman type]”. The ThingIdentity of Treasure Island is books. The Ulysses is in the office. The printed name is “[italic type]Ulysses[roman type]”. The ThingIdentity of Ulysses is books. The indefinite article of Ulysses is “a copy of”.

Some TNT is in the office. The indefinite article is “a package of”. Understand “package” as the TNT. The ThingIdentity of the tnt is explosives. Some nitroglycerin is in the office. The indefinite article is “a small tank of”. Understand “tank” or “small tank” as the nitroglycerin. The ThingIdentity of the nitroglycerin is explosives.

The trumpet is in the office. The ThingIdentity of the trumpet is musical instruments. The oboe is in the office. The ThingIdentity of the oboe is musical instruments. The bandoneon is in the office. The ThingIdentity of the bandoneon is musical instruments.

Mary, Beth, and Svetlana are women in the office. John and Ferguson are men in the office. In the office is a man called The Dude.[/code]


#3

OK, this makes sense now. :unamused: It is like saying:

A thing has a number called hit points.

versus:

A thing has a number.

How come the compiler did not call me on this, though? :question:

Thank you very much!


(Andrew Plotkin) #4

You can declare properties either way. That’s fine.

This seems to be a conflict between declaring “A thing has an identity” and an identity relation, which also specifies an identity for each thing.


(matt w) #5

Do you mean that there’s a built-in identity relation, or “Loving relates various people to one identity”? Because it’s not obvious to me why the latter should be incompatible with “A thing has an identity.”


(Andrew Plotkin) #6

I mean the latter. It’s not obvious to me either, but that’s the only angle that I see that could be causing a problem. Given the examples posted above. (I haven’t tried compiling anything.)


#7

Here is some short code to reproduce the problem.

Testing Suite is a room.

A bar is a kind of value. The bars are bang and bong. A person has a bar.
Fooing relates various people to one bar. The verb to foo means the fooing relation.

When play begins:
	say whether or not the player foos bang.

The error disappears if the line “A person has a bar” is removed. Which is odd, since there is no reference to “the bar of [anyone]” in the code. But it’s clear that zarf is right that there’s a conflict between the relation and the property. It looks like a variant of bug 1941.

[Deleted: I previously posted what I thought was evidence that your code wasn’t setting up the loving relation property at all. But that turned out to be nothing to do with your code, but rather a bug in the RELATIONS command (probably related to bug 1782).]