Jump to content

Misclicking objects


Recommended Posts

Posted

I have an object I an clicking by doing 

obstacle = objects.closest(27985);

obstacle.interact("Climb");

 

However, this object is directly next to another object and it often misclicks the wrong obstacle. How can I stop from misclicking the wrong object? I have tried to have the code stop and stand still before trying to interact with the object, but it still can misclick. Any snippets to help?

Posted (edited)
On 2/22/2017 at 1:12 AM, saurav2008 said:

I have an object I an clicking by doing 

obstacle = objects.closest(27985);

obstacle.interact("Climb");

 

However, this object is directly next to another object and it often misclicks the wrong obstacle. How can I stop from misclicking the wrong object? I have tried to have the code stop and stand still before trying to interact with the object, but it still can misclick. Any snippets to help?

Try to get your object by position. Write a filter something like 

	RS2Object ladder = s.objects.closest(new Filter<RS2Object>() {
		@Override
		public boolean match(RS2Object obj) {
			return obj.getName().equals("Ladder") && obj.hasAction("Climb-Up") && obj.getPosition().getX() >= X_COORDINATE; 
		}
	});

And also you can add a fail-safe if he accidentally still misclicks. Something like if you're in an area that you don't want to be in - climb back up and try again

On 2/22/2017 at 1:30 AM, Prozen said:

The two objects next to each other don't have the same id right? Also note you shouldn't use ids for objects as ids change every update, causing your script to break.

Lol they don't change id's each update :D But yeah, you're right, bad practice.

Edited by nosepicker
Posted
11 hours ago, nosepicker said:

Try to get your object by position. Write a filter something like 


	RS2Object ladder = s.objects.closest(new Filter<RS2Object>() {
		@Override
		public boolean match(RS2Object obj) {
			return obj.getName().equals("Ladder") && obj.hasAction("Climb-Up") && obj.getPosition().getX() >= X_COORDINATE; 
		}
	});

And also you can add a fail-safe if he accidentally still misclicks. Something like if you're in an area that you don't want to be in - climb back up and try again

Lol they don't change id's each update :D But yeah, you're right, bad practice.

A lot of objects ids get changed nearly every update.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...