0

当玩家角色进入他们所居住的孤儿院/寄宿学校的教职工室时,该玩家有两个回合才能听到经理的脚步声从大厅传来,他们被催促躲藏起来。我通过使用数字变量来做到这一点。在这一点上,我有另一个数字变量(通过仅使用 0 和 1 设置为真/假的东西)来控制是否尝试做任何事情,除了“隐藏”或“错误隐藏”给出响应“没有时间那,只是隐藏!问题是这样的:每当我开始游戏时,ANY ACTION 都会被拒绝并遇到“没有时间,只是隐藏!”。

代码:

NOTSITS is a number variable.

When play begins:
    now NOTSITS is 0.

Every turn when the location is the Staffroom:
    increase NOTSITS by 1.

Every turn when the location is the Staffroom:
    if NOTSITS is 2:
        now HYF is 1;
        say "From the hall outside, you hear footsteps... Shit, that sounds like Rodger![paragraph break]HIDE!".

HYF is a number variable.

When play begins:
    now HYF is 0.

Every turn :
    if HYF is 1:
        instead of doing anything other than hiding or hiding wrongly:
            say "There's no time for that, just hide!".

Hiding is an action applying to nothing.
Understand "hide" as hiding.
Hiding wrongly is an action applying to one thing.
Understand "hide in [something]" as hiding wrongly.
Instead of hiding:
    try entering the empty cupboard;
    now HYF is 0.
Instead of hiding wrongly, say "Don't waste time with stupidity, just hide!"

请不要建议使用 Inform 7 自己的时间系统来解决这个问题。我试过了,这是一个比这更大的问题。

4

2 回答 2

1

我认为问题在于您过于依赖每回合规则,但它们在所有动作都被处理后运行,因此它们也为时已晚。我还将隐藏定义为进入的同义词,因为该操作已经存在,并且这是您想要发生的事情。所以试试这个:

First turn is a truth state variable. First turn is true.

The staffroom is a room.
In the staffroom is an enterable container called the empty cupboard.

Understand "hide" as entering.
Carry out entering when first turn is true:
    now first turn is false;

Understand "hide in [something]" as a mistake ("Don't waste time with stupidity, just hide!").

Instead of doing something other than looking or entering when first turn is true:
    say "There's no time for that, just hide!";

(此外,如果您提供完整的源代码,或者至少提供所有相关的源代码,这将有所帮助。这次您省略了员工休息室和橱柜。)

于 2013-12-24T00:51:04.647 回答
1

您可以指定进入房间后的动作及其出现时间:

After going to Staffroom for the first time:
     manager comes in three turns from now.

At the time when manager comes:
     YOUR STUFF
于 2017-02-17T15:41:27.590 回答