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.

API Question

Featured Replies

I am having a hard time finding a way to check if the player is inside a specific area. Anyone shed of light for me?

 

Also, do someone have any good methods for walking/pathing?

 

I don't need specific code, just some simple logic on whats a good way to do it?

I am having a hard time finding a way to check if the player is inside a specific area. Anyone shed of light for me?

 

Also, do someone have any good methods for walking/pathing?

 

I don't need specific code, just some simple logic on whats a good way to do it?

 

1. Checking if player is in an area:

 

Area a = new Area(1, 2, 3, 4);

Player p = myPlayer();

if(a.contains(p)) { //'contains' in the API refers to all entities - a player is a character, which is a type of entity

 //do x

}

 

 

2. Walking / pathing

getWalking().webWalk(area or position); //or use a webwalkevent if you want

webwalking figures out the pathing for you and deals with common obstacles. If you don't need to deal with obstacles, it will be less intensive to use getWalking().walk() or just a regular walkingevent. if you dont want to do either of those, use explv.github.io (website) to figure out pathing and use getWalking().walkPath(list of positions gathered from the site). 

Edited by Imateamcape

  • Author

This works for "your" character? Because I feel like this might looked for other players as well which wouldn't be right. Does the client refer to you as the "LocalPlayer" but the issue is in the API I can only find .getLocalPlayer. Can I turn it into a variable like you stated above?

This works for "your" character? Because I feel like this might looked for other players as well which wouldn't be right. Does the client refer to you as the "LocalPlayer" but the issue is in the API I can only find .getLocalPlayer. Can I turn it into a variable like you stated above?

 

myPlayer() returns your own character, yes. Never others. And yes... It returns a player, hence you can say something like:

 

Player player = myPlayer();

 

if(area.contains(player)) {

 // do something

}

 

Or if you want, you don't need to define it...

 

if(area.contains(myPlayer())) {

 // do something

}

 

same thing, really

  • Author

myPlayer() returns your own character, yes. Never others. And yes... It returns a player, hence you can say something like:

 

Player player = myPlayer();

 

if(area.contains(player)) {

 // do something

}

 

Or if you want, you don't need to define it...

 

if(area.contains(myPlayer())) {

 // do something

}

 

same thing, really

 

Thanks for the help, not looking to make another Thread I only have a few more questions if you don't mind.

 

Firstly, other bot API's use "sleep" as a method to sort of pause or idle their bots. As far as I can gather is that OSBot uses "random" to do this? Am I correct?

 

Secondly, how would I go about properly interacting with items on the ground? I want my bot to search/identify a specific item on the ground, pick it up, and then bank it. I am having a hard time figuring this out for some reason.

 

Lastly, would it be ok to message you with any further questions I may have?

Thanks for the help, not looking to make another Thread I only have a few more questions if you don't mind.

 

Firstly, other bot API's use "sleep" as a method to sort of pause or idle their bots. As far as I can gather is that OSBot uses "random" to do this? Am I correct?

 

Secondly, how would I go about properly interacting with items on the ground? I want my bot to search/identify a specific item on the ground, pick it up, and then bank it. I am having a hard time figuring this out for some reason.

 

Lastly, would it be ok to message you with any further questions I may have?

 

1. random and sleep have nothing to do with each other. Script is just a type of thread - sleep stalls the thread (makes it sleep) for a random amount of time, given by an int. random returns an int, so its used to randomize the amount of time that hte bot sleeps for.

 

2. GroundItem g = groundItems.get(name / id);

g.interact("Take");

 

Explore the API a little more before making scripts. It'll help.

1. random and sleep have nothing to do with each other. Script is just a type of thread - sleep stalls the thread (makes it sleep) for a random amount of time, given by an int. random returns an int, so its used to randomize the amount of time that hte bot sleeps for.

 

2. GroundItem g = groundItems.get(name / id);

g.interact("Take");

 

Explore the API a little more before making scripts. It'll help.

 

groundItems.get(x, y) is the only "get" there is, you're probably thinking groundItems.closest(name/id).

 

@@PancakePuncher But you should read/search the API, links at the top of the page (or here: http://osbot.org/api/ )

Edited by Lemons

groundItems.get(x, y) is the only "get" there is, you're probably thinking groundItems.closest(name/id).

 

But you should read/search the API, links at the top of the page (or here: http://osbot.org/api/)

 

yeah my bad it is .closest() i had just woken up when i wrote that smile.png

  • Author

I have been using the API. Usually I have no problem finding the method I need to perform a task. I was just having a hard time determine which "Item" method checked against the items name. I was using poopbot API, but the community over there is rather dead it seems so I transitioned to here. The bots methods a somewhat similar though not entirely.

 

Believe me though I am not asking questions until I do my own research and testing before hand.

Edited by PancakePuncher

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.