Help with Loop Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Spxctator
Posts: 1
Joined: 04 Jan 2021, 01:20

Help with Loop  Topic is solved

Post by Spxctator » 04 Jan 2021, 01:30

I need help with this loop, intended and expected function: send a message every 3 seconds if it doesn't detect a grey pixel (using pixelgetcolor) and blue pixels (using pixelsearch) in an area.
It works without the pixelsearch and errorlevel line.

Code: Select all

Loop
{
PixelGetColor, DetectMath, 700, 850
PixelSearch, X, Y, 900, 700, 1200, 900, 0xF4A420
	if (DetectMath = 0x36312F)
	{
		SoundBeep
		Pause
	}
	else if (ErrorLevel = 0)
	{
		SoundBeep
		Pause
	}
	else
    {
		Send, test{enter}
		Sleep 3000
    }
}
return
Edit: Solved by editing line 4.

Code: Select all

Loop
{
PixelGetColor, DetectMath, 700, 850
PixelSearch, VarX, VarY, 900, 700, 1200, 900, 0xF4A420, 15, Fast
    if (DetectMath = 0x36312F)
    {
        SoundBeep
        Pause
    }
    if (ErrorLevel = 0)
    {
        SoundBeep
        Pause
    }
    else
    {
        Send, test{enter}
        Sleep 3000
    }
}
return
Last edited by Spxctator on 04 Jan 2021, 02:31, edited 1 time in total.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Help with Loop

Post by Xtra » 04 Jan 2021, 02:09

Code: Select all

Loop
{
    PixelGetColor, DetectMath, 700, 850
	if (DetectMath = 0x36312F)
	{
		SoundBeep
		Pause
	}
	else
	{
		PixelSearch, X, Y, 900, 700, 1200, 900, 0xF4A420
		if (ErrorLevel = 0)
		{
			SoundBeep
			Pause
		}
		else
		{
			Send, test{enter}
			Sleep 3000
		}
	}	
}
return
Post Reply

Return to “Ask for Help (v1)”