pakruojinis 11 Posted August 7, 2021 Hello everyone, I recently tried making a mining script, as every rock in the game is just named "Rocks" I'm searching for it by id, however I noticed that it was only mining some specific ores and soon found out the problem is that for whatever reason ores in different locations have a different id's, can I somehow search for any id from selected ones that is closest to me? Here's what searching function I used GameObject tin = GameObjects.closest(n -> n.getID() == 11360);
Pandemic 2818 Posted August 7, 2021 Hey there, if your only requirement is to find the closest object with any matching ID you can use something like this: GameObject closestObject = GameObjects.closest(1, 2, 3); Where 1, 2, and 3 are ID's you'd like to look for.
pakruojinis 11 Author Posted August 7, 2021 Hey, thanks for the reply, now it does click on the second or third rock, but my new problem that it prioritizes one rock over the other, I even have it to sleep until the player isn't moving, but what it does it clicks on the second one after mining the first one, and if the first one appears, it just clicks on it ignoring that it is mining another rock, here's my code and I know the id's are of copper ore I just tested with the closest one private void mineOre() { GameObject tin = GameObjects.closest(10943, 11161); if (tin != null && tin.interact("Mine")) { int countLog = Inventory.count("Tin ore"); sleepUntil(()->getLocalPlayer().isStandingStill(), (Calculations.random(172524, 180453))); sleep (Calculations.random(230, 530)); } }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.