In message 7, why does this complex expression work as a replacement for text?

Here is a snippet of code to show what I have in my source code:

A morph is a kind of thing. A morph has some text called animal name. A serum is a kind of thing. Revelation relates one serum to one morph. The verb to reveal (he reveals, he revealed, it is revealed, he is revealing) implies the revelation relation. 

In my game I want to drink whey so that the player can turn into a specific animal. The name of this animal is stored as a text property called "animal name". I want to be able to refer to this name only with the serum itself, so I added a link between the morph and the whey object.

Then I add this rule:

 Instead of drinking a serum: say "You can now become a [animal name of morph revealed by noun]."; now the morph revealed by the noun is held by the player; 

What I'm doing here is to print this message and then move the appropriate morph into the player’s inventory. I do this for other reasons, but I need to do this.

So, for example, given these statements:

 Felis morph is a morph. Cat serum is a serum. Cat serum reveals felis morph. The animal name of felis morph is "cat". 

I would expect that you drink cat serum to print “Now you can become a cat” and turn felis into a player’s inventory.

I get two errors, though, I'm not sure how to solve them.

1) In the sentence "say," you can now become [the animal name of the morph revealed by the noun] "." You seem to suggest that the “animal morph name revealed by the noun” is the property, but the “morph” is not specific enough about who or what the owner is.

2) You wrote: “Now the morph opened by the noun is held by the player”: but this is not clear enough and should define certain relations between specific things, for example, “the cat is now in the bag”, and not something more elusive, like “now the cat carried by a woman. " (What woman? This is a problem.)

It seems that the rule I added just doesn't want to work. It revolves around the [animal name of the morph revealed by the noun] part, and "the morph revealed by the part of the noun." However, this sounds like quite reasonable things. The name of the animal morph disclosed by the noun must be a pronounced work. The morph revealed by the noun must be very specific - I pointed out that revelation connects one serum with ONE morph, in the end.

What is the problem? Rather, how do I get the name of an animal of a detected morph as a text replacement and how do I change the state of morphine detected by serum?

+5
source share
1 answer

The problem is that when you write a phrase like the morph revealed by noun , where you access an object through a relation, Inform assumes that several objects can have this property, even if it is not real (for example, this case where the exponential relation one-to-one).

The solution here is to use the a random determinant to actually select an item from the list. This qualifier will select a random object from the list on which it acts, but since both lists here can contain only one object, you will receive the same object every time. Here is a working example:

 Instead of drinking a serum: say "You can now become a [animal name of a random morph revealed by noun]."; now a random morph revealed by the noun is held by the player; 

You can also use the every qualifier, but since it also gives you a list, it will not work for all applications (the second statement in the above example works, but not the first).

+3
source

All Articles