Skip 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.

6 new API features

Featured Replies

1. myPlayer().isInteractingWithId(int)

2. myPlayer().isInteractingWithName(String)

3. closestGroundItemForNameThatContains(String)

4. closestObjectForName(Position, String) - currently only Area, String

5. dropForName(int, String) - Amount, item

6. dropForId(int, int) - Amount, Id

 

Thanks,

 

Alek

 

 

Edit:

 

7. isMouseOn - for use in the settings tab to determine if the mouse setting is activated or not (1 button vs 2 button).

8. myPlayer().isPoisoned()

Edited by Alek

1. myPlayer().isInteractingWithId(int)

2. myPlayer().isInteractingWithName(String)

3. closestGroundItemForNameThatContains(String)

4. closestObjectForName(Position, String) - currently only Area, String

5. dropForName(int, String) - Amount, item

6. dropForId(int, int) - Amount, Id

 

Thanks,

 

Alek

These would come in handy.

These would come in handy.

 

	boolean isInteractingWithId(int i)
	{
		org.osbot.script.rs2.model.Character<?> c = this.myPlayer().getFacing();
		if(c instanceof NPC)
		{
			if(((NPC)c).getId() == i)
			{
				return true;
			}
		}
		return false;
	}
	public GroundItem nearestByName(String s)
	{
		Position t = this.myPlayer().getPosition();
		GroundItem gi = null;
		for(GroundItem g : client.getCurrentRegion().getItems())
		{
			if(gi == null || g.getPosition().distance(t) < gi.getPosition().distance(t))
			{
				if(g.getName().equalsIgnoreCase(s))
				{
					gi = g;
				}
			}
		}
		return gi;
	}

never wrote anything for this client before but these will probably work

 

you should override character and add the 1st one to it

Edited by Theology

I don't see how it's possible to drop a certain amount of items.. unless you're referring to dropping, say, 5 un-noted logs, when you have 10.

	public boolean isInteractingWithName(String entity) {
		Entity facingEntity = client.getMyPlayer().getFacing();
		return facingEntity == null ? false : facingEntity.getName().equalsIgnoreCase(entity);
	}
	
	public boolean isInteractingWithId(int id) {
		Entity facingEntity = client.getMyPlayer().getFacing();
		if (facingEntity == null) {
			return false;
		}
		if (facingEntity instanceof NPC) {
			return ((NPC) facingEntity).getId() == id;
		}
		if (facingEntity instanceof RS2Object) {
			return ((RS2Object) facingEntity).getId() == id;
		}
		return false;
	}
	
	public GroundItem closestGroundItemForNameThatContains(String name) {
		int distance = 30;
		GroundItem groundItem = null;
		for (GroundItem item : client.getCurrentRegion().getItems()) {
			if (item == null || !item.exists()) {
				continue;
			}
			if (item.getName().contains(name) && distance(item) < distance) {
				groundItem = item;
				distance = distance(item);
			}
		}
		return groundItem;
	}

	public RS2Object closestObjectForName(Position position, String name) {
		int distance = 30;
		RS2Object closestObject = null;
		for (RS2Object object : client.getCurrentRegion().getObjects()) {
			if (object == null || !object.exists()) {
				continue;
			}
			if (object.getName().equalsIgnoreCase(name) && distanceBetween(position, object.getPosition()) < distance) {
				closestObject = object;
				distance = (int) distanceBetween(position, object.getPosition());
			}
		}
		return closestObject;
	}
	
	/*
	 * Credits to Brainfree and/or Doout
	 */
	public static double distanceBetween(Position A, Position B) {
		return distanceBetween(A.getX(), A.getY(), B.getX(), B.getY());
	}
	
	/*
	 * Credits to Brainfree and/or Doout
	 */
	public static double distanceBetween(double x1, double y1, double x2, double y2) {
		return Math.hypot(x2 - x1, y2 - y1);
	}

Edited by Aeterna

support, looks like good options for scripters to use. I hope I can learn to script for this bot.

  • Author

@Tyluur -  You do realize that's the exact same excuse that TRiLeZ gave to scripters for reasons not to update the API, and the reason why 20 scripters left.

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.