2

我处于这样的情况:

"Cream Corner" by Lynn

An ice cream cone is a kind of edible thing.
An ice cream cone has a number called scoop count.

Rule for printing the name of an ice cream cone:
    say "[the scoop count in words]-scoop ice cream cone". 

The Cream Corner is a room.
The player holds an ice cream cone with scoop count 3.

现在我想> eat three-scoop工作。我可以做这个:

Understand "one-scoop" as an ice cream cone
    when the scoop count of the item described is 1.
Understand "two-scoop" as an ice cream cone
    when the scoop count of the item described is 2.
Understand "three-scoop" as an ice cream cone
    when the scoop count of the item described is 3.
[ ... ]

但当然,理想情况下,我想写一个这样的规则:

Understand "[number]-scoop" as an ice cream cone
    when the scoop count of the item described is the number understood.

但是,Inform 文档指出这是不可能的

因此,例如,我们不能安全地说“当名词是松果”,或者指代诸如“理解的数字”之类的东西。(我们还没有完全理解。)如果我们想要更复杂地处理这种情况,我们需要按照通常的方式编写检查规则等。

All the same, it isn’t clear to me how to replace such a rule with a checking rule “in the usual way”. How do I use checking rules to make [number]-scoop in the player’s command be interpreted as “an ice cream cone with that many scoops”?

4

1 回答 1

2

我不太确定文档暗示我们在那里做什么,但我可以帮助解决基本问题。部分解决方案是这两行:

Understand the scoop count property as referring to an ice cream cone.
Understand "scoop" as an ice cream cone.

three scoop cone这允许玩家键入或之类的东西three ice cream cone,并理解三勺锥体。

这只是部分解决方案,因为我们不包括破折号*,所以take three-scoop cone不会正确理解类似的东西。解决此问题的明显方法是在读取命令之前完全替换破折号,如下所示:

[Nonfunctional solution!]
After reading a command:
    If the player's command includes "-scoop":
        replace the matched text with " scoop";

但是,这似乎不起作用,因为上述规则仅匹配整个单词-即,three -scoop,但不匹配three-scoop。尝试仅通过替换来做同样的事情同样-失败。

*您也可以争辩说这three ice cream cone不应该是一个有效的匹配。

于 2018-03-19T22:11:25.283 回答