Hello i need some help with my first script. The idea is: searching pixel in cycle in given coordinates, if pixel found, then playing sound in cycle until for example "END" key pressed. First i tried with simple PixelSearch example:
Code: Select all
CoordMode, Pixel, Screen
PixelSearch, Px, Py, 162, -659, 289, -329, 0x040493, 3, Fast
if ErrorLevel
MsgBox, That color was not found in the specified region.
else
MsgBox, A color within 3 shades of variation was found at X%Px% Y%Py%.
And everything works fine. But when i start digging with Loop function i'm confused. For example:
Code: Select all
Loop
{
Sleep 1000
CoordMode, Pixel, Screen
PixelSearch, Px, Py, 162, -659, 289, -329, 0x040493, 3, Fast
if ErrorLevel,
Return
else
SoundPlay *-1
}
Esc::ExitApp
This script playing sound every 1 second right after start even if pixel not found. I think i messed something with if ErrorLevel, Return commands but cant understand how. Thank you for any help.