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.

Get the fonts used in RS?

Featured Replies

I want to be able to measure the height of the fonts used in RS. Is this possible?

For example, measuring the height of an item within a context menu to get an estimate for where my mouse should be.

9a3eeb2450d000b4d12808535656b32f.png

If you have the actual font file, it would be easy to determine the dimensions of any given string, using fontmetrics or glyph vectors. A Graphics object should provide access to these.

 

If you just want to calculate an area in the rs right-click menu, you can easily do so by using the MenuAPI class

Edited by FrostBug

  • Author

hmm I never tried this before. 

For what purpose would you need this ?

 

Khaleesi

I would like to write my own right click - interact method using this as the one in OSBot seems to be too fast and misclicks a lot.

 

If you have the actual font file, it would be easy to determine the dimensions of any given string, using fontmetrics og glyph vectors. A Graphics object should provide access to these.

 

If you just want to calculate an area in the rs right-click menu, you can easily do so by using the MenuAPI class

Thank you, will use MenuAPI. I know how to measure font widths/heights, that's why I was asking how to get the font :P

 

I would like to write my own right click - interact method using this as the one in OSBot seems to be too fast and misclicks a lot.

 

Thank you, will use MenuAPI. I know how to measure font widths/heights, that's why I was asking how to get the font tongue.png

I love the missclicks :) You know your script is well written once it can handle missclicks. imo it doesn't missclick that often.

Just look up the current implementation and try to 'improve' it, no need to do fancy stuff with fonts you got all the widget sizes.

I would like to write my own right click - interact method using this as the one in OSBot seems to be too fast and misclicks a lot.

 

Thank you, will use MenuAPI. I know how to measure font widths/heights, that's why I was asking how to get the font tongue.png

 

To get the rectangle for a menu item (Eg. "Walk here"), you can do something like this:

 

getMenuAPI().getOptionRectangle(getMenuAPI().getMenuIndex(null, new String[]{"Walk here"});

I don't remember if it allows null for entity names, though. If not you can just iterate the Option list to find the index of whatever option you want.

 

I would like to write my own right click - interact method using this as the one in OSBot seems to be too fast and misclicks a lot.

 

Thank you, will use MenuAPI. I know how to measure font widths/heights, that's why I was asking how to get the font tongue.png

 

Check out the "Menu" class. Pretty sure you can get a bounding rectangle around the action you need.

 

Khaleesi 

  • Author

I love the missclicks smile.png You know your script is well written once it can handle missclicks. imo it doesn't missclick that often.

Just look up the current implementation and try to 'improve' it, no need to do fancy stuff with fonts you got all the widget sizes.

My script can handle misclicks just fine, but it does it and that doesn't help (+ it sometimes is way too fast imo)

 

To get the rectangle for a menu item (Eg. "Walk here"), you can do something like this:

 

getMenuAPI().getOptionRectangle(getMenuAPI().getMenuIndex(null, new String[]{"Walk here"});

I don't remember if it allows null for entity names, though. If not you can just iterate the Option list to find the index of whatever option you want.

 

Here's the implementation I thought of:

public boolean interactWith(Entity e, String action) throws InterruptedException {
		if (e == null) {
			return false;
		}
		
		while (!getMouse().isOnCursor(e)) { e.hover(); sleep(rand(450, 750)); } //hover
		while (!getMenuAPI().isOpen()) { getMouse().click(true); sleep(rand(150, 450)); } //open interface
		sleep(rand(150, 450));
		
		List<Option> options = getMenuAPI().getMenu();
		int rectIndex = -1;
		
		for (int i = 0; i < options.size(); i++) {
			Option o = options.get(i);
			String s = o.action;
			if (s.equals(action)) {
				rectIndex = i;
				break;
			}
		}
		
		if (rectIndex == -1) {
			return false;
		}
		
		Rectangle optionRect = getMenuAPI().getOptionRectangle(rectIndex);
		
		int height = optionRect.height;
		int startX = optionRect.x;
		int startY = optionRect.y;
		int width = optionRect.width;
		int endX = startX + width;
		int endY = startY + height;
		
		//2px bounds incase the bounding boxes are fucked
		int randX = getRandom(startX + 1, endX - 1);
		int randY = getRandom(startY + 1, endY - 1);
		
		while (!(getMouse().getPosition() == new Point(randX, randY))) { getMouse().move(randX, randY); sleep(rand(450, 750)); } //move to option
		sleep(rand(150, 450));
		while (getMenuAPI().isOpen()) { getMouse().click(false); sleep(rand(750, 1150)); } //click
		
		return true;
	}

Could definitely be improved, however I cannot test and currently this seems like the best way.

My script can handle misclicks just fine, but it does it and that doesn't help (+ it sometimes is way too fast imo)

 

Here's the implementation I thought of:

public boolean interactWith(Entity e, String action) throws InterruptedException {
		if (e == null) {
			return false;
		}
		
		while (!getMouse().isOnCursor(e)) { e.hover(); sleep(rand(450, 750)); } //hover
		while (!getMenuAPI().isOpen()) { getMouse().click(true); sleep(rand(150, 450)); } //open interface
		sleep(rand(150, 450));
		
		List<Option> options = getMenuAPI().getMenu();
		int rectIndex = -1;
		
		for (int i = 0; i < options.size(); i++) {
			Option o = options.get(i);
			String s = o.action;
			if (s.equals(action)) {
				rectIndex = i;
				break;
			}
		}
		
		if (rectIndex == -1) {
			return false;
		}
		
		Rectangle optionRect = getMenuAPI().getOptionRectangle(rectIndex);
		
		int height = optionRect.height;
		int startX = optionRect.x;
		int startY = optionRect.y;
		int width = optionRect.width;
		int endX = startX + width;
		int endY = startY + height;
		
		//2px bounds incase the bounding boxes are fucked
		int randX = getRandom(startX + 1, endX - 1);
		int randY = getRandom(startY + 1, endY - 1);
		
		while (!(getMouse().getPosition() == new Point(randX, randY))) { getMouse().move(randX, randY); sleep(rand(450, 750)); } //move to option
		sleep(rand(150, 450));
		while (getMenuAPI().isOpen()) { getMouse().click(false); sleep(rand(750, 1150)); } //click
		
		return true;
	}

Could definitely be improved, however I cannot test and currently this seems like the best way.

 

This doesn't really solve the main misclick issues, though.

Just like the method in the API, it lacks a check for whether or not the menu is still open before clicking (At least the API method used to lack it. I am not 100% certain that it still does). Due to the nature of the mouse algo, the path taken to the option can sometimes lead to the mouse getting too far away from the menu, closing it on the way.

 

I made some API methods for interaction with this last check about a year ago, will probs post in snipper section when I get home

 

Offtopic, using while loops without any form of timeout is generally a bad idea

 

Edited by FrostBug

  • Author

This doesn't really solve the main misclick issues, though.

Just like the method in the API, it lacks a check for whether or not the menu is still open before clicking (At least the API method used to lack it. I am not 100% certain that it still does). Due to the nature of the mouse algo, the path taken to the option can sometimes lead to the mouse getting too far away from the menu, closing it on the way.

 

I made some API methods for interaction with this last check about a year ago, will probs post in snipper section when I get home

 

Offtopic, using while loops without any form of timeout is generally a bad idea

 

There is a check to make sure the mouse is at the random position (which is within the bounding box). There is also a check to see if the menu is open before it clicks.

There is a check to make sure the mouse is at the random position (which is within the bounding box). There is also a check to see if the menu is open before it clicks.

But not a check for e.exists(), which might be an issue in the first while loop :p

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.