我已经决定在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. . .";发布于 2020-12-04 07:17:15
您不能将规则(或任何其他类型的规则)放入其他规则中。编译器真的应该在那里抛出一个错误,但不幸的是,它没有。你需要做的是删除所有的Every turn:行,并将所有if条件与instead规则条件结合起来。例如:
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. . ."; 对于其余的规则,依此类推。
https://stackoverflow.com/questions/65134667
复制相似问题