Draygoes Posted December 6, 2022 Share Posted December 6, 2022 (edited) So all this script does is count a random number of minutes by counting to 60 seconds and resetting. It showes pretty much exactly what I think of when I imagined what a do loop should look like. I hope that makes sense. Anyway, code. $Seconds = 0 ;Set our seconds counter to zero. $Minutes = 0 ;Set our minutes counter to zero. $length = Random( 15, 300, 1) ;Set the veriable "length" to a number between 15 and 300. This will be the time we run our DO loop below until. Do ;Count Minutes Do ;Count Seconds Sleep( 1000 ) ;Pauses the code right here for exactly one second. $Seconds = $Seconds + 1 ;Adds 1 to the veriable that stores what second we are at, named Seconds. Until $Seconds = 60 ;Stops counting seconds at 60 seconds. $Seconds = 0 ;Resets the seconds to zero. If we don't do this, the count will start at 61. And as it keeps going, it will never equal 60 ;again, creating a constant count that never gets stopped by any conditions. The program will run like this until t's ;restarted in some way for some reason. $Minutes = $Minutes + 1 ;Adds 1 to the veriable that stores what minute we are at, named minute. Until $Minutes = $length ;Stops the do loop when the minute counter is the same number as the length we randomly generated on line 13. ;Here we execute whatever we wanted to at the random time. Can be a reminder or something along those lines. Believe it or not I just wrote that for a project I'm doing. You can easily throw it on top of any code you could ever need to run at random. Edited December 6, 2022 by Draygoes Removed bug in real time. Second edit: Removed unused constants. I forgot I had that. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now