Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Free || WindPower || BarbVillageFisher || Banking || First Release :) || Source Code

Featured Replies

Hello all,

 

This is my first script that I'm posting on OSBot, enjoy. :); all feedback, requests and progress images are welcome.

To Start:

Spoiler
  • It web walks to the correct area & checks for fly fishing rod & feathers.
  • To start fishing the quickest, start with the rod & feathers at the barb village fishing spot.
  • If you don't start that way, the logic should handle it for you & it shouldn't be a problem.

 

ChangeLog:

Spoiler

V 1.0

  • Luring trout and salmon in barbarian village.
  • Banking fish in Edgeville.
  • Custom randomization of clicking frequency.
  • Paint showing runtime and some information about your fishing stats.
  • Checks for presence of fly fishing rod & feathers in inventory before trying to fish.
  • Will logout when you run out of feathers.

 

To Add:

Spoiler
  • Custom walking
  • Powerfishing

Source Code: 

Spoiler

Sleep Class :

 

EdgeFisher Class:

i


import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
import java.util.Random;

@ScriptManifest(name = "EdgevilleFisher", author = "WindPower", version = 1.0, info = "", logo = "") 

public class EdgeFisher extends Script {
	
	private final Area EDGEFISHINGAREA1 = new Area(3104,3431,3109,3435);
	private final Area EDGEFISHINGAREA2 = new Area(3100,3424,3103,3426);	
    private long startTime;
    
    private final String formatTime(final long ms){
        long s = ms / 1000, m = s / 60, h = m / 60;
        s %= 60; m %= 60; h %= 24;
        return String.format("%02d:%02d:%02d", h, m, s);
    }    

    private long probableSleep(long lastClick) {
    	Random generator = new Random(System.currentTimeMillis());
    	long randomNum = (long)(generator.nextDouble() * 100);
    	if(lastClick < 4000)     		
    		return random(1000, 3000);    	
    	else if(randomNum <= 10) 
    		return random(1500, 3000);
    	else if (randomNum > 10 && randomNum <= 35) 
    		return random(2500, 3350);
    	else if (randomNum > 35 && randomNum <= 80)
    		return random(4000, 7500);
    	else if (randomNum > 80 && randomNum <= 95)
    		return random(7000, 9000);
    	else
    		return random(6000, 10000);    	
    }
	
	private void bank() throws InterruptedException {
		if (!Banks.EDGEVILLE.contains(myPosition())) {
			getWalking().webWalk(Banks.EDGEVILLE);
		} else if (!getBank().isOpen()) {
			getBank().open();
		} else if (!getInventory().isEmptyExcept(309, 314)) {
			getBank().depositAllExcept(309, 314);
		} else if (!getInventory().contains(309) || !getInventory().contains(314)) {
			if (!getInventory().contains(309)) {
				if(getBank().contains(309))
					getBank().withdraw(309, 1);
				else {
					log("No fly fishing rod in bank");
					stop(true);
				}
			}			
			if (!getInventory().contains(314)) {
				if(getBank().contains(314))
					if(getBank().getAmount(314) > 1)
						getBank().withdrawAllButOne(314);
					else {
						log("Only one feather in the bank");
						stop(true);
					}						
				else {
					log("No feathers in bank");
					stop(true);
				}
			}				
		} else {
			stop(true);
		}
	}
	
	private void fish() throws InterruptedException {
		if (!(EDGEFISHINGAREA1.contains(myPosition())) && !(EDGEFISHINGAREA2.contains(myPosition()))) {
			getWalking().webWalk(EDGEFISHINGAREA1);		
		} else if (getNpcs().closest(1526) != null) {
			NPC fishingSpot = getNpcs().closest(1526);
			Position fishPos = fishingSpot.getPosition();
			if (fishingSpot.interact("Lure")) {				
				Sleep.sleepUntil(() -> (myPlayer().isInteracting(fishingSpot) && myPlayer().isAnimating()), 5000);
				long lastClick = System.currentTimeMillis();
				Sleep.sleepUntil(() -> (!(myPlayer().isAnimating()) || getDialogues().isPendingContinuation() || getInventory().isFull()) || !(fishPos.equals(fishingSpot.getPosition())), 480000);
	    		sleep(probableSleep(System.currentTimeMillis() - lastClick));	    		
			}
		} else {
			if (EDGEFISHINGAREA1.contains(myPosition()))
				getWalking().webWalk(EDGEFISHINGAREA2);	
			else if (EDGEFISHINGAREA2.contains(myPosition()))
				getWalking().webWalk(EDGEFISHINGAREA1);	
		}
		
	}
	
	private enum State {
		FISH, BANK
	}
	
	private State getState() {
		if (getInventory().isFull() || (!getInventory().contains(309) || !getInventory().contains(314)))
			return State.BANK;
		else
			return State.FISH;
	}	
	

    @Override
    public void onStart() {
    	log("Welcome!");
    	startTime = System.currentTimeMillis();
    	getExperienceTracker().start(Skill.FISHING);
    }    

    @Override
    public void onExit() {
        //Code here will execute after the script ends
    }

    @Override
    public int onLoop() throws InterruptedException {
    	switch (getState()) {
    	case BANK:
    		bank();
    		break;
    	case FISH:
    		fish();
    		break;
    	}    	
        return 0; //The amount of time in milliseconds before the loop starts over
    }

    @Override
    public void onPaint(Graphics2D g) {
    	
    	g.setColor(Color.black);
    	g.fillRect(5, 25, 160, 85);
    	g.setFont(Font.getFont(Font.DIALOG));  
    	g.setFont(g.getFont().deriveFont(12.0f));
    	g.setColor(Color.white);
    	g.drawString("Time Elapsed: " + formatTime((System.currentTimeMillis() - startTime)), 10, 40);
    	g.drawString("Fishing Levels Gained: " + getExperienceTracker().getGainedLevels(Skill.FISHING), 10, 55);
    	g.drawString("XP per Hr: " + getExperienceTracker().getGainedXPPerHour(Skill.FISHING), 10, 70);
    	g.drawString("Total XP: " + getExperienceTracker().getGainedXP(Skill.FISHING), 10, 85);
    	g.drawString("XP to next level: " + getSkills().experienceToLevel(Skill.FISHING), 10, 100);
    }

}

 

 

Jar File:

 

Progress Pics:

Spoiler

image.png.15f326502101cee23d545b71b4c670bf.png

 

 

A special thanks to @Explv for his Sleep class

 

as well as @Fruity @Juggles @Viston @Alek and everybody else in the chatbox who take the time to respond to my questions to help me figure things out.

Edited by WindPower

Without "TheWind" you'll get no power ;)

 

Also, nice job on your first release!

  • 1 month later...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.