Digital101 4 Posted March 8, 2015 Report Share Posted March 8, 2015 In my last bot I used the Stop Pause Check code and it worked fine. However the bot I am currently working on has a lot more going on and I am looking for something with a quicker response without having a million "Stop Pause Check" commands dropped everywhere my code. First thought was to run a thread looping in the background checking for the change in the pause value. What I got from that was exactly what in hindsight I should have expected is that it stopped the background thread and did not touch the main thread. I tried a few other things, none of which worked. I found this as it seemed to be geared towards multiple threads but it did not work for me. http://www.ubotstudio.com/forum/index.php?/topic/12766-how-does-pause-script-and-stop-script-work/?p=69639 The bot itself i not using multiple threads (yet anyway) so with the one in the background there would be only two working. Any help would be great. Thanks As an additional question what would be the best tutorials for multi-threading? Preferably one that assumes I do not have a clue. Quote Link to post Share on other sites
cүвεя_נυηкιε 68 Posted March 8, 2015 Report Share Posted March 8, 2015 In my last bot I used the Stop Pause Check code and it worked fine. However the bot I am currently working on has a lot more going on and I am looking for something with a quicker response without having a million "Stop Pause Check" commands dropped everywhere my code. First thought was to run a thread looping in the background checking for the change in the pause value. What I got from that was exactly what in hindsight I should have expected is that it stopped the background thread and did not touch the main thread. I tried a few other things, none of which worked. I found this as it seemed to be geared towards multiple threads but it did not work for me. http://www.ubotstudio.com/forum/index.php?/topic/12766-how-does-pause-script-and-stop-script-work/?p=69639 The bot itself i not using multiple threads (yet anyway) so with the one in the background there would be only two working. Any help would be great. Thanks As an additional question what would be the best tutorials for multi-threading? Preferably one that assumes I do not have a clue. There is a plugin by Pash that enables you to use the "Main Button Click" and allows you to assign Run, Pause and Stop to a define and can be used for buttons its not free but its definitely worth the money http://www.ubotstudio.com/forum/index.php?/topic/16097-sell-plugin-advanced-ubot-1/ 1 Quote Link to post Share on other sites
Digital101 4 Posted March 8, 2015 Author Report Share Posted March 8, 2015 There is a plugin by Pash that enables you to use the "Main Button Click" and allows you to assign Run, Pause and Stop to a define and can be used for buttons its not free but its definitely worth the money http://www.ubotstudio.com/forum/index.php?/topic/16097-sell-plugin-advanced-ubot-1/ Thanks. I already have the plugin though not sure how that function would work in this situation. I tried setting it up a couple different ways and it did not work and threw off a bunch of errors. The video was not any help at all. I will post the screen shot with the errors over in the plugin thread and see if I can get some feedback on making it work. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted March 9, 2015 Report Share Posted March 9, 2015 If you make the stop checker into a command it's not so bad then all you have to do is drag that custom command into your program in several places, a really basic example: ui stat monitor("Count:", #count) ui button("Stop") { set(#stop, "true", "Global") } set(#count, 0, "Global") set(#stop, "false", "Global") loop(100) { increment(#count) wait(.1) Stop Check() } define Stop Check { if($comparison(#stop, "=", "true")) { then { stop script } else { } } } Quote Link to post Share on other sites
Digital101 4 Posted March 10, 2015 Author Report Share Posted March 10, 2015 That is similar to what I was already doing and would have done it for this bot as well but it seemed like there had to be a better way. The main button click from Pash's plugin does the job perfectly with just a little tweaking to how I was setting it all up. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.