Bot-Factory 602 Posted January 30, 2014 Report Share Posted January 30, 2014 Hello. I'm looking for a way to run certain commands when my bot is idle. All my code is within several define commands. And all functions are triggered by UI Buttons.I have a progress bar and a status text window. The different activities change the progress bar and the status window. Now I would like to reset the progress bar and the status window after a while. But I don't want to do it at the end of my define commands. I want to show the last message for another 3-5 seconds, but then reset it to the default. But without delaying the bot. So pause and changing it at the end of the define is not what I'm looking for. If someone has a smart way to do that, I'm very interested to hear about it. Thanks in advance for your helpDan Quote Link to post Share on other sites
the_way 52 Posted January 30, 2014 Report Share Posted January 30, 2014 so to get this right, if the message showed for the 3-5 seconds, and then it "waited a while" and the whole thing started again, that would be ok? Quote Link to post Share on other sites
Bot-Factory 602 Posted January 30, 2014 Author Report Share Posted January 30, 2014 (edited) so to get this right, if the message showed for the 3-5 seconds, and then it "waited a while" and the whole thing started again, that would be ok? I think I have an idea: define resetstatus { thread { wait(5) if($comparison(#runthread, "=", 1)) { then { set(#status, "<font color=\"#FFFFFF\">Bereit...</font>", "Global") set(#progressbar, 0, "Global") } else { } } }} And at the beginning of every define command I do:set(#runthread, "0", "Global") and at the endset(#runthread, "1", "Global")resetstatus() That should do the job.. Testing it now. Dan Edited January 30, 2014 by dan Quote Link to post Share on other sites
Bot-Factory 602 Posted January 30, 2014 Author Report Share Posted January 30, 2014 Ok. That's working. Dan Quote Link to post Share on other sites
Edward_2 85 Posted January 30, 2014 Report Share Posted January 30, 2014 Then run a loopwhile thread at the beginning to keep checking that status of #runthread. Quote Link to post Share on other sites
blumi40 222 Posted January 30, 2014 Report Share Posted January 30, 2014 .... set(#status, "<font color=\"#FFFFFF\">Bereit...</font>", "Global") "Bereit" is mal ne Aussage die mir gefällt :) Quote Link to post Share on other sites
Bot-Factory 602 Posted January 30, 2014 Author Report Share Posted January 30, 2014 "Bereit" is mal ne Aussage die mir gefällt :)Hehe... Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 31, 2014 Report Share Posted January 31, 2014 Try this out. Click on a command button and it will run after it says "Finished!" it will wait 4 seconds then clear the progress bar, however, if you click on one of the command buttons in that 4 seconds it will run that command and not reset the progress bar (except back to 1 which it does in the command but it wont reset part way through that command) - I hope that makes sense.I think that's what you're going for? ui button("Command 1") { set(#progress_ready, "false", "Global") set(#progress, 1, "Global") loop(99) { wait(0.05) increment(#progress) } wait(1) alert("Finished!") set(#progress_ready, "true", "Global") change progress bar() } ui button("Command 2") { set(#progress_ready, "false", "Global") set(#progress, 1, "Global") loop(99) { wait(0.05) increment(#progress) } wait(1) alert("Finished!") set(#progress_ready, "true", "Global") change progress bar() } ui stat monitor("Progress:", #progress) define change progress bar { loop(4) { wait(1) if($comparison(#progress_ready, "=", "true")) { then { } else { stop script } } } set(#progress, 0, "Global") } 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.