Jump to content

Mining bot hoover() help


sdsdsd

Recommended Posts

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?

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

On 9/9/2022 at 1:35 PM, sdsdsd said:

 

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

Onbjest ids change often so you might wanna use names 😉

Link to comment
Share on other sites

  • 2 weeks later...
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

Link to comment
Share on other sites

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"?

Link to comment
Share on other sites

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

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...