sdsdsd Posted September 8, 2022 Share Posted September 8, 2022 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? Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted September 8, 2022 Share Posted September 8, 2022 well you are loading the closest one, thats the one you are mining. load all rocks and filter out what you need Quote Link to comment Share on other sites More sharing options...
sdsdsd Posted September 9, 2022 Author Share Posted September 9, 2022 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 Quote Link to comment Share on other sites More sharing options...
Gunman Posted September 10, 2022 Share Posted September 10, 2022 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. Quote Link to comment Share on other sites More sharing options...
sdsdsd Posted September 10, 2022 Author Share Posted September 10, 2022 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 Quote Link to comment Share on other sites More sharing options...
Gunman Posted September 10, 2022 Share Posted September 10, 2022 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); } Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted September 11, 2022 Share Posted September 11, 2022 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 Quote Link to comment Share on other sites More sharing options...
sdsdsd Posted September 24, 2022 Author Share Posted September 24, 2022 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 Quote Link to comment Share on other sites More sharing options...
sdsdsd Posted September 25, 2022 Author Share Posted September 25, 2022 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"? Quote Link to comment Share on other sites More sharing options...
Gunman Posted September 25, 2022 Share Posted September 25, 2022 7 hours ago, sdsdsd said: i dont understand the (Message message) parameter. Typeid ?, My osrs username?, the message like "nest"? I don't understand what you're trying to ask Quote Link to comment Share on other sites More sharing options...
progamerz Posted September 26, 2022 Share Posted September 26, 2022 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 Quote Link to comment Share on other sites More sharing options...