I started a new account and needed some agility levels, so I figured I'd record myself making an agility script and post it here. The goal of this is to try and encourage others to learn to script. Apologies for those on tiny monitors, the text will be very difficult to read (I make the font bigger about 2.5 minutes in). Also sorry for pauses and random scene switches, I was trying to figure out how to work the recording software and code and talk at the same time... too many things at once.
Watch at max quality (1440p) if you want to be able to read the code.
Source code:
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;
import java.util.Arrays;
@ScriptManifest(author = "eliot", info = "", logo = "", version = 1.0, name = "A GOOD SCRIPT")
public class Main extends Script {
private String[] actions = {"Climb", "Cross", "Balance", "Jump-up", "Jump", "Climb-down"};
private String[] names = {"Rough wall", "Tightrope", "Narrow wall", "Wall", "Gap", "Crate"};
Entity previous;
@Override
public void onStart() {
getExperienceTracker().start(Skill.AGILITY);
}
@Override
public int onLoop() throws InterruptedException {
int starting = getExperienceTracker().getGainedXP(Skill.AGILITY);
Entity nextObj = getObjects().closest(obj -> Arrays.asList(names).contains(obj.getName()) &&
Arrays.asList(actions).contains(obj.getActions()[0]) &&
(getMap().canReach(obj) || obj.getName().equals("Crate")) &&
!obj.equals(previous));
if (nextObj != null && !myPlayer().isMoving()) {
if (nextObj.interact(nextObj.getActions()[0])) {
new ConditionalSleep(10000) {
@Override
public boolean condition() throws InterruptedException {
return getExperienceTracker().getGainedXP(Skill.AGILITY) > starting;
}
}.sleep();
} if (getExperienceTracker().getGainedXP(Skill.AGILITY) > starting) {
previous = nextObj;
}
}
return 250;
}
}