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.

Dealing with box trap animations

Featured Replies

Having a problem with box trap animations. From what I experienced the box trap id changes during the animation of something getting in it or trying to. However even when I check for every single box trap id the script still sometimes acts like there wasnt anything on that tile. Heres the code that checks for it:

Entity trapsSpot1 = objects.closest(spotArea[0], new int[]{NORMAL_ID, BROKEN_ID, SHAKING_ID, FAILING, SUCCESS}); //failing and success = the ID's of the animating traps
if(trapsSpot1 == null){
	return State.TRAP1;
}

Is there any way to fix this, as in to check if a certain area contains any entities at all?

On mobile didn't see full code Never mind me.

Edited by twin 763

  • Author

Can't you just check the Boxtrap on the ground by its name?

Is way more reliable since this will probably break every thursday bcs jagex update...

 

Afterwards check if it has the required action to determine what state it is in?

 

Khaleesi

 

Filter out the objects on the tile.

 

I switched from using id's to names, which should fix the problem with the animation because the name of the animating trap is box trap aswell. But now Im using a filter to declare whats a broken trap, but it tries to go for a trap thats out of the area I checked for even after the check.

RS2Object brokenTrap = objects.closest(new Filter<RS2Object>(){
			   @Override
			   public boolean match(RS2Object o){
			      return o != null && o.getName().equals("Box trap") && o.getActions().equals("Dismantle");
			   }});
if(brokenTrap != null){
	if(huntingArea.contains(brokenTrap)){
		return State.DISMANTLE;
	}
}	

Edited by Damighty

  • Author

Fixed the problem I mentioned above, heres the final solution:

RS2Object brokenTrapFilter = getObjects().closest(new Filter<RS2Object>(){
			@Override
			public boolean match(RS2Object o) {
				return o != null && huntingArea.contains(o) && o.getName().equals("Box trap") &&
						o.hasAction("Dismantle") && !o.hasAction("Investigate");
			}
		});

+ using names instead of ID's

Thanks a lot to both of you for the help

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.