Jump to content

Picking up small fishing net ?


Recommended Posts

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

 

Posted
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)

	}

}

 

Posted (edited)
18 minutes ago, FuryShark said:

Its not the spelling of the item im meaning...

Settings -> options -> debug -> Entity hover debug

ki7YvHT.png
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 by Reminiscence
  • Like 1
Posted
1 hour ago, FuryShark said:

Its not the spelling of the item im meaning...

Settings -> options -> debug -> Entity hover debug

ki7YvHT.png
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!

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