Sign in to follow this  
Followers 0
SyncStark

How to loop pixelsearch?

2 posts in this topic

Hi, I would like some help too, I explain myself :

I would like my bot detects a button that appears several times between two time requiring automated actions that the bot does not need to.

But I do not know how to do, I tried to make a code with a "First time" (First time to the first button, Second Time for the second button etc.)

And a system of HuntPixel, which is 0 to 3 if the bot can not find the button it adds 1 to HuntPixel, it reached 3 then it will abandon the search and press another button.

I did all this in a function but when I call, it does not work!

I give you all the code, I also wonder if it was possible to improve it or if I made mistakes that I can correct.

Thank you very much !

 

;FT MEANS FIRST TIME, I WILL ADD ST AND TT

HotKeySet("{F9}", "MyExit")

;-----VARIABLES-----

Global $MouseLeft
Global $HuntPixelFT = 0


Global $ColorSkipButton = 0x2C3A47

 Global $LeftSkip = 613
 Global $TopSkip = 28
 Global $RightSkip = 677
 Global $BottomSkip = 47

 Global $ClickMouse = $MouseLeft
 Global $SearchResult

;-----FONCTIONS-----

Func MyExit()
         Exit
      EndFunc


Func AutoSkipFT()

While 1
   $SearchResult = PixelSearch($LeftSkip, $TopSkip, $RightSkip, $BottomSkip, $ColorSkipButton, 5)

     If @error Then
        ContinueLoop
        $HuntPixelFT = $HuntPixelFT +1

        ElseIf $HuntPixelFT = 3 Then

           ExitLoop

            Sleep(2000)

           MouseClick("Left", 497, 349)

      EndIf
Wend

EndFunc

;-----CODE-----

 WinActivate("Mobizen")

Sleep(1000)

WinMove("Mobizen", "", 0, 0)

sleep(500)

MouseClick("left", 490, 339)

sleep(4000)

MouseClick("left", 581, 132)

sleep(2000)

MouseClick("left", 490, 339)

Sleep(20000)

AutoSkipFT()

 

Share this post


Link to post
Share on other sites



Make a new thread instead of bumping a 6 year old one. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0