Jump to content

Mining bot hoover() help


Recommended Posts

Posted

Hello,

 

I'm building a miningbot who mines coal at mining guild. It works perfectly but i cant get the next rock hoover while mining the first one.

 

So i want to hoover to next rock already when mining the other. Im only able to identify rocks by:

MethodProvider method = client.getMethods();
Entity rock = method.objects.closest(rockID1, 

So how i can detect more rocks already and decide the next one and hoover the mouse already there?

 

Posted
18 hours ago, Khaleesi said:

well you are loading the closest one, thats the one you are mining.
load all rocks and filter out what you need 😉

 

Thank you for replying.

 

I ended up using:

RS2Object[] kivi = objects.getAll().stream().filter(o -> o.getId() == 11366 || o.getId() == 11367).toArray(RS2Object[]::new);
ekakivi = kivi[1];
tokakivi = kivi[2];

 

Like this

Posted
3 hours ago, Gunman said:

Same way you get the rock to mine, just pass the rock you're already mining and add to the filter to ignore that one.

Could you give me little snippet, i have been trying to make it work 2 days now and i just dont know...I'm making this for my purposes, not for selling

Posted
2 hours ago, sdsdsd said:

Could you give me little snippet, i have been trying to make it work 2 days now and i just dont know...I'm making this for my purposes, not for selling

Some shit like this I guess
 

    private void mineRocks() {
        final RS2Object mineRock = getRock(null);
        final RS2Object hoverRock = getRock(mineRock);
    }


    private RS2Object getRock(final RS2Object ignoreRock) {
        //Just add this condition to your filter to get the next rock basically
        // r != ignoreRock
        return getObjects().closest(r -> r.getId() == 0 && r != ignoreRock);
    }

 

  • 2 weeks later...
Posted
On 9/10/2022 at 5:48 PM, Gunman said:

Some shit like this I guess
 

    private void mineRocks() {
        final RS2Object mineRock = getRock(null);
        final RS2Object hoverRock = getRock(mineRock);
    }


    private RS2Object getRock(final RS2Object ignoreRock) {
        //Just add this condition to your filter to get the next rock basically
        // r != ignoreRock
        return getObjects().closest(r -> r.getId() == 0 && r != ignoreRock);
    }

 

Thank you very much sir!

 

I'm new to java world and trying to learn programming

Posted
On 9/10/2022 at 5:48 PM, Gunman said:

 

Spoiler

 

 

 

Spoiler

 

 

Could you guys help me at another task. I'm trying to read chatbox when bird nest spawns to me

 

@Override
public void onMessage(Message message) throws java.lang.InterruptedException {
    String txt = message.getMessage().toLowerCase();
    if (txt.contains("nest")) {
      nest++
    }
}

 

but when i try to implement the method

onMessage();

i dont understand the (Message message) parameter.

Typeid ?, My osrs username?, the message like "nest"?

Posted
21 hours ago, sdsdsd said:

 

  Hide contents

 

 

Could you guys help me at another task. I'm trying to read chatbox when bird nest spawns to me

 

@Override
public void onMessage(Message message) throws java.lang.InterruptedException {
    String txt = message.getMessage().toLowerCase();
    if (txt.contains("nest")) {
      nest++
    }
}

 

but when i try to implement the method

onMessage();

i dont understand the (Message message) parameter.

Typeid ?, My osrs username?, the message like "nest"?

You can check the docs for detailed information about classes, here is the java docs for Message
You don't have to call onMessage() manually anywhere in the script, it will automatically be listening for new messages whenever you run the script

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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