首页 > 解决方案 > If statement won't work in Inform 7

问题描述

The toggle is a device.
The toggle is switched on.
If the toggle is switched on:
    say "Hi there.".

The third line shows an error about punctuation, saying the phrase doesn't make sense. How is the punctuation wrong, it seems completely fine?

标签: inform7

解决方案


错误消息有点误导,但核心问题是您需要 if 短语的上下文。换句话说,你需要定义什么时候应该检查条件,否则就太模糊了。

目前尚不完全清楚您希望代码做什么,但您可以拥有例如:

Every turn:
    if the toggle is switched on:
        say "Hi there."

推荐阅读