Jump to content

Need help sleep/loop.


Recommended Posts

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

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

Link to comment
Share on other sites

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 :/ 

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...