我有以下代码..
Router::prefix('api', function ($routes) {
$routes->prefix('1.0', function ($routes) {
$routes->connect('/:controller');
});
});
不幸的是,这会阻止打印房间描述。如果我添加“继续行动”;最后输出是“你听到远处的巨响!”在房间描述之前。我真的很想要房间描述。如果我加上“试试看”;作为第一行,它打破了简短/详细的模型。如何对此进行编码以获得以下输出?
(详细)
After going to room1:
if button1 is switched on:
say "You hear a loud noise in the distance!";
(简短地说,第二次访问房间时)
>e
Room1
This is a small room.
There is a letter here.
You hear a loud noise in the distance!
答案 0 :(得分:3)
这种情况正在发生,因为"""规则在"报告"之前运行规则,房间描述由报告规则打印。所以你有几个选择来解决它:
在您的后规则中打印房间描述。正如你所注意到的,"试着寻找"打破简短模式,因为它总是响应,就像玩家输入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!"
答案 1 :(得分:0)
这是因为“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;
这有点类似于“相反”规则的工作原理 - 默认情况下,规则会终止进一步处理(但是规则默认为失败而不是成功)。