Jump to content

Picking up small fishing net ?


LagunaPreza

Recommended Posts

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

 

Link to comment
Share on other sites

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)

	}

}

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

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