Brutal 164 Posted February 2, 2016 Report Share Posted February 2, 2016 This tip is for people who code a run button into their gui instead of the end user using the default ubot run button. We all know it tends to break things when a user becomes impatient while the software is running and he just sits there clicking the run button over and over. (a.k.a., A Spaz Click) What I do is create a var called "running_or_not" ... In the onload command I set the value of that variable to not (or stopped) Now, in the main define that is connected to your run button, put that variable at the very top and set to "running" and at the very bottom and set it to "stopped" Create an IF statement using comparison. [fif] running_or_not = running[then] alert - this program is already running[else] run program This stops the whole issue with people hitting that run button over and over and screwing things up - instead of it triggering the run command again, it just triggers the alert. You'll want to remember that anywhere in your code where you are using the 'stop script' function, you'll want to place your running_or_not variable right above that and set it to stopped. Otherwise if the script hits one of your stop points but the var isnt changed to stopped, then if the user clicks the run button it will already think its running and will not continue for them. And that my good fellow ubotters is my tip of the day. 5 Quote Link to post Share on other sites
cүвεя_נυηкιε 68 Posted February 2, 2016 Report Share Posted February 2, 2016 This tip is for people who code a run button into their gui instead of the end user using the default ubot run button. We all know it tends to break things when a user becomes impatient while the software is running and he just sits there clicking the run button over and over. (a.k.a., A Spaz Click) What I do is create a var called "running_or_not" ... In the onload command I set the value of that variable to not (or stopped) Now, in the main define that is connected to your run button, put that variable at the very top and set to "running" and at the very bottom and set it to "stopped" Create an IF statement using comparison. [fif] running_or_not = running[then] alert - this program is already running[else] run program This stops the whole issue with people hitting that run button over and over and screwing things up - instead of it triggering the run command again, it just triggers the alert. You'll want to remember that anywhere in your code where you are using the 'stop script' function, you'll want to place your running_or_not variable right above that and set it to stopped. Otherwise if the script hits one of your stop points but the var isnt changed to stopped, then if the user clicks the run button it will already think its running and will not continue for them. And that my good fellow ubotters is my tip of the day. Nice tip dude Its funny its little things like this that make all the difference in an end product, I usually add little tit bits like this to improve functionality without even thinking, .. like autopilot you know .. but to a new user things like this can make all the difference CheersCJ Quote Link to post Share on other sites
HelloInsomnia 1103 Posted February 2, 2016 Report Share Posted February 2, 2016 Thanks for this, I will probably make a full blown guide on start and stop buttons soon because it is something that people have been asking me how to do for ages. Edit: Going to try and make it today actually while it's still fresh in my mind. 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.