Jump to content
Dequalityy

Need help sleep/loop.

Recommended Posts

SadBunny

I guess you missed the point in my example :) Set the AdlibRegister outside of the function for the first time (or, alternatively, call the function once), otherwise it will never start up. So:

  • Set adlib one initial time
  • Enter infinite loop
  • Inside the function that was called by the adlib: unregister adlib, beep, set new adlib with new time 
     

/edit: note that your script sets the adlib (which resets it if it was already set) EVERY TIME the error box is NOT found. You need to set it ONE time :)
/edit 2: you may want to Unregister the adlib when the button was found.

Edited by SadBunny
  • Like 1

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Dequalityy
WinActivate("Netstationen Client – Google Chrome")
HotKeySet("{F4}", "ExitProg")

MouseClick("left", 1078, 120, 1, 0)
AdlibRegister("StayOnline", Random(2000, 2500, 1))

While (1)

        $blah = PixelSearch(686, 118, 1102, 487, 0xFFD166, 0) ; Search for OK button.

        If NOT(@error) Then ; If okay button pop's up this will execute a click on the OK button.

            MouseMove($blah[0]+5, $blah[1]+5, 0)
            Sleep(2000)
            MouseClick("left", $blah[0]+5, $blah[1]+5, 2, 0)
            Sleep(1000)

        ElseIf (@error) Then

            AdlibRegister("StayOnline", Random(2000, 2500, 1))

        EndIf

    WEnd

    Func StayOnline() ; Keeps you online.
            AdlibUnRegister("StayOnline")
            Send("/goto 0", 1)
            Sleep(3000)
            Send("{ENTER}", 0)
            AdlibRegister("StayOnline", Random(2000, 2500, 1))

    EndFunc


Func ExitProg() ; Exits Auto
    Exit
EndFunc   ;==>ExitProg

 

Like that? cuz that didnt work :/ 

Share this post


Link to post
Share on other sites
SadBunny

Check my edits in my previous post. Read your script: you are resetting the adlib every time the button is not found. As this happens tens or maybe hundreds of times per second, you are constantly resetting your adlib to somewhere between 2 to 2.5 seconds in the future. So it never actually happens.

  • Like 1

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Dequalityy
6 minutes ago, SadBunny said:

Check my edits in my previous post. Read your script: you are resetting the adlib every time the button is not found. As this happens tens or maybe hundreds of times per second, you are constantly resetting your adlib to somewhere between 2 to 2.5 seconds in the future. So it never actually happens.

Think i got it this time! :D

 

WinActivate("Netstationen Client – Google Chrome")
HotKeySet("{F4}", "ExitProg")

MouseClick("left", 1078, 120, 1, 0)
Sleep(1000)
AdlibRegister("StayOnline", Random(2000, 2500, 1))

While (1)

        $blah = PixelSearch(686, 118, 1102, 487, 0xFFD166, 0) ; Search for OK button.

        If NOT(@error) Then ; If okay button pop's up this will execute a click on the OK button.

            MouseMove($blah[0]+5, $blah[1]+5, 0)
            Sleep(2000)
            MouseClick("left", $blah[0]+5, $blah[1]+5, 2, 0)
            Sleep(1000)

        ElseIf (@error) Then

            Sleep(1000)

            ;AdlibRegister("StayOnline", Random(2000, 2500, 1))

        EndIf

    WEnd

    Func StayOnline() ; Keeps you online.
            AdlibUnRegister("StayOnline")
            Sleep(500)
            Send("/goto 0", 1)
            Sleep(300)
            Send("{ENTER}", 0)
            AdlibRegister("StayOnline", Random(2000, 2500, 1))

    EndFunc


Func ExitProg() ; Exits Auto
    Exit
EndFunc   ;==>ExitProg

Correct? :D

 

Share this post


Link to post
Share on other sites
SadBunny

Looks better. Although I would still suggest to AdlibUnregister as soon as you don't need it to run any more, just because cleaning up is good practice.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Dequalityy

But how that ? and it should run the entire time out it shouldnt stop being paused if thats what u mean :) i mean it should type that message ones every 12-18th minute :)

so it shouldnt stop being paused if thats what u mean  ? :-) 

 

-Dequalityy.

Share this post


Link to post
Share on other sites
SadBunny

Oh, I thought the script was supposed to stop (or continue to another part) when the button was found. Yeah, no, if you need it to continue running then of course leave it be :) 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Dequalityy

Well it's supposed to type that message every 12-18 minute while it keeps searching for that pixel :)

Share this post


Link to post
Share on other sites
SadBunny

Yes, but as soon as it finds that pixel and does the click, what needs to happen then?


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Dequalityy

Nothing really, just keep going =) it's all for learning :-D

 

Tyvm for your help! :)

Share this post


Link to post
Share on other sites
SadBunny

No problem, glad I could help. Have a nice day!


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
Dequalityy

Like wise! :)

Share this post


Link to post
Share on other sites
AutoBert

forgottemn to refresyh Browser (F5)

Edited by AutoBert

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

×