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.

VAG's Chicken Blaster - First Script Ever

Featured Replies

Hello,

I am here to release my first OSBot Script ever. Writing this took me no more than 5 minutes. It is very basic, where I was just testing out OSBot Scripting.. This seems like something I might be doing more @Future.

 

Script has no antiban, except random idle timer after killing a monster. Did a test run with this, and it does attack the chicken.

 

Script can/must be started out @Any Chicken Spawn in RuneScape.

 

Source code

//OSBot API
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

//Importing Java AWT
import java.awt.*;

//Script Details
@ScriptManifest(name = "VAGs Chicken Blaster", author = "VAG", version = 1.0, info = "Public BETA", logo = "")
public class main extends Script {
	
	@Override
	public void onStart() {
		//Defines actions during startup
		log("VAGs Chicken Blaster 1.0 - Welcome!");
		
	}
	
	@Override
	public void onExit() {
		//Executed after the script ends
		log("Thank-you for using VAGs Chicken Blaster!");
	}
	
	@Override
	public int onLoop() throws InterruptedException {
		//Script on loop
		NPC chicken = npcs.closest("Chicken");
		if(!myPlayer().isAnimating() && !myPlayer().isMoving()) {
			if(chicken != null) {
			if (chicken.isVisible()) {
				chicken.interact("Attack");
				sleep(random(300, 600));
			} else {
				camera.toEntity(chicken);
			}
		  }
		} else {
			sleep(random(300, 600));
		}
		
		return(random(100, 300)); //Random(?) Loop timer
	}
	
	@Override
	public void onPaint(Graphics2D g) {
		//Loading paint
		super.onPaint(g);
		g.setColor(Color.GREEN);
		g.drawString("VAG's Chicken Blaster ", 28, 175);
		
	}

}

Rewrote.

Edited by Finland

  • 2 weeks later...

L000000000000000000000000000000L

 

 

This is so fucking bad l0000000000000000000000000l

 

 

r0flr0flr0flr0frlf dying lma0 

 

please learn some java b4 next attempt lma000000000000000000000000000000000 l000000000000000000l

L000000000000000000000000000000L

 

 

This is so fucking bad l0000000000000000000000000l

 

 

r0flr0flr0flr0frlf dying lma0 

 

please learn some java b4 next attempt lma000000000000000000000000000000000 l000000000000000000l

 

Why be an ignorant asshole?

  • Author

Rewrote the script.

import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(info = "", name = "Chickens", logo = "", version = 1.00, author = "Foulwerp" )
public class Chickens extends Script {
    public int onLoop() {
        if (myPlayer().getInteracting() != null) {
            //This check at the start saves resources, because you don't do useless things like find new npcs while in combat
            return random(500, 1000);
        }
        NPC chicken = npcs.closest(new Filter<NPC>() {
            public boolean match(NPC npc) {
                //Multiple checks using a filter to find the best npc to attack. I guess, optimizing this to do the least
                //resource intensive checks first, leading up the the most intensive. If one of the first checks returns
                //false, you didn't waste a bunch of resources. If you check if the npc is reachable first you would waste a lot
                //of resources on an A* algorithm on a mob you may not even want to attack. This is because you are polling
                //all the mobs till one of these returns true to all checks.
                return npc.getName().equals("Chicken") && npc.getHealth() > 0 && npc.isAttackable() && map.canReach(npc);
            }
        });
        if (chicken == null) {
            //If chicken is null just return so you wait for one to spawn
            return random(500, 1000);
        }
        if (!chicken.isOnScreen() {
            //Try to get the chicken on the screen by turning to it
            camera.toEntity(chicken);
            //Returning after doing an action
            return (500, 1000)
        }
        //Attack the chicken then return net iteration should see that I'm interacting which is the first check
        chicken.interact("Attack");
        //Default return but again returned after I completed an action
        return random(500, 1000);
    }
}

I know how hard it can be to learn when you have no reference so I decided to give you one, and a few tips.

 

Once you learn how to use filters life will be a lot easier. You can use multiple checks to find the perfect npc to attack, and not just the closest one to you. Filters can be applied to not only npcs but items, ground items, etc.

 

Instead of checking if your player is moving or animating check if it is interacting with something. In most cases if it is your player is in combat.

 

Try to write your code logically so that you don't have to use sleep. If you return it's better and what you return is how long in milliseconds it waits till it enters the loop again. When your script runs through the loop you want it to do 0 to 1 action and return. So every loop iteration should either have no actions done meaning the default is returned, or do 1 action in which you return a specified amount. Not action sleep another action sleep then return.

 

In a sense returning is sleeping, but a much better way allowing the bot to do what it needs to before you enter the loop again. Randoms aren't a big deal on oldschool but returning allows the bot to check for them and do other background things, sleeping doesn't.

Edited by Foulwerp

