package natRune;
import java.awt.Graphics2D;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
@ScriptManifest(author = "", info = "Ardougne", name = "Ardougne Stealer", version = 0.01, logo = "")
public class natRune extends Script {
private long timeBegan;
private long timeRan;
@Override
public void onStart() {
log("Welcome to 's script!");
log("If you find any bugs or have any suggestions, please contact me!");
timeBegan = System.currentTimeMillis();
}
@Override
public void onExit() {
log("Thanks for using 's script!");
}
private enum State {
WAIT, SEARCH
};
private State getState() {
Entity chest = objects.closest("Chest");
if (chest != null)
return State.SEARCH;
return State.WAIT;
}
public void onPaint(Graphics2D g)
{
Graphics2D gr = g;
timeRan = System.currentTimeMillis() - this.timeBegan;
g.drawString(ft(timeRan), 10, 320);
}
private String ft(long duration)
{
String res = "";
long days = TimeUnit.MILLISECONDS.toDays(duration);
long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
if (days == 0)
{
res = (hours + ":" + minutes + ":" + seconds);
}
else
{
res = (days + ":" + hours + ":" + minutes + ":" + seconds);
}
return res;
}
@Override
public int onLoop() throws InterruptedException {
switch (getState()) {
case SEARCH:
Entity chest = objects.closest("Chest");
if (chest != null) {
chest.interact("Search for traps");
}
case WAIT:
sleep(random(15713, 17913));
break;
}
return random(201, 319);
}
}
Hi! This is one of my first scripts, so I thought I'd keep it simple.
It is by the chests where you steal 1 nat and 3gp in Ardougne. There are two chests up there, but my script just has it to interact with the nearest chest. Is there any way to loot one even if your closer to another?
- Another idea. Could I have it so it interacts with one chest, follows a walkPath command to the other chest, loots it, and bank?
Any help is appreciated!