Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • How can I get multiple gameobject id's at the same time?


    pakruojinis

    Recommended Posts

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

    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.

    Link to comment
    Share on other sites

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

     

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.