    public int onLoop() {
        if (myPlayer().getInteracting() != null) {
            //If my player is interacting I return because there is no point in doing any more checks till I'm out of combat
            return random(500, 1000);
        }
        NPC chicken = npcs.closest(new Filter<NPC>() {
            public boolean match(NPC npc) {
                //Multiple checks using a filter to find the best npc to attack
                return npc.getName().equals("Chicken") && npc.getHealth() > 0 && npc.isAttackable() && map.canReach(npc);
            }
        });
        if (chicken == null) {
            //If chicken is null just return so you wait for one to spawn
            return random(500, 1000);
        }
        if (!chicken.isOnScreen() {
            //Try to get the chicken on the screen by turning to it, and returning after the action
            camera.toEntity(chicken);
            return (500, 1000)
        }
        //Attack the chicken then return net iteration should see that I'm interacting and not proceed
        //further than the first check saving CPU because you're not constantly doing every check in the loop
        chicken.interact("Attack");
        return random(500, 1000);
    }

I know how hard it can be to learn when you have no reference so I decided to give you one, and a few tips.

 

Once you learn how to use filters life will be a lot easier. You can use multiple checks to find the perfect npc to attack, and not just the closest one to you. Filters can be applied to not only npcs but items, ground items, etc.

 

Instead of checking if your player is moving or animating check if it is interacting with something. In most cases if it is your player is in combat.

 

Try to write your code logically so that you don't have to use sleep. If you return it's better and what you return is how long in milliseconds it waits till it enters the loop again. When your script runs through the loop you want it to do 0 to 1 action and return. So every loop iteration should either have no actions done meaning the default is returned, or do 1 action in which you return a specified amount. Not action sleep another action sleep then return.

 

In a sense returning is sleeping, but a much better way allowing the bot to do what it needs to before you enter the loop again. Randoms aren't a big deal on oldschool but returning allows the bot to check for them and do other background things, sleeping doesn't.

 

 

Thanks for that, trying to do my own chicken killer. This will come in handy!

Thanks for that, trying to do my own chicken killer. This will come in handy!

 

NP I did edit my post to explain a little more about what I did and why.

import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(info = "", name = "Chickens", logo = "", version = 1.00, author = "Foulwerp" )
public class Chickens extends Script {
    public int onLoop() {
        if (myPlayer().getInteracting() != null) {
            //This check at the start saves resources, because you don't do useless things like find new npcs while in combat
            return random(500, 1000);
        }
        NPC chicken = npcs.closest(new Filter<NPC>() {
            public boolean match(NPC npc) {
                //Multiple checks using a filter to find the best npc to attack. I guess, optimizing this to do the least
                //resource intensive checks first, leading up the the most intensive. If one of the first checks returns
                //false, you didn't waste a bunch of resources. If you check if the npc is reachable first you would waste a lot
                //of resources on an A* algorithm on a mob you may not even want to attack. This is because you are polling
                //all the mobs till one of these returns true to all checks.
                return npc.getName().equals("Chicken") && npc.getHealth() > 0 && npc.isAttackable() && map.canReach(npc);
            }
        });
        if (chicken == null) {
            //If chicken is null just return so you wait for one to spawn
            return random(500, 1000);
        }
        if (!chicken.isOnScreen() {
            //Try to get the chicken on the screen by turning to it
            camera.toEntity(chicken);
            //Returning after doing an action
            return (500, 1000)
        }
        //Attack the chicken then return net iteration should see that I'm interacting which is the first check
        chicken.interact("Attack");
        //Default return but again returned after I completed an action
        return random(500, 1000);
    }
}

I know how hard it can be to learn when you have no reference so I decided to give you one, and a few tips.

 

Once you learn how to use filters life will be a lot easier. You can use multiple checks to find the perfect npc to attack, and not just the closest one to you. Filters can be applied to not only npcs but items, ground items, etc.

 

Instead of checking if your player is moving or animating check if it is interacting with something. In most cases if it is your player is in combat.

 

Try to write your code logically so that you don't have to use sleep. If you return it's better and what you return is how long in milliseconds it waits till it enters the loop again. When your script runs through the loop you want it to do 0 to 1 action and return. So every loop iteration should either have no actions done meaning the default is returned, or do 1 action in which you return a specified amount. Not action sleep another action sleep then return.

 

In a sense returning is sleeping, but a much better way allowing the bot to do what it needs to before you enter the loop again. Randoms aren't a big deal on oldschool but returning allows the bot to check for them and do other background things, sleeping doesn't.

 

I love you

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.