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.

Tasemu's Descrete Seagulls! | FREE | First Script | Open Source | CnC Welcomed!

Featured Replies

Hey guys, here is my first script for OSBot. The first of hopefully many more. I have open sourced it and you can find the script and the link to Github online. Please feel free to post any comments and constructive criticism of my script right here and don't be shy as I hope to get a few new techniques out of this share to improve my future scripts. If you wanna say thanks for the script then that would also make me pretty happy haha. Welp enjoy ^^

Credits to so many awesome people on this forum. If you have posted on one of my threads, or if I have used a method you shared then please post below and i'll credit you for sure!

Progress reports coming soon... running it now.

Github: https://github.com/Tasemu/osbot_descrete_gulls (fork me baby)

package descrete_gulls;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.util.GraphicUtilities;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import java.awt.*;
import java.util.EnumSet;

@ScriptManifest(author = "Tasemu", info = "Kill seagulls at Port Sarim", name = "Descrete Gulls", version = 1.1, logo = "")
public class main extends Script {
	private Area docks = new Area(
	    new int[][]{
	        { 3026, 3241 },
	        { 3030, 3241 },
	        { 3030, 3238 },
	        { 3047, 3238 },
	        { 3047, 3234 },
	        { 3030, 3234 },
	        { 3030, 3211 },
	        { 3026, 3211 },
	        { 3026, 3216 },
	        { 3018, 3216 },
	        { 3018, 3220 },
	        { 3026, 3220 }
	    }
	);
	private NPC target;
	private enum State {
		WAIT,
		WALK,
		ATTACK
	};
	private EnumSet<Skill> skillToTrain = EnumSet.of(Skill.ATTACK, Skill.STRENGTH, Skill.DEFENCE, Skill.HITPOINTS);
	private long startTime;
	private int gullsKilled = 0;
	
	@Override
	public void onStart() {
		log("Welcome to Descrete Gulls.");
		log("version: " + getVersion());
		startTime = System.currentTimeMillis();
		
		for (Skill skill : skillToTrain) {
			getExperienceTracker().start(skill);
		}
	}

	private State getState() {
		NPC gull = getNpcs().closest("Seagull");
		
		if (target != null && myPlayer().isInteracting(target))
			return State.WAIT;
		
		if (!docks.contains(myPlayer()))
			return State.WALK;
		
		if (
			gull != null &&
			!gull.isUnderAttack() &&
			!gull.isHitBarVisible()
		)
			return State.ATTACK;
		
		return State.WAIT;
	}

	@Override
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case ATTACK:
			target = getNpcs().closest("Seagull");
			if (target != null) {
				if (target.interact("Attack")) {
					new ConditionalSleep(random(3000, 5000)) {
						@Override
						public boolean condition() throws InterruptedException {
							return target != null &&
								   target.getHealthPercent() > 0;
						}
					}.sleep();
				}
			}
			break;
		case WALK:
			getWalking().webWalk(docks);
			break;
		case WAIT:
			
			if (target != null && target.getHealthPercent() == 0) {
				this.gullsKilled++;
				this.target = null;
			}
			
			if (this.getDialogues().isPendingContinuation()) {
				this.getDialogues().clickContinue();
			}
			
			sleep(random(500, 700));
			break;
		}
		return random(200, 300);
	}

	@Override
	public void onExit() {
		log("Bye!");
	}

	@Override
	public void onPaint(Graphics2D g) {
		final long runTime = System.currentTimeMillis() - startTime;
		drawMouse(g);
		g.setColor(Color.WHITE);
		g.drawString("Descrete Gulls Public v" + this.getVersion(), 10, 40);
		g.drawString("Status:  " + getState().toString().toLowerCase() + "ing", 10, 55);
		g.drawString("Time running: " + formatTime(runTime), 10, 70);
		g.drawString("Gulls Wasted: " + this.gullsKilled, 10, 85);
		int trainingPaintMargin = 0;
		
		for (Skill skill : skillToTrain) {
			if (getExperienceTracker().getGainedXP(skill) > 0) {
				g.drawString(skill.toString().toLowerCase() + " xp: " + getExperienceTracker().getGainedXP(skill), 10, 100 + trainingPaintMargin);
				trainingPaintMargin += 15;
			}
		}
		
		if (target != null && target.exists()) {
			g.setColor(Color.RED);
			GraphicUtilities.drawWireframe(getBot(), g, target);
		}
	}
	
	public 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 void drawMouse(Graphics graphics) {
		((Graphics2D) graphics).setRenderingHints(
			new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
		Point pointer = mouse.getPosition();
		Graphics2D spinG = (Graphics2D) graphics.create();
		Graphics2D spinGRev = (Graphics2D) graphics.create();
		spinG.setColor(new Color(255, 255, 255));
		spinGRev.setColor(Color.cyan);
		spinG.rotate(System.currentTimeMillis() % 2000d / 2000d * (360d) * 2 * Math.PI / 180.0, pointer.x, pointer.y);
		spinGRev.rotate(System.currentTimeMillis() % 2000d / 2000d * (-360d) * 2 * Math.PI / 180.0, pointer.x, pointer.y);
		final int outerSize = 20;
		final int innerSize = 12;
		spinG.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
		spinGRev.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
		spinG.drawArc(pointer.x - (outerSize / 2), pointer.y - (outerSize / 2), outerSize, outerSize, 100, 75);
		spinG.drawArc(pointer.x - (outerSize / 2), pointer.y - (outerSize / 2), outerSize, outerSize, -100, 75);
		spinGRev.drawArc(pointer.x - (innerSize / 2), pointer.y - (innerSize / 2), innerSize, innerSize, 100, 75);
		spinGRev.drawArc(pointer.x - (innerSize / 2), pointer.y - (innerSize / 2), innerSize, innerSize, -100, 75);
	}

}

 

Edited by Tasemu

  • Author
2 hours ago, Prolax said:

Instead of states you could just use methods. I'll test it today.

Sweet, how do you mean man? just have each method check if it should be running itself? Is that similar to a task based script or do you mean something else? ^^

7 hours ago, Tasemu said:

Sweet, how do you mean man? just have each method check if it should be running itself? Is that similar to a task based script or do you mean something else? ^^

For example in your onLoop, you just call the method attackNpc(), no need for states. But that's just how I prefer it.

        if (gull != null && !gull.isUnderAttack() && !gull.isHitBarVisible())
            attackNpc();
        }

I tried the script, the attacking of the next seagull could be a bit faster. Very nice for your first script though.

hey can you help me how to add.

 

which file do i need to move to my local script olfder?

  • Author

I haven't included a .jar file as I assumed the SDN is already inundated with basic combat scripts. You can easily compile this yourself with eclipse. Would you like me to upload the jar?

17 hours ago, spectre007 said:

hey can you help me how to add.

 

which file do i need to move to my local script olfder?

As said, compile it to a jar using eclipse or intelliJ.

On 2017-5-23 at 10:15 AM, Tasemu said:

I haven't included a .jar file as I assumed the SDN is already inundated with basic combat scripts. You can easily compile this yourself with eclipse. Would you like me to upload the jar?

please upload the jar much easier for everyone

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.