Jump to content
UBot Underground

How To Stop Bot When Define Is Running


Recommended Posts

I can't find the thread and can't remember who shared it but I had saved this stop/pause/resume code:

ui html panel("<button onclick=\"ubot.runScript(\'run_bot()\')\">Start</button>
<button onclick=\"ubot.runScript(\'stopbot()\')\">Stop</button>
<button onclick=\"ubot.runScript(\'pausebot()\')\">Pause</button>
<button onclick=\"ubot.runScript(\'un_pausebot()\')\">Un-Pause</button>",300)
define run_bot {
    load html("Hey")
    wait(1)
    Stop Pause Check()
    load html("I")
    wait(1)
    Stop Pause Check()
    load html("Hope")
    wait(1)
    Stop Pause Check()
    load html("This")
    wait(1)
    Stop Pause Check()
    load html("Helps")
    wait(1)
    Stop Pause Check()
    load html("You")
    wait(1)
    Stop Pause Check()
    load html("Understand")
    Stop Pause Check()
    load html("How")
    Stop Pause Check()
    load html("To")
    Stop Pause Check()
    load html("Pause")
    Stop Pause Check()
    load html("and Un Pause")
    Stop Pause Check()
    load html("Your Bot")
}
define Check Stop {
    if($comparison(#stopnow,"=",$true)) {
        then {
            set(#stopnow,$false,"Global")
            stop script
        }
        else {
        }
    }
}
define Check Pause {
    if($comparison(#pause,"=",$true)) {
        then {
            wait(1)
            Check Pause()
        }
        else {
        }
    }
}
define Stop Pause Check {
    Check Stop()
    Check Pause()
}
define pausebot {
    set(#pause,$true,"Global")
}
define un_pausebot {
    set(#pause,$false,"Global")
}
define stopbot {
    set(#stopnow,$true,"Global")
}
Link to post
Share on other sites

if you are just right-clicking and selecting to run the define that way - There is no stopping it other than to just exit ubot.

 

If you are starting it via the run button, then the stop/pause buttons will work for you.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...