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.

What Colour Is It

Featured Replies

Inspired by this - http://whatcolourisit.com/

 

I decided to add a little extra to my scripts. Just something small that wont improve the performance or anything. Basically there for cosmetic reasons tongue.png

 

How to:

 

Add yer start time:

    long startTime;

Then in onStart add:

public void onStart() throws InterruptedException {
        
        startTime = System.currentTimeMillis();
        
}

Then make a timeToHex method:

public static String timeToHex (long time) {
        int sec = (int) (time / 1000), h = sec / 3600, m = sec / 60 % 60, s = sec % 60;
        return "#" + (h < 10 ? "0" + h : h)+(m < 10 ? "0" + m : m)+ (s < 10 ? "0" + s : s);

}

Then in onPaint add:

public void onPaint(Graphics2D g) {
        super.onPaint(g);

        long timeRan = (System.currentTimeMillis() - startTime);
        Color timeColor = Color.decode(timeToHex(timeRan));

        g.setColor(timeColor);

}

Now the colour timeColor will change the more you run the script :D

 

 

Fruity.

  • Author

Quite interesting, I like it!

 

Aha good x]

 

Pretty cool little thing to add. smile.png

 

I thought it was :P

Very neat idea. You should tend to the excess onjects that are being created though.

Keep in mind, Color is immutable, so decode returns a new Color instance each call. Depending on how fast your onPaint is executing, this could generate a lot of short-lived Color objects, requiring more GCs (although minor, enough minor GCs within a certain timeframe can result in a performance impact). Seeing how a new color generates only every second, you should only be creating a new Color after a second has passed

Edited by fixthissite

  • Author

Very neat idea. You should tend to the excess onjects that are being created though.

Keep in mind, Color is immutable, so decode returns a new Color instance each call. Depending on how fast your onPaint is executing, this could generate a lot of short-lived Color objects, requiring more GCs (although minor, enough minor GCs within a certain timeframe can result in a performance impact). Seeing how a new color generates only every second, you should only be creating a new Color after a second has passed

 

Thank you! and thank you for the info on the colour :o

 

Ran script for 30+mins (Not very long to get a good test i know) but this is the memory usage atm:

8ef7a70fd9dad3894d40af09ebe0fc2e.png

Thank you! and thank you for the info on the colour ohmy.png

 

Ran script for 30+mins (Not very long to get a good test i know) but this is the memory usage atm:

8ef7a70fd9dad3894d40af09ebe0fc2e.png

The problem isn't high memory usage. Since the objects are short lived, they will be cleaned up as soon as a minor collection is performed.

 

It's the amount of times the GC is required to perform. Your heap will fill up quickly, requiring far more collections than should be required. This can cause a performance impact when in comes to CPU time, not memory.

 

Similar to defragmenting your hard drive, objects that don't get "sweeped" get reorganized. During this time, the object graph is considered to be in an inconsistent state, and all threads are blocked from accessing objects. This is called safepoint, but most refer to it as "Stop-The-World", and occurs not only for GC, but other "under the hood" systems. The more often STW occurs, the more latency you'll notice in your program. The more often a GC is required, the more often STWs occur

Edited by fixthissite

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.