Jump to content

Object Help


Deceiver

Recommended Posts

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); 

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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