need help with if else Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Lukk54
Posts: 9
Joined: 06 Mar 2021, 04:09

need help with if else

Post by Lukk54 » 20 Apr 2021, 02:39

Hello i made script, which finds images adn than click on it, first one finds online, when online is not found it search fortniteonline. But the last one isnt working, i want to make like if online and fortniteonline not found search offline. Can anyone help me please? Sorry for bad eng. :(

Code: Select all

l::
coordMode,pixel
ImageSearch,ix,iy,0,0,1920,1080, online.png
if (ix)
{
    Mousemove, ix, iy
    Sleep 10
    Click
}
else if (ErrorLevel = 1)
{
ImageSearch,ix,iy,0,0,1920,1080, fortniteonline.png
MouseClick, left,  ix+20, iy+20
}
else
{
ImageSearch,ix,iy,0,0,1920,1080, offline.png
MouseClick, left,  ix+20, iy+20
}
Return
[Mod edit: [code][/code] tags added.]
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: need help with if else  Topic is solved

Post by Rohwedder » 20 Apr 2021, 02:54

Hallo,
perhaps:

Code: Select all

l::
coordMode,pixel
ImageSearch,ix,iy,0,0,1920,1080, online.png
if !ErrorLevel
{
	Mousemove, ix, iy
	Sleep 10
	Click
}
else
{
	ImageSearch,ix,iy,0,0,1920,1080, fortniteonline.png
	if ErrorLevel
		ImageSearch,ix,iy,0,0,1920,1080, offline.png
	if !ErrorLevel
		MouseClick, left, ix+20, iy+20
}
Return
Lukk54
Posts: 9
Joined: 06 Mar 2021, 04:09

Re: need help with if else

Post by Lukk54 » 20 Apr 2021, 02:59

thanks so much.
Post Reply

Return to “Gaming Help (v1)”