Performance Question Regarding Multiple PixelGetColor Conditions
Posted: 27 May 2018, 04:33
Hello,
I have the following script which has a couple of PixelGetColor if/else conditions. It's definitely much slower the more conditions I put in there and I think i understand why, but is there a more optimized way of doing this to increase the performance of the script? Any help would be appreciated!
I have the following script which has a couple of PixelGetColor if/else conditions. It's definitely much slower the more conditions I put in there and I think i understand why, but is there a more optimized way of doing this to increase the performance of the script? Any help would be appreciated!
Code: Select all
#MaxThreadsPerHotkey 2
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
CoordMode, Pixel, Window
Toggle = 0
{
$2::
Toggle := !Toggle
While Toggle {
loop,
{
PixelGetColor, color1, 819, 850, RGB
PixelGetColor, color2, 885, 866, RGB
PixelGetColor, color3, 925, 859, RGB
PixelGetColor, color4, 967, 859, RGB
PixelGetColor, color5, 851, 854, RGB
if (color1 = 0xFF0000)
{
Send, {Numpad2}
sleep 10
break
}
else if (color2 = 0xEED3C7)
{
Send, {Numpad3}
sleep 10
break
}
else if (color3 = 0xCA1008)
{
Send, {Numpad4}
sleep 10
break
}
else if (color4 = 0x52DC43)
{
Send, {Numpad5}
sleep 10
break
}
else if (color5 = 0x0A2A00)
{
Send, {Numpad6}
sleep 10
break
}
else {
Send {Numpad1}
sleep 10
break
}
}
}
return
}