打印房间描述 "after going"通知 7 中的规则



我有以下代码:

After going to room1:
    if button1 is switched on:
        say "You hear a loud noise in the distance!";

遗憾的是,这会阻止打印房间描述。如果我在结尾加上"继续动作;",那么输出是"你听到远处有很大的噪音!"在房间描述之前。我真的想先了解一下房间的情况。如果我在第一行添加"try looking;",它将打破简短/冗长的模型。如何对此进行编码以获得以下输出?

(详细)

>e
Room1
This is a small room.
There is a letter here.
You hear a loud noise in the distance!

(简短,第二次访问房间时)

>e
Room1
There is a letter here.
You hear a loud noise in the distance!

之所以会发生这种情况,是因为"after"规则在"report"规则之前运行,并且房间描述由报表规则打印。所以你有几个选择来修复它:

  • 在您的after规则中打印房间描述。正如你所注意到的,"试着看"打破了简短模式,因为它总是像玩家键入LOOK一样响应,但你可以使用另一个短语(在关于看的标准规则部分中提到):

    After going to room1:
        produce a room description with going spacing conventions;
        if button1 is switched on:
            say "You hear a loud noise in the distance!"
  • 根据打印房间描述后运行的"报告进行"规则打印您的消息:

    Last report going rule (this is the report loud noise in the distance rule):
        if the room gone to is room1 and button1 is switched on:
            say "You hear a loud noise in the distance!"
  • 根据"每回合"规则打印您的消息,该规则在所有行动规则手册之后运行:

    Every turn when the player is in room1 and the player was not in room1:
        if button1 is switched on:
            say "You hear a loud noise in the distance!"

发生这种情况是因为"After"规则默认为"success",这意味着以后发生的任何事情(包括报告规则和房间描述)都会被取消。解决方案是简单地在规则中添加continue the action

After going to room1:
    if button1 is switched on:
        say "You hear a loud noise in the distance!";
    continue the action;

这在某种程度上类似于"替代"规则的工作方式——默认情况下,规则终止进一步处理(但替代规则默认为失败而非成功)。

相关内容

  • 没有找到相关文章

最新更新