Jump to content

Object Help


Recommended Posts

Posted

What I'm trying to do:

-Two objects are a few tiles apart

-Both have the same ID until you click on one and changes 

-Interact with one, sleep till the ID is changed, interact with the other, sleep, and repeat

 

What I'm having trouble is with how would I differentiate that object ID is changed? I already have defined both IDs of the object but not sure how to compare them.  I would think if i had a CondSleep -> return player.animating; it kind of spam clicks the object because it hasn't changed yet. So with that, I think I need a better sleep, or could i just do sleep(int); 

 

Posted

What I'm trying to do:

-Two objects are a few tiles apart

-Both have the same ID until you click on one and changes 

-Interact with one, sleep till the ID is changed, interact with the other, sleep, and repeat

 

What I'm having trouble is with how would I differentiate that object ID is changed? I already have defined both IDs of the object but not sure how to compare them.  I would think if i had a CondSleep -> return player.animating; it kind of spam clicks the object because it hasn't changed yet. So with that, I think I need a better sleep, or could i just do sleep(int); 

ID? why not string name?

ID? why not string name?

 

nvm xD

  • Like 1
Posted (edited)

RS2Object object1 = getObjects().closest(o -> o.getId() == 1 && o.getPosition().getX() == 1 && o.getPosition().getY() == 1);

RS2Object object2 = getObjects().closest(o -> o.getId() == 2 && o.getPosition().getX() == 2 && o.getPosition().getY() == 2);

 

if (object1 != null) {

//interact with object1

} else {

if (object2 != null) {

//interact with object2

}

Edited by iJodix
  • Like 1
Posted

RS2Object object1 = getObjects().closest(o -> o.getId() == 1 && o.getPosition().getX() == 1 && o.getPosition().getY() == 1);

RS2Object object2 = getObjects().closest(o -> o.getId() == 2 && o.getPosition().getX() == 2 && o.getPosition().getY() == 2);

 

if (object1 != null) {

//interact with object1

} else {

if (object2 != null) {

//interact with object2

}

thx :)

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