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.

How to make the player stay in a area?

Featured Replies

Hi OSbot community,

im working on my first script , which is a simple iron miner.

I have defined an area, where the player(bot) is supposed to stay, but i dont know which command makes the bot stay in that area . Can someone help me?

Edited by faruk141

8 minutes ago, faruk141 said:

Hi OSbot community,

im working on my first script , which is a simple iron miner.

I have defined an area, where the player(bot) is supposed to stay, but i dont know which command makes the bot stay in that area . Can someone help me?

 

if(AREA.contains(ORE.getPosition()){

// INTERACT

}

 

 

or if you want to walk back to the area if you leave it,

 

if(!AREA.contains(myPosition())){

getWalking().webWalk(AREA.getRandomPosition());

}

Edited by Duhstin

could use player get area and if hes not in ur area walk to it

 

or just check if the iron is in ur area and then mine it if its not sleep

 

 

EDIT: yup what the dude above me said.

Edited by transmission

Area myArea = new Area(0,0,0,0);

if (myArea.contains(myPlayer())
	//we are in the area
else //we are not in the area
	getWalking().walk(myArea);

 

To grab rocks within your area use a Filter<RS2Object> in .closest(Filter<> filter);

  • Author
12 hours ago, Duhstin said:

 

if(AREA.contains(ORE.getPosition()){

// INTERACT

}

 

 

or if you want to walk back to the area if you leave it,

 

if(!AREA.contains(myPosition())){

getWalking().webWalk(AREA.getRandomPosition());

}

thank you very much! i used the AREA.contains(ORE) method and its working.

There was another iron ore with the same id  outside the area and because of this i needed a solution for this problem. :)

2 hours ago, faruk141 said:

thank you very much! i used the AREA.contains(ORE) method and its working.

There was another iron ore with the same id  outside the area and because of this i needed a solution for this problem. :)

Not wise to use ids for rocks, check this out

Also, though basically the same, check what Chris wrote. His snippet is basic and clean.

15 hours ago, Duhstin said:

 

if(AREA.contains(ORE.getPosition()){

// INTERACT

}

 

 

or if you want to walk back to the area if you leave it,

 

if(!AREA.contains(myPosition())){

getWalking().webWalk(AREA.getRandomPosition());

}

Ore is a RS2Object so it's an entity. You can just use contains(ORE) in that case. 

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.