我决定尝试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. . .";
您不能将规则(或任何其他类型的规则(放在其他规则中。编译器确实应该在那里抛出一个错误,但不幸的是它没有。您需要做的是删除所有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. . .";
对于其余规则,依此类推。