How to make an IF image found with this condition Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

How to make an IF image found with this condition

Post by Ahmed79 » 22 Jan 2022, 10:30

I am writing a macro to use with a game in Bluestacks Android emulator.
Started using this amazing macro creator by Pulover since yesterday for the first time.

I've figured out a lot of things by myself, but one thing I can't figure out is how to make an IF statement for image search where whichever of the 2 images is shown first, the next set of command is followed accordingly.

The code I've got working so far is this :

Code: Select all

IfWinActive, BlueStacks 3
{
    Loop
    {
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224100.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224100.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; extreme mode
            Sleep, 50
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224307.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224307.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; play match for 60
            Sleep, 60
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122122315.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122122315.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; select mode
            Sleep, 1000
        }
        Until ErrorLevel = 0
        ReJoin:
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, *20 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224908.png
            CenterImgSrchCoords("*20 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224908.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; join
            Sleep, 1000
        }
        Until ErrorLevel = 0
        CoordMode, Pixel, Window
        ImageSearch, FoundX, FoundY, 390, 333, 829, 529, *10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png
        CenterImgSrchCoords("*10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png", FoundX, FoundY)  ; room closed
        Sleep, 1000
        If (ErrorLevel = 0)
        {
            Goto, ReJoin
        }
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 122, 64, 219, 131, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; team vs 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 6, 35, 1214, 711, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143323.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143323.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; team vs show 2
            Sleep, 1500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 520, 669, 588, 710, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150623.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150623.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; after results - first tap
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 519, 674, 610, 712, *90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122151204.png
            CenterImgSrchCoords("*90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122151204.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 2nd tap
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 520, 661, 591, 705, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150035.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150035.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 3rd tap
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 6, 35, 1214, 711, *90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124605.png
            CenterImgSrchCoords("*90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124605.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 4th tap
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 516, 665, 609, 710, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122191706.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122191706.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 5th n final tap to continue
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 6, 35, 1214, 711, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124723.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124723.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; back to selection screen of step 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
    }
}
Now what I need is to be able to go back to label 'ReJoin' if the image 'Screen_20220122194622.png' (commented as room closed) is found just after the image (commented as join) ..... and if the image 'Screen_20220122143313.png' (commented as team vs 1) is found instead , then it should continue forward normally.
Both of these images (('Screen_20220122194622.png' (commented as room closed) and 'Screen_20220122143313.png' (commented as team vs 1)) will appear after a random delay just after the image 'Screen_20220121224908.png' (commented as join) is displayed on the screen.

Thanks for any help.. will be greatly appreciated.

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: How to make an IF image found with this condition

Post by mikeyww » 22 Jan 2022, 11:13

Images are searched one at a time, but you can search for two images and then act according to the combined findings.

Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

Re: How to make an IF image found with this condition

Post by Ahmed79 » 22 Jan 2022, 14:35

@mikeyww That's what I'd like to do, but I don't exactly know how to put it down in code format.

Till now I only know of searching one image at a time and doing accordingly.. but I couldn't precisely find in the tutorials where something similar to what you mentioned could be done.

I'd appreciate it alot if you could kindly guide me on writing this.

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: How to make an IF image found with this condition

Post by mikeyww » 22 Jan 2022, 14:48

An example is below.

Code: Select all

dir = %A_ScriptDir%
Loop {
 Sleep, 200
 SoundBeep, 1900
 ImageSearch,,, 0, 0, 1000, 1000, %dir%\image1.png
 err1 := ErrorLevel
 ImageSearch,,, 0, 0, 1000, 1000, %dir%\image2.png
 err2 := ErrorLevel
 If !err1
  MsgBox, 64, Status, Image 1 was found!
 If !err2
  MsgBox, 64, Status, Image 2 was found!
} Until !err1 || !err2
MsgBox, 64, Done, Done!

Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

Re: How to make an IF image found with this condition

Post by Ahmed79 » 22 Jan 2022, 20:50

@mikeyww Thanks a lot, I'll try to incorporate it into my macro and update you back here on its functioning.

Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

Re: How to make an IF image found with this condition

Post by Ahmed79 » 23 Jan 2022, 05:17

@mikeyww I incorporated the example you posted earlier, as best as I could into my macro.
But now for some reason the main loop of the macro which was there from the beginning has stopped working, I mean once the macro reaches it's end, it doesn't go back to the start unlike before.

Could you please kindly have a look at it?

Code: Select all

IfWinActive, BlueStacks 3
{
    Loop
    {
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, *10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224100.png
            CenterImgSrchCoords("*10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224100.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; extreme mode
            Sleep, 50
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224307.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224307.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; play match for 60
            Sleep, 60
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122122315.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122122315.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; select mode
            Sleep, 1000
        }
        Until ErrorLevel = 0
        ReJoin:
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1214, 711, *20 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224908.png
            CenterImgSrchCoords("*20 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220121224908.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; join
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 122, 64, 219, 131, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png", FoundX, FoundY)  ; team vs 1
            Sleep, 1000
            err1 := ErrorLevel
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 390, 333, 829, 529, *10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png
            CenterImgSrchCoords("*10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png", FoundX, FoundY)  ; room closed
            Sleep, 1000
            err2 := ErrorLevel
            If (err1 = ErrorLevel)
            {
                Goto, Joined
            }
            If (err2 = ErrorLevel)
            {
                Goto, ReJoin
            }
        }
        Until, !err1 || !err2
        Joined:
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 122, 64, 219, 131, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; team vs 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 6, 35, 1214, 711, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143323.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143323.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; team vs show 2
            Sleep, 1500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 520, 669, 588, 710, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150623.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150623.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; after results - first tap
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 519, 674, 610, 712, *90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122151204.png
            CenterImgSrchCoords("*90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122151204.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 2nd tap
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 520, 661, 591, 705, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150035.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122150035.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 3rd tap
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 6, 35, 1214, 711, *90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124605.png
            CenterImgSrchCoords("*90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124605.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 4th tap
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 516, 665, 609, 710, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122191706.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122191706.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; 5th n final tap to continue
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 6, 35, 1214, 711, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124723.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122124723.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; back to selection screen of step 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
    }
}

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: How to make an IF image found with this condition

Post by mikeyww » 23 Jan 2022, 07:15

I would try the posted script before incorporating it into the rest of your main script. That will help you determine whether the posted script works. You can debug your script by shortening it and testing just one section, to get it working first. You can display the values of variables, as well as conditional statements and ErrorLevels. If ErrorLevel is never 0, then it looks like some of your loops will continue forever without moving to the next command. Determining that will be easy when you display the values.

Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

Re: How to make an IF image found with this condition

Post by Ahmed79 » 23 Jan 2022, 08:30

@mikeywwI removed the newly entered code and rechecked the original macro which seems to work as intended and repeats normally after the end is reached, but after I add the new code, the repeats stop.

I have checked the loop starts and ends multiple times in the new code, but I can't figure out what in the code affects the repeats . :-\

Edit: The weird thing is that the whole macro does reach/execute until the end , but just doesn't seem to repeat once the new code is added in the middle of it.
How do you get the Pulover's macro editor to display the values?

The new code part:

Code: Select all

Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 122, 64, 219, 131, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122143313.png", FoundX, FoundY)  ; team vs 1
            Sleep, 1000
            err1 := ErrorLevel
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 390, 333, 829, 529, *10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png
            CenterImgSrchCoords("*10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1  ; room closed
            Sleep, 1000
            err2 := ErrorLevel
            If (err1 = ErrorLevel)
            {
                Goto, Joined
            }
            If (err2 = ErrorLevel)
            {
                Goto, ReJoin
            }
        }
        Until, !err1 || !err2
        Joined:

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: How to make an IF image found with this condition  Topic is solved

Post by mikeyww » 23 Jan 2022, 08:53

It looks like an issue relating to how you design the flow in the script. I recommend removing Goto and using other approaches (e.g., with variables, While, Break, or just modify your Until statement), because using Goto to jump out of a loop can get you into trouble. The second change I would make is ensuring that you save the ErrorLevel immediately following your search, instead of waiting to do it a few commands later. The third change would be adding :arrow: MsgBox lines to display some of the values as noted earlier. During your testing, you can remove the loop entirely, so that you can figure out what is happening during a single iteration.

Some of the AHK documentation may help. A macro recorder can sometimes get you only so far.

Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

Re: How to make an IF image found with this condition

Post by Ahmed79 » 24 Jan 2022, 09:18

@mikeyww something wrong with this program all of a sudden, it just doesn't want to work at all since yesterday night.
I don't know what happened, but not even a single line of code as simple as the one below seems to be working :(

Code: Select all

IfWinActive, BlueStacks 3
{
    Loop
    {
        CoordMode, Pixel, Window
        ImageSearch, FoundX, FoundY, 934, 163, 1101, 235, *10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124194242.png
        CenterImgSrchCoords("*10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124194242.png", FoundX, FoundY)
        If ErrorLevel = 0
        	Click, %FoundX%, %FoundY% Left, 1
    }
    Until ErrorLevel = 0
}
I restarted the program and even restarted it again with admin's privileges.
In info, it shows that its stuck on row 2/3 and loop 1/1
Any idea what could be causing this?

User avatar
mikeyww
Posts: 26591
Joined: 09 Sep 2014, 18:38

Re: How to make an IF image found with this condition

Post by mikeyww » 24 Jan 2022, 09:38

You haven't followed my previous post, so I reiterate here. Remove IfWinActive, Loop, and your custom function. Test the rest. Display the values of your variables, conditional statements, and ErrorLevels.

Ahmed79
Posts: 7
Joined: 22 Jan 2022, 10:10

Re: How to make an IF image found with this condition

Post by Ahmed79 » 25 Jan 2022, 09:23

@mikeyww Thanks again for your help and patience with me :)

There's certainly a bug in the program, due to which I think the lines although seemingly perfect got corrupted internally.. and if I tried duplicating those lines , they still didn't work.. but if I made an exactly same line of code below or above it from scratch (instead of copying/duplicating it) , it worked as intended.

Anyways, this is the code I wrote all again and seems to be working so far, but I shall update you again if something goes wrong.

Code: Select all

IfWinActive, BlueStacks 3
{
    Loop
    {
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124212819.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124212819.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 942, 569, 1065, 629, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124213228.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124213228.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 484, 222, 698, 292, *10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124215559.png
            CenterImgSrchCoords("*10 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124215559.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        ReJoin:
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 953, 470, 1026, 581, C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124213444.png
            CenterImgSrchCoords("C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220124213444.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            /*
            MsgBox, 64, Status, inside loop2.1
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1137, 670, *5 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125183819.png
            CenterImgSrchCoords("*5 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125183819.png", FoundX, FoundY)
            Sleep, 500
            */
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125185414.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125185414.png", FoundX, FoundY)
            Sleep, 500
            If (ErrorLevel == 0)
            {
                err1 := 0
                MsgBox, 64, Status, inside loop2.2
                /*
                MsgBox, 64, Status, 
                (LTrim
                joined and working! and value is 
                err1
                )
                */
                Goto, Joined
            }
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 8, 37, 1137, 670, *2 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png
            CenterImgSrchCoords("*2 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220122194622.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 1000
            If (ErrorLevel == 0)
            {
                err2 := 0
                /*
                ListVars
                */
                Goto, ReJoin
            }
        }
        Until, ((err1 == 0) || (err2 == 0))
        Joined:
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125185414.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125185414.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125185423.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125185423.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 478, 624, 557, 671, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184032.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184032.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 483, 634, 551, 668, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184102.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184102.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 480, 620, 564, 670, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184142.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184142.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 500
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, *90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184208.png
            CenterImgSrchCoords("*90 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184208.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184225.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184225.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
        Loop
        {
            CoordMode, Pixel, Window
            ImageSearch, FoundX, FoundY, 7, 36, 1139, 670, *50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184246.png
            CenterImgSrchCoords("*50 C:\Users\n0fea\AppData\Roaming\MacroCreator\Screenshots\Screen_20220125184246.png", FoundX, FoundY)
            If ErrorLevel = 0
            	Click, %FoundX%, %FoundY% Left, 1
            Sleep, 1000
        }
        Until ErrorLevel = 0
    }
}


Post Reply

Return to “Gaming Help (v1)”