Vag Posted May 14, 2015 Share Posted May 14, 2015 This is a educational release for a simple chicken killing script. The script will attack the monster (chicken). This will not eat or loot, just a basic bare bone for chicken killer. //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 = "Chicken Killer", author = "YOU!!", version = 1.0, info = "", logo = "") public class main extends Script { @Override public void onStart() { log("Welcome - your first script!"); } @Override public void onExit() { log("K Bye"); } @Override public int onLoop() throws InterruptedException { //Script on loop NPC chicken = npcs.closest("Chicken"); //Looking for non-player character chicken, which will be the closest NPC called chicken if(!myPlayer().isAnimating() && !myPlayer().isMoving()) { if(chicken != null) { if (chicken.isVisible()) { chicken.interact("Attack"); sleep(random(300, 600)); //If chicken is available on the screen, we will perform interaction Attack on it. } else { camera.toEntity(chicken); //Moving camera so that the chicken will be visible on the screen. } } } else { sleep(random(300, 600)); //Sleeping for with devitation } return(random(100, 300)); //Starting the script over after random sleep in milliseconds. } @Override public void onPaint(Graphics2D g) { //Loading paint super.onPaint(g); g.setColor(Color.GREEN); g.drawString("Uncle Dolan had a chikun ", 5, 290); //Text color is GREEN - printing a line in the client saying Uncle Dolan had a chikun } } K bye Quote Link to comment Share on other sites More sharing options...
lare96 Posted May 14, 2015 Share Posted May 14, 2015 (edited) You should probably use some sort of event-node state system as it's much more modular, manageable, and it just looks better. Not trying to be a dick or anything, but especially for new scripters that aren't familiar with Java it's better to show them the best way of doing things so they learn and get comfortable with it from early on. Edited May 14, 2015 by lare96 Quote Link to comment Share on other sites More sharing options...