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