This is my first ever script this is a work in progress i am using this script to learn more and how to do different things so any help is appreciated.
The purpose of this script is to kill al-kharid warriors .
The code. ( I'm still learning so no need to be harsh but any help is appreciated )
package warriorkiller;
import java.awt.Graphics;
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.model.Entity;
import org.osbot.script.rs2.model.Player;
import org.osbot.script.rs2.utility.Area;
@ScriptManifest(author = "Brody", info = "Kills warriors at al-kharid", name = "Basic warrior", version = 0.2)
public class basicwarrior extends Script {
final String WARRIOR = "Al-Kharid warrior";
final Area PALACE = new Area (3305, 3175, 3280, 3179);
@Override
public void onStart() {
//Before the script starts it goes through this method
log("Go to the palace at al-kharid for this script to work");
}
@Override
public void onPaint(Graphics g) {
//Graphics (displaying graphics on screen)
}
@Override
public int onLoop() throws InterruptedException {
Player player = client.getMyPlayer();
Entity kharid = closestAttackableNPCForName("WARRIOR");
if (PALACE.contains(player)); {
if (kharid !=null) {
if (kharid.isVisible()) {
if (!client.getMyPlayer().isUnderAttack()) {
kharid.interact("Attack");
sleep(random(600, 700));
} else {
client.moveCameraToEntity(kharid);
}
}
}
}
return 50; //sleep time
}
@Override
public void onExit() {
//when stopped
log("thanks for using my script I hope you enjoyed it and it benefited you!.");
}
}
What needs to be done
Banking
Picking up items
Eating
Will add more in future