Deceiver Posted April 22, 2016 Share Posted April 22, 2016 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); Quote Link to comment Share on other sites More sharing options...
Saiyan Posted April 22, 2016 Share Posted April 22, 2016 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 1 Quote Link to comment Share on other sites More sharing options...
iJodix Posted April 22, 2016 Share Posted April 22, 2016 (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 April 22, 2016 by iJodix 1 Quote Link to comment Share on other sites More sharing options...
Deceiver Posted April 22, 2016 Author Share Posted April 22, 2016 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 Quote Link to comment Share on other sites More sharing options...
Woody Posted April 23, 2016 Share Posted April 23, 2016 RS2Object obj = blah ConditionalSleep -> return obj.getId() == the changed id If the objects are not moving position, use the x and y coordinates as iJodix suggested to retrieve a certain object. 1 Quote Link to comment Share on other sites More sharing options...