0

我决定尝试一下 Inform7,我玩得很开心,看看它有什么可能。目前,使用在线提供给我的教程,我正在尝试结合白天/黑夜循环和睡眠,这将仅在一个夜间循环中对玩家可用。我遇到了一些麻烦,因为 Inform7 忽略了我的 if 语句,并且玩家可以在一天中的任何时间睡觉,这不是我想要的。我确定我刚开始时忽略了一些愚蠢的事情,但也许有人会好心让我知道我能做些什么来解决这个问题?非常感谢。

对于我的代码中的任何错误,我深表歉意,请记住我是新手并且想学习。

这是我的代码。. .

The sun is a backdrop. It is everywhere. The description is "Currently out of sight."

Night is a recurring scene. Night begins when play begins. Night begins when the time of day is 10:00 PM. Night begins when Dusk ends. Night ends when the time of day is 1:30 AM.

When Night begins:
    say "The moon is up and the temperature drops abruptly to well below zero.";
    now the description of the sun is "Currently out of sight."

The witching hour is a recurring scene. The witching hour begins when Night ends. The witching hour ends when the time of day is 5:00 AM.

When The witching hour begins:
    say "You feel sleep calling you.";
    now the description of the sun is "Currently out of sight.".

Day is a recurring scene. Day begins when The witching hour ends. Day ends when the time of day is 6:00 PM.

When Day begins:
    say "The sun is now properly up.";

Dusk is a recurring scene. Dusk begins when Day ends. Dusk ends when the time of day is 10:00 PM.

When Dusk begins:
    say "The sun is setting.";
    
A person is either awake or asleep. A person is usually awake.

Every turn: 
    if The witching hour is not happening:
instead of sleeping when the player is awake:
    now the player is awake; 
    say "You can't sleep now. . .";

Every turn:
    if The witching hour is happening:
instead of sleeping:
    now the player is asleep;
    say "You fall asleep. . ."; 
    
Every turn:
    if The witching hour is happening:
instead of doing something other than waking up, waiting or sleeping when the player is asleep:
    say ". . . You're sleeping.";

Every turn:
    if The witching hour is happening:
instead of sleeping when the player is asleep: 
    say "Zzzz.";

Every turn:
    if The witching hour is happening:
instead of waking up when the player is asleep: 
    now the player is awake; 
    say "You wake suddenly.";
    
Every turn:
    if The witching hour is happening:
instead of doing something other than looking or sleeping when the player is awake: 
    say "You'd really rather just sleep. . .";
4

1 回答 1

1

您不能将规则(或任何其他类型的规则)放在其他规则中。编译器应该真的在那里抛出一个错误,但不幸的是它没有。您需要做的是删除所有Every turn:行并将所有 if 条件与相反规则条件结合起来。例如:

Instead of sleeping when the player is awake and the witching hour is not happening:
    say "You can't sleep now. . .";

Instead of sleeping when the witching hour is happening:
    now the player is asleep;
    say "You fall asleep. . ."; 

其余的规则依此类推。

于 2020-12-03T23:17:14.723 回答