LagunaPreza Posted July 19, 2020 Share Posted July 19, 2020 (edited) Hey, Could someone help me with this piece of code ? I'm trying to make a small fish net looter but my character does nothing. GroundItem net = getGroundItems().closest("Small fishing net"); if(!inventory.isFull() && net != null) { net.interact("Take"); } Edited July 19, 2020 by LagunaPreza Quote Link to comment Share on other sites More sharing options...
FuryShark Posted July 19, 2020 Share Posted July 19, 2020 Settings -> Options -> Debug -> Entity hover debug look at the name Quote Link to comment Share on other sites More sharing options...
Reminiscence Posted July 19, 2020 Share Posted July 19, 2020 10 minutes ago, FuryShark said: Settings -> Options -> Debug -> Entity hover debug look at the name he has it spelled correctly, lol @op how are you calling this method? Quote Link to comment Share on other sites More sharing options...
LagunaPreza Posted July 19, 2020 Author Share Posted July 19, 2020 13 minutes ago, Reminiscence said: he has it spelled correctly, lol @op how are you calling this method? I've put this code in the OnLoop Quote Link to comment Share on other sites More sharing options...
Reminiscence Posted July 19, 2020 Share Posted July 19, 2020 2 minutes ago, LagunaPreza said: I've put this code in the OnLoop that's odd, the code should work then. either way, here you go. import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "test", author = "Reminiscence", version = 1.0, info = "", logo = "") public class test extends Script { GroundItem net; public int onLoop() throws InterruptedException { net = groundItems.closest("Small fishing net"); if (net != null && !inventory.isFull() && map.canReach(net)) { net.interact(); sleepy(2500, net == null); } if (net == null) sleep(200); return 100; } public void sleepy(int time, boolean until) { new ConditionalSleep(time) { @Override public boolean condition() throws InterruptedException { return until; } }.sleep(); } } Quote Link to comment Share on other sites More sharing options...
LagunaPreza Posted July 19, 2020 Author Share Posted July 19, 2020 17 minutes ago, Reminiscence said: that's odd, the code should work then. either way, here you go. import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "test", author = "Reminiscence", version = 1.0, info = "", logo = "") public class test extends Script { GroundItem net; public int onLoop() throws InterruptedException { net = groundItems.closest("Small fishing net"); if (net != null && !inventory.isFull() && map.canReach(net)) { net.interact(); sleepy(2500, net == null); } if (net == null) sleep(200); return 100; } public void sleepy(int time, boolean until) { new ConditionalSleep(time) { @Override public boolean condition() throws InterruptedException { return until; } }.sleep(); } } Thanks for the code but for some reason this also doesn't work for me.. My code now: package core; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "Small Net Looter", author = "LagunaPreza", version = 1.0, info = "", logo = "") public class NetLooter extends Script { @Override public void onStart() { // Code here will execute before the loop is started } @Override public void onExit() { // Code here will execute after the script ends } @Override public int onLoop() throws InterruptedException { GroundItem net; net = groundItems.closest("Small fishing net"); if(net != null && !inventory.isFull() && map.canReach(net)) { net.interact("Take"); sleepy(2500, net == null); } if(net == null) { sleep(200); } return 700; // The amount of time in milliseconds before the loop starts over } public void sleepy(int time, boolean until) { new ConditionalSleep(time) { @Override public boolean condition() throws InterruptedException { return until; } }.sleep(); } @Override public void onPaint(Graphics2D g) { // This is where you will put your code for paint(s) } } Quote Link to comment Share on other sites More sharing options...
Reminiscence Posted July 19, 2020 Share Posted July 19, 2020 What about it doesn't work? Does the script start? Does it hover over the object? Is there anything in the logger? Are you sure you're trying to loot a small fishing net? Is your inventory full? Can you walk to the fishing net? Can you buy a small fishing net, drop it underneath you and run the script to see if it gets picked up? Quote Link to comment Share on other sites More sharing options...
FuryShark Posted July 19, 2020 Share Posted July 19, 2020 (edited) 4 hours ago, Reminiscence said: he has it spelled correctly, lol @op how are you calling this method? Its not the spelling of the item im meaning... Settings -> options -> debug -> Entity hover debug its missing <col=ff9040> </col> @LagunaPreza Edited July 19, 2020 by FuryShark Quote Link to comment Share on other sites More sharing options...
Reminiscence Posted July 19, 2020 Share Posted July 19, 2020 (edited) 18 minutes ago, FuryShark said: Its not the spelling of the item im meaning... Settings -> options -> debug -> Entity hover debug its missing <col=ff9040> </col> @LagunaPreza ah that's awkward, it's tagged as an object instead of a grounditem. i wasn't aware of that lol @LagunaPreza here's something that works then import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "test", author = "Reminiscence", version = 1.0, info = "", logo = "") public class test extends Script { RS2Object net; public int onLoop() throws InterruptedException { net = objects.closestThatContains("Small fishing net"); if (net != null && !inventory.isFull() && map.canReach(net)) { net.interact(); sleepy(2500, net == null); } if (net == null) sleep(200); return 100; } public void sleepy(int time, boolean until) { new ConditionalSleep(time) { @Override public boolean condition() throws InterruptedException { return until; } }.sleep(); } } since the object doesn't seem to disappear, i guess it makes no sense to have a conditionalsleep of this manner. you could just do a sleep(200) or something so it doesn't spam click like a typical bot would Edited July 19, 2020 by Reminiscence 1 Quote Link to comment Share on other sites More sharing options...
LagunaPreza Posted July 19, 2020 Author Share Posted July 19, 2020 1 hour ago, FuryShark said: Its not the spelling of the item im meaning... Settings -> options -> debug -> Entity hover debug its missing <col=ff9040> </col> @LagunaPreza 1 hour ago, Reminiscence said: ah that's awkward, it's tagged as an object instead of a grounditem. i wasn't aware of that lol @LagunaPreza here's something that works then import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "test", author = "Reminiscence", version = 1.0, info = "", logo = "") public class test extends Script { RS2Object net; public int onLoop() throws InterruptedException { net = objects.closestThatContains("Small fishing net"); if (net != null && !inventory.isFull() && map.canReach(net)) { net.interact(); sleepy(2500, net == null); } if (net == null) sleep(200); return 100; } public void sleepy(int time, boolean until) { new ConditionalSleep(time) { @Override public boolean condition() throws InterruptedException { return until; } }.sleep(); } } since the object doesn't seem to disappear, i guess it makes no sense to have a conditionalsleep of this manner. you could just do a sleep(200) or something so it doesn't spam click like a typical bot would Ohh man, I didn't know that lol Thanks for the help! Quote Link to comment Share on other sites More sharing options...