Sorry about my previous post it was wrong, here is a stop pause script that should do what you're after. Paste this in ubot anf hit the start button and you will see how it works.
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()
loa