【发布时间】:2016-03-04 09:58:52
【问题描述】:
我正在尝试检查屏幕上的颜色,如果颜色与我预定的字符串一起返回,那么我想点击我在程序开始时设置的变量。
math.randomseed(os.time())
xvar = (math.random(100) + 300)
yvar = (math.random(100) + 560)
touch = function()
local color = getColor(300,560)
if color == 16711422 then
tap(xvar ..','.. yvar)
else
usleep(5000000)
collectgarbage()
touch()
end
end
touch()
当我在应该是颜色的地方运行它时,我会收到警报:
/Applications/AutoTouch.app/Extensions.lua:105: 'touchDown' 的参数 #2 错误(预期数字,得到字符串)
我知道我的语言是粗制滥造的,我还在学习细则。有时我的很多错误都直接来自无效的结构。
正确的代码是 tap(x,y)。 我只是假设我可以输入我之前已经注意到的全局变量。
【问题讨论】: