Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

help with 24 hour clock in script

Featured Replies

Im having a bit of trouble adding:

if current system time is equal to 8am/1pm/12am + random value between 0 seconds and 1 hour

(i can generate a random amount of time between 0 seconds and 1 hour already. just need help getting:

if current system time == Xam/pm)

 

 

been looking into:

http://docs.oracle.com/javase/6/docs/api/java/util/Timer.html

but i cant seem to get it working

 

i also looked into just using:

if System.currentTimeMillis() == RANDOMMILLIS {

}

but its too confusing figuring out 

any help is much appreciated

a little explanation on it would be great smile.png

 

Pretty straight forward, you can can see the API :s

 

It helps you track time and you can translate a Date to a long and vice versa

 

You can compare the current Date with the future Date you set using your random interval by using Date#after() or Date#before

honestly, doesnt seem to be a good idea to do it that way. think it might be better to go something like this:

private long lastUpdate = System.currentTimeMillis();
.
.
.
if(System.currentTimeMillis() - lastUpdate <= MethodProvider.random(2000, 3000)) { 
          //some random time period (this would complete the action every 2-3 seconds)
     completeAnAction();
     lastUpdate = System.currentTimeMillis();
}

it looked like this was what you were trying to get at, at least

Edited by Imateamcape

honestly, doesnt seem to be a good idea to do it that way. think it might be better to go something like this:

private long lastUpdate = System.currentTimeMillis();
.
.
.
if(System.currentTimeMillis() - lastUpdate <= MethodProvider.random(2000, 3000)) { 
          //some random time period (this would complete the action every 2-3 seconds)
     completeAnAction();
     lastUpdate = System.currentTimeMillis();
}

it looked like this was what you were trying to get at, at least

 

This^ Use the Date class and the method above rather than a Timer.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.