【问题标题】:AHK pixelgetcolor and pixelsearch simply don't workAHK pixelgetcolor 和 pixelsearch 根本不起作用
【发布时间】:2021-08-29 14:13:00
【问题描述】:

我有以下两个功能不起作用

CheckConditionColor()
{
cond = -1

while cond = -1
{

    pixelgetcolor, cond, 137, 298, RGB
    if cond = F1F1F1 ;excellent
        return 3
        
    pixelgetcolor, cond, 77, 302, RGB
    if cond = AAAAAA ;normal
        return 0
    pixelgetcolor, cond, 78, 301, RGB
    if cond = F1F1F1 ;poor
        return 1
    pixelgetcolor, cond, 105, 297, RGB
    if cond = 123123 ;good
        return 2
}

}

还有

CheckConditionColor()
{
;pixelgetcolor, condition, 65, 300, RGB
errorlevel = -1

while errorlevel = -1
{
    pixelsearch,,, 64, 300, 68, 306, C2FFFF, 10, fast rgb ;needs to come first prolly
        if errorlevel >= 0
            return 3 ;excellent
    pixelsearch,,, 64, 300, 68, 306, FFFFFF, 10, fast rgb
        if errorlevel >= 0
            return 0 ;normal 
    pixelsearch,,, 64, 300, 68, 306, 656565, 10, fast rgb
        if errorlevel >= 0
            return 1 ;poor
    pixelsearch,,, 64, 300, 68, 306, FFA0D9, 10, fast rgb
        if errorlevel >= 0
            return 2 ;good
    

;msgbox % errorlevel
}   

    
return -1

}

我知道颜色是正确的并且像素位置是正确的。通过测试我知道可以通过这种方法从这个程序中获取颜色。我将 while 循环放入只是试图强制解决问题,它们可能没有必要。

脚本中有一个函数利用了这一点,带有两个 if 语句。 If cond <= 1 另一个是 if cond >= 2

我必须假设我缺少一些明显的东西。

我把它分解成这样:

]::
pixelgetcolor, cond, 77, 302, Slow RGB
if cond = AAAAAA
    ;return 0
    msgbox % cond
return          

每次都能得到预期的结果,所以有什么想法我可能做错了吗?我更愿意专注于让我列出的第一个方法起作用,因为它对于这个应用程序来说似乎更可靠。

【问题讨论】:

    标签: autohotkey


    【解决方案1】:

    试试这个

    pixelgetcolor, cond, 77, 302, Slow RGB
    if cond = 0xF0F0F0
    

    使用十六进制值时需要0x前缀

    https://www.autohotkey.com/docs/commands/SetFormat.htm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多