跳过 if{} 即使条件为真?

skipping if{} even though the condition is true?

我不知道出了什么问题,但是 if 语句正在跳过它的语句,即使条件显然为真。我在 if 语句之前检查了 MsgBox 或 ToolTip,以检查 toughEnemy 是否等于 false。可以看到日志,代码从第55行跳到第60行。。我知道我的代码里有一个flow not ahk,但是我找不到。 有什么帮助吗?谢谢。

Gosub, CheckEnemyBlackList

if (tughEnemy = false) {
MsgBox, %toughEnemy%
    mouseX := 575
    break ; this statement is in a loop.
}

CheckEnemyBlackList:
Loop, read, EnemyBlackList.txt
{
    if (A_LoopReadLine = enemyID) {
    toughEnemy = true
    }
    else {
    toughEnemy = false
    }
}
return

below are the log
166: Loop,read,EnemyBlackList.txt
168: if (A_LoopReadLine = enemyID)  
172: toughEnemy = false
173: }
174: MsgBox,%A_LoopReadLine% %toughEnemy% (0.75)
175: }
176: Return
055: if (toughEnemy = false)  
060: }

尝试更改这些行:

toughEnemy = true
toughEnemy = false

对此:

toughEnemy := true
toughEnemy := false

参考:

  • Autohotkey 帮助 > 基本用法和语法 > 变量和表达式 > 变量 > 在变量中存储值