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.

Paint Utility Methods

Featured Replies


/**

* Gets the length, in pixels, of the String passed in.

* @param g The Graphics object to reference the font metrics of.

* @param s The String to get the length of, in pixels.

*

* @return The length, in pixels, of the String passed in.

*/

public static int getPxLength(Graphics g, String s) {

int x = 0;

for (int c1 = 0; c1 < s.length(); c1++) {

x += g.getFontMetrics().charWidth(s.charAt(c1));

}

return x;

}

/**

* Gets the color (from green-red) based on the percent value passed in.

* Generally, you will use this to display the health of a Character.

* @param percent The percent to get the Color of.

* @return The color of the percent passed in.

*/

public static Color getPercentColor(int percent) {

double dec = (double) percent / 100;

double green = 255 * dec;

double red = 255 - green;

if (green <= 255 && green >= 0 && red <= 255 && red >= 0) {

return new Color((int) red, (int) green, 0);

}

return Color.BLACK;

}

/**

* Gets the per hour value for the int passed in based on the start time of when

* the int was being recorded.

* @param value The int to get the per hour value of.

* @param startTime The time, in milliseconds, when the int began being recorded.

* @return The per hour value of the int passed in.

*/

public static long getPerHour(final int value, final long startTime) {

return (long) (value * 3600000D / (System.currentTimeMillis() - startTime));

}

/**

* Inserts commas (US LOCALE) into the passed in int.

* @param i The int to insert commas into.

* @return The String created by inserting commas into the passed in int.

*/

public static String commas(final int i) {

return NumberFormat.getNumberInstance(Locale.US).format((long) i);

}

Edited by Sigma

Guest
This topic is now closed to further replies.

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.