Jump to content

Getting the ID's of nearby objects.


Recommended Posts

Guest Apogee
Posted

I want the script to detect Tin and Copper rocks. I would do it easily by name, but the name and interaction options stay the same when it is already mined. I noticed that the object ID changes when it is mined, so i thought it would be easier to tell the script to mine only certain ID's (of rocks that are not mined.)

I had : 

 

final String TIN_ID = "Tin";

 

Would i change it to:

 

final int TIN_ID = "1234, 1234, 1234, 1234";?

or

final int TIN_ID[] = "1234, 1234, 1234, 1234";?

 

Do i need an array for this? Or am i entirely wrong?
Also, if i need to use an array, how would i set that up?

 

final int array TIN_ID = "1234, 1234, 1234, 1234,"

 

 

 

 

Sorry for all of the questions. I'm looking to help the community out by starting small and learning as effectively as i can.

Thanks

Guest Apogee
Posted
final int[] TIN_IDS = {1234, 1234, 1234, 1234};

 

Perfect, Thank you!

 

Another question, If the ID changes from those to something else, (assuming the ID's for a steaming rock are different than the un-mined rocks), then how do i make the script stop mining the rock?

Posted


RS2Object rock = closestObjectForName("rock");

if(rock != null) {

if(rock.interact("mine") {

RS2Object temp = closestObjectForName("rock");

//basically scans if the closest object is the same object you interacted with

while(rock == temp && rock.exists()) {

sleep(500);

}

}

Something like that i believe
Guest Apogee
Posted
RS2Object rock = closestObjectForName("rock");
   if(rock != null) {
      if(rock.interact("mine") {
         RS2Object temp = closestObjectForName("rock");
         //basically scans if the closest object is the same object you interacted with
      while(rock == temp && rock.exists()) {   
         sleep(500);
       } 
}
Something like that i believe

 

 

Sweet! Thanks

Guest Apogee
Posted

Rock ID's change, you're going to have to update this every week.

 

What other ways can i do it? If i do it by name, i won't be able to differ the mined from the un-mined rocks.

I don't mind updating it weekly if i have to.

Posted (edited)

What other ways can i do it? If i do it by name, i won't be able to differ the mined from the un-mined rocks.

I don't mind updating it weekly if i have to.

If you know the exact location of the rocks you're mining, you can just grab the rocks on those specific locations and store the ID.

 

The rocks of course will have to be full of ore so it doesn't grab the ID of the mined rock.

Edited by Swizzbeat
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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