inform7 - 在通知 7 中,为什么这个复杂的语句不能用作文本​​替换?

标签 inform7

这是一个代码片段,用于显示我当前在源代码中的内容:

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.

在我的游戏中,我想喝一种血清,让玩家可以变成特定的动物。该动物的名称存储为称为“动物名称”的文本属性。我希望能够仅根据血清本身引用这个名称,因此我添加了变形和血清对象之间的关系。

然后我添加这个规则:
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;

我在这里做的是打印此消息,然后将相关变形移动到玩家的库存中。我这样做是出于其他原因,但我需要这样做。

例如,鉴于这些断言:
Felis morph is a morph.  Cat serum is a serum.
Cat serum reveals felis morph.
The animal name of felis morph is "cat".

我希望在游戏中喝猫血清会打印“你现在可以变成一只猫了。”,并将猫科动物的形态放入玩家的库存中。

但是我收到两个错误,我不知道如何解决。

1) In the sentence 'say "You can now become a [animal name of morph revealed by noun]."' , it looks as if you intend 'animal name of morph revealed by noun' to be a property, but 'a morph' is not specific enough about who or what the owner is.

2) You wrote 'now the morph revealed by the noun is held by the player' : but this is not explicit enough, and should set out definite relationships between specific things, like 'now the cat is in the bag', not something more elusive like 'now the cat is carried by a woman.' (Which woman? That's the trouble.)



看来我添加的规则只是不想起作用。它围绕[名词揭示的变形的动物名称]部分和“名词揭示的变形”部分展开。不过,这些听起来是完全合理的事情。名词所揭示的morph的动物名称应该是一个可说的陈述。名词揭示的变形应该是完全具体的——毕竟,我指出启示将一种血清与一种变形联系起来。

有什么问题?或者更确切地说,如何将显示的变形的动物名称作为文本替换,以及如何更改血清显示的变形的状态?

最佳答案

这里的问题是,当你写出像 the morph revealed by noun 这样的短语时,当您通过关系访问一个对象时,Inform 假定多个对象可以具有此属性,即使这实际上是不可能的(例如,在这种情况下,揭示关系是一对一的)。

这里的解决方法是使用确定器a random从列表中实际选择一个项目。这个确定器会从它作用的列表中随机选择一个对象,但由于这里的两个列表只能包含一个对象,所以每次都会得到相同的对象。这是一个工作示例:

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;

您也可以使用确定器 every ,但由于这也为您提供了一个列表,因此它不适用于所有应用程序(上面示例中的第二个语句有效,但不是第一个)。

关于inform7 - 在通知 7 中,为什么这个复杂的语句不能用作文本​​替换?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31104779/

相关文章:

object - 需要帮助在notify7中创建新对象

inform7 - 如何让inform 7在序列号(行)后打印一行文字?

centering - Inform7:如何使文本居中?

inform7 - Inform 7 中的打印房间描述 "after going"规则

inform7 - 如何理解 Inform 7 互动小说中 's' 仅作为右舷而不是南的缩写?

inform7 - 如何访问玩家刚刚输入的动词?