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 Causes Lag

Featured Replies

Hey guys I have found that this bit of code causes a heap of lag anyone able to help with the lag issue ?

 

public void onPaint(Graphics2D gr) {
		try {
			image = ImageIO.read(new URL(
					"http://i1285.photobucket.com/albums/a589/whipz/EA1C0CF0C2DDBCB04C0258B8960138B33A6C1292DB3DF36762pimgpsh_fullsize_distr_zpsdo2x7ou1.jpg"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		gr.drawImage(image, 4, 342, null);
		final long runTime = System.currentTimeMillis() - startTime;
		int x = getMouse().getPosition().x;
		int y = getMouse().getPosition().y;
		gr.drawLine(0, y, 765, y);
		gr.drawLine(x, 0, x, 503);
		gr.drawString(formatTime(runTime), 125, 375);
		gr.drawString("", 125, 390);
		gr.drawString("" + getSkills().getStatic(Skill.COOKING), 125, 405);
		gr.drawString("" + getExperienceTracker().getGainedLevels(Skill.COOKING), 125, 420);
		gr.drawString("" + formatValue(getExperienceTracker().getGainedXP(Skill.COOKING)), 125, 435);
		gr.drawString("" + formatValue(getExperienceTracker().getGainedXPPerHour(Skill.COOKING)), 125, 450);
		gr.drawString("" + formatValue(getSkills().experienceToLevel(Skill.ATTACK)), 125, 465);
	}

Yet this doesnt so its obviously the image but how can i reduce the lag as it causes the script to almost not move

this is code with no lag

	public void onPaint(Graphics2D gr) {
		final long runTime = System.currentTimeMillis() - startTime;
		int x = getMouse().getPosition().x;
		int y = getMouse().getPosition().y;
		gr.drawLine(0, y, 765, y);
		gr.drawLine(x, 0, x, 503);
		gr.drawString(formatTime(runTime), 125, 375);
		gr.drawString("", 125, 390);
		gr.drawString("" + getSkills().getStatic(Skill.COOKING), 125, 405);
		gr.drawString("" + getExperienceTracker().getGainedLevels(Skill.COOKING), 125, 420);
		gr.drawString("" + formatValue(getExperienceTracker().getGainedXP(Skill.COOKING)), 125, 435);
		gr.drawString("" + formatValue(getExperienceTracker().getGainedXPPerHour(Skill.COOKING)), 125, 450);
		gr.drawString("" + formatValue(getSkills().experienceToLevel(Skill.ATTACK)), 125, 465);
	}

Thanks for any help or suggestions

 

You need to cache the image rather than reading it over and over from a website. Load the image and set it to an object in the onStart method.

  • Author
Just now, Vilius said:

You need to cache the image rather than reading it over and over from a website. Load the image and set it to an object in the onStart method.

so this in onStart ? 

try {
			image = ImageIO.read(new URL(
					"http://i1285.photobucket.com/albums/a589/whipz/EA1C0CF0C2DDBCB04C0258B8960138B33A6C1292DB3DF36762pimgpsh_fullsize_distr_zpsdo2x7ou1.jpg"));
		} catch (IOException e) {
			e.printStackTrace();
		}

 

25 minutes ago, whipz said:

so this in onStart ? 


try {
			image = ImageIO.read(new URL(
					"http://i1285.photobucket.com/albums/a589/whipz/EA1C0CF0C2DDBCB04C0258B8960138B33A6C1292DB3DF36762pimgpsh_fullsize_distr_zpsdo2x7ou1.jpg"));
		} catch (IOException e) {
			e.printStackTrace();
		}

 

Yep

  • Author
6 minutes ago, Vilius said:

Yep

the script did nothing when I moved that to the start ):

wait scratch that had to restart comp for some reason THANKS MATE !

  • Decode locked this topic
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.