Hi folks,
I took an advanced Java course almost a year ago and made good marks, but haven't touched an IDE since then.. I thought I would try my hand at scripting, so I would appreciate any feedback on this script!
Thanks!
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
@ScriptManifest(name = "Draynor Agility Course", author = "", version = 1.0, info = "", logo = "")
public class Draynor_Agility extends Script{
RS2Object RoughWall = getObjects().closest("Rough Wall");//'Climb'
RS2Object Tightrope = getObjects().closest("Tightrope");//'Cross'
RS2Object Tightrope2 = getObjects().closest("Tightrope");//'Cross'
RS2Object NarrowWall = getObjects().closest("Narrow Wall");//'Balance
RS2Object Wall = getObjects().closest("Wall");//'Jump-up'
RS2Object Gap = getObjects().closest("Gap");//'Jump'
RS2Object Crate = getObjects().closest("Crate");//'Climb-down'
int checkPoint = 0;
@Override
public void onStart(){
log("Started Successfully");
//Code here will execute before the loop is started
}
@Override
public void onExit(){
log("Ended Successfully");
//Code here will execute after script ends
}
@Override
public int onLoop() throws InterruptedException{
if (checkPoint == 0 && RoughWall != null && !myPlayer().isAnimating()) {
RoughWall.interact("Climb");
checkPoint++;
}
else if(checkPoint == 1 && Tightrope != null && !myPlayer().isAnimating()){
Tightrope.interact("Cross");
checkPoint++;
}
else if(checkPoint == 2 && Tightrope2 != null && !myPlayer().isAnimating()){
Tightrope2.interact("Cross");
checkPoint++;
}
else if(checkPoint == 3 && NarrowWall != null && !myPlayer().isAnimating()){
NarrowWall.interact("Balance");
checkPoint++;
}
else if(checkPoint == 4 && Wall != null && !myPlayer().isAnimating()){
Wall.interact("Jump-up");
checkPoint++;
}
else if(checkPoint == 5 && Gap != null && !myPlayer().isAnimating()){
Gap.interact("Jump");
checkPoint++;
}
else if(checkPoint == 6 && Crate != null && !myPlayer().isAnimating()){
Crate.interact("Climb-down");
checkPoint = 0;
}
else return random(200,300);
return random(200,300); //the amount of time before the loop starts over
}
public void onPaint(Graphics2D g){}
//This is where you will put your code for paint(s)
}