【发布时间】:2021-02-23 07:16:42
【问题描述】:
我是 AutoHotKey 的新手,我想为 Flash 游戏创建一个脚本宏,但是当我运行它时,它会产生错误。
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
condChecker := false
state := true
Mine()
{
Sleep, rand(10,80)
Send, {Space}
while(state = true)
{
PixelGetColor, gemColor, 982, 433
if(gemColor = B93557)
{
state := true
{
else(gemColor = 96885A)
{
state := false
}
Sleep, rand(90,120)
}
}
^-::
loop 10000
{
getState()
if(state = true)
{Mine()}
else
{Sleep, rand(70,150)}
}
当我在 ahk 文件上按 Run Script 时,会弹出一个菜单说
第 20 行出错。
其他行文本(gemColor = 96885A) 错误:函数不能包含函数。
程序现在将退出。
我不知道从哪里开始出现这个错误,我在其他论坛上读到说我的格式不正确。
【问题讨论】:
-
您的意思是写
else if (...)? autohotkey.com/docs/commands/IfExpression.htm#ExComplex
标签: autohotkey