Jump to content

How to stop while loop without stopping script?


Silas
 Share

Recommended Posts

Hello everyone,

I'm new and i really like programming. Now i am making a bot for orteil.dashnet.org/cookieclicker/  .
Here is the script I have now:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Silas Peters\Desktop\Bots\Cookie Clicker.kxf
Global $Form1 = GUICreate("Cookie Clicker Bot", 267, 87, -1, -1)
Global $Start = GUICtrlCreateButton("Start", 160, 48, 75, 25)
Global $Stop = GUICtrlCreateLabel("Om te stoppen druk op de 'ESC' knop", 40, 16, 182, 17)
Global $Internet = GUICtrlCreateButton("Open Coockie Clicker", 24, 48, 123, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $g_bPaused = False
HotKeySet("{ESC}", "Stop")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $start
            Start()
         Case $Internet
            Internet()
    EndSwitch
WEnd

Func Start()
While 1
    MouseClick ("left", 215, 379)
 WEnd
 EndFunc

 Func Internet()
    ShellExecute ("http://orteil.dashnet.org/cookieclicker/")
    WinWaitActive ("" , "Chrome Legacy Window" )
    Sleep (3000)
    WinActivate ("Cookie Clicker Bot")
 EndFunc

 Func Stop()
    Exit
    EndFunc

 

But i want that if you press ESC that the spamming stops but that the window still stay's open so you can manually restart it...
Can anyone help me? And also, if you guy's know it too, can you tell me how i can keep the window of the bot in front all the time while the website is starting?

I would really apreciate it if you guy's can help me.

 

P.S. I'm actually dutch so sorry if i make some mistakes in grammar...

Link to comment
Share on other sites

  • Moderators

@Silas welcome to the forum. You seem to have missed the forum rules on your way in, especially the parts about game automation. Please read them now (along with the section on not reposting your same question with different wording), and you'll see why this thread was locked. Hope to see you again with a legitimate question.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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