Autohotkey 不检查 if 语句条件

Autohotkey doesn't check if statement condition

我的脚本应该检查变量的值,如果它是 0,它应该重新映射一些键,如果值不是 0,它不应该重新映射任何键,或者 运行任意一个热键:(我的变量叫chatbox

#IfWinActive Minecraft 1.8.9
  If (ChatBox = 0){
    1::z
  }
#IfWinActive

但是不行! AHK 不检查变量:

---- C:\Users\...\mysimplescript.ahk
157: SPI_SETDEFAULTINPUTLANG := 0x005A
157: SPIF_SENDWININICHANGE := 2
030: Return (3.41)
263: Send,z (0.02)
263: Return (2.50)

为什么我不在热键中使用 if 语句?我做到了!问题是,它并不真正适用于游戏,它可能只是 Windows 的工作方式,我试过这个:

1::
  If (ChatBox = 0)
    send z
  else
    send 1
return

我不想在热键中使用 if 语句,我的问题是,我希望通过更改变量来激活某些热键。

这将根据变量有条件地执行热键:

#If ChatBox = 0
  1::z
#If

这会根据变量有条件地执行热键 window:

#If WinActive("Minecraft 1.8.9") and ChatBox = 0
  1::z
#If

REF:https://autohotkey.com/docs/commands/_If.htm