import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.util.Map;
import org.rsbot.bot.Bot;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.Calculations;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(authors = { "iPodnano" }, category = "Agility", name = "iGnomeAgility", version = 1.0, description = ("<html><head>"+
"</head><body>"
+ "<center><strong><h2>" + "iGnomeAgility" + " v" + 1.0 + "</h2></strong></center>"
+ "Start Script at the Log"
+ "</body></html>"))
public class iGnomeAgility extends Script implements ServerMessageListener {
public final RSTile clog = new RSTile(2474, 3428);
public final RSTile crlog = new RSTile(2474, 3433);
public final RSTile crope = new RSTile(2484, 3420);
boolean crossing = false;
int exp = 0;
int loops = 0;
String survmess = "";
public final RSTile net = new RSTile(2486, 3425);
final int object_downbranch = 2313;
final int object_log = 2295;
final int object_net = 2285;
final int object_net2 = 2286;
final int object_pipe1 = 43544;
final int object_pipe2 = 43543;
final int object_rope = 1259;
final int object_upbranch = 35970;
public final RSTile pipe1 = new RSTile(2484, 3432);
public final RSTile pipe2 = new RSTile(2487, 3432);
boolean rcrossing = false;
public final RSTile startTile = new RSTile(2474, 3437);
public long startTime = System.currentTimeMillis();
String status = "Starting script.";
int subtask = 0;
int task = 0;
int trips = 0;
public final RSTile ttile = new RSTile(2485, 3427);
public final RSTile ubranch = new RSTile(2473, 3422);
public String getAuthor( ) {
return "ipodnano";
}
public String getName( ) {
return "iGnomeAGility";
}
public String getScriptCategory() {
return "Agility";
}
public double getVersion( ) {
return 1.0;
}
@Override
public int loop( ) {
switch (task) {
case 0:
setCameraAltitude(true);
task = 1;
return(random(100,200));
case 1:
status = "Crossing log.";
setRun(true);
if (distanceTo(clog)<=1) {
crossing = false;
subtask = 0;
task = 2;
loops = 0;
exp = exp + (15 / 2);
}
else if (crossing) {
}
else {
if (myPlayer().isIdle()) {
RSObject log = getNearestObjectByID(object_log);
if (log != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(log.getLocation())) {
atObject(log, "Cross");
wait(random(800, 1200));
loops ++;
}
else if (!tileOnScreen(log.getLocation())) {
turnToTile(log.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 2:
status = "Climbing net.";
int height = getPlane();
if (height == 1) {
exp = exp + (15 / 2);
task = 3;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
RSObject net = getNearestObjectByID(object_net);
if (net != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(net.getLocation())) {
atObject(net, "Climb-over");
wait(random(800, 1200));
loops++;
}
else if (!tileOnScreen(net.getLocation())) {
turnToTile(net.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 3:
status = "Climbing branch.";
int height1 = getPlane();
if (height1 == 2) {
exp = exp + 5;
task = 4;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
Point branch = Calculations.tileToScreen(ubranch, 150);
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(ubranch)) {
moveMouse(branch,3,3);
wait(random(200,600));
loops++;
if(getMenuItems().get(0).toLowerCase().contains("climb")) {
clickMouse(true);
wait(random(800,1200));
}
}
else if (tileOnScreen(ubranch)) {
turnToTile(ubranch);
wait(random(200,400));
}
}
}
return(random(100,200));
case 4:
status = "Crossing rope.";
if (distanceTo(crope)<=1) {
rcrossing = false;
exp = exp + (15 / 2);
task = 5;
loops = 0;
}
else
{
if (!tileOnScreen(new RSTile(2478 , 3420)))
{
turnToTile(new RSTile (2478 , 3420));
wait(random(200,400));
}
else
{
atTile(new RSTile(2478,3420), "Walk-on");
wait(random(2000,4500));
}
return(random(100,200));
}
return(random(100,200));
case 5:
status = "Climbing branch.";
int height11 = getPlane();
if (height11 == 0) {
exp = exp + 5;
task = 6;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
RSObject branch = getNearestObjectByID(object_downbranch + random(1, 2));
if (branch != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(branch.getLocation())) {
atObject(branch, "Climb-down");
wait(random(800, 1200));
loops ++;
}
else if (!tileOnScreen(branch.getLocation())) {
turnToTile(branch.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 6:
status = "Climbing net.";
if (myPlayer().getLocation().getY() > 3426) {
exp = exp + (15 / 2);
task = 7;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
RSObject net = getNearestObjectByID(object_net2);
if (net != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(net.getLocation())) {
atObject(net, "Climb-over");
loops ++;
wait(random(800, 1200));
}
else if (!tileOnScreen(net.getLocation())) {
turnToTile(net.getLocation());
wait(random(200,400));
if (!tileOnScreen(net.getLocation())) {
int x = net.getLocation().getX() + random(0,-2);
int y = net.getLocation().getY() + random(0,-2);
RSTile t = new RSTile (x, y);
walkTileMM(t);
wait(random(800,1200));
}
}
}
}
else if (myPlayer().isMoving()) {
}
}
return(random(100,200));
case 7:
switch (subtask) {
case 0:
if ((myPlayer().getLocation().getY() > 3435) && (myPlayer().getLocation().getX() > 2482)){
exp = exp + (15 / 2);
subtask = 1;
loops = 0;
}
else if ((myPlayer().getLocation().getY() > 3432) && (myPlayer().getLocation().getX() > 2482)){
}
else {
status = "Squeezing.";
if (myPlayer().isIdle()) {
RSObject opipe1 = getObjectAt(pipe1);
RSObject opipe2 = getObjectAt(pipe2);
if (opipe1.getID() == object_pipe1) {
if (loops > 0) {
int x = ttile.getX() + random(-5, 5);
int y = ttile.getY() + random(-5, 5);
RSTile tTile = new RSTile(x, y);
turnToTile(tTile);
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(opipe1.getLocation())) {
int sucessfulsqueezing = 0;
do
{
if (survmess == "Failed" || survmess == "")
{
atObject(opipe1, "Squeeze");
survmess = "";
sucessfulsqueezing = 0;
wait(random(2500,4000));
}
if (survmess == "Sucessful")
{
survmess = "";
sucessfulsqueezing = 1;
wait(random(2000,3000));
}
}
while (sucessfulsqueezing == 0);
sucessfulsqueezing = 0;
wait(random(1000, 1400));
loops ++;
}
else if (!tileOnScreen(opipe1.getLocation())) {
turnToTile(opipe1.getLocation());
wait(random(200,400));
}
}
else if (opipe2.getID() == object_pipe2) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(opipe2.getLocation())) {
atObject(opipe2, "Squeeze");
wait(random(1000, 1400));
loops ++;
}
else if (!tileOnScreen(opipe2.getLocation())) {
turnToTile(opipe2.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 1:
status = "Starting over.";
if (myPlayer().isIdle()) {
if (distanceTo(startTile) > 4) {
RSTile starttile = new RSTile (2474+(random(-2,2)), 3437+(random(-2,2)));
walkTileMM(starttile);
wait(random(800, 1200));
}
else if (distanceTo(startTile) <= 4) {
task = 1;
loops = 0;
trips ++;
exp = exp + 39;
}
}
else if (myPlayer().isMoving()) {
}
return(random(100,200));
}
return(random(100,200));
}
return random(100,150);
}
private boolean atTile3(RSTile rsTile, String string, int i, int j) {
return false;
}
private RSPlayer myPlayer() {
return new RSPlayer(Bot.getClient().getMyRSPlayer());
}
@Override
public void onFinish( ) {
}
@Override
public boolean onStart( Map<String, String> args ) {
return true;
}
public void serverMessageRecieved(ServerMessageEvent e) {
if (e.getMessage().equalsIgnoreCase("You walk carefully across the slippery log..."))
{
crossing = true;
}
if (e.getMessage().equalsIgnoreCase("You carefully cross the tightrope."))
{
rcrossing = true;
}
if(e.getMessage().equalsIgnoreCase("The pipe is being used"))
{
survmess = "Failed";
}
if(e.getMessage().equalsIgnoreCase("You squeeze into the pipe..."))
{
survmess = "Sucessful";
}
}
public void setCameraRotation2(int degrees) {
char left = 37;
char right = 39;
char whichDir = left;
int start = getCameraAngle();
if (start < 180) {
start += 360;
}
if (degrees < 180) {
degrees += 360;
}
if (degrees > start) {
if (degrees - 180 < start) {
whichDir = right;
}
}
else if (start > degrees) {
if (start - 180 >= degrees) {
whichDir = right;
}
}
degrees %= 360;
Bot.getInputManager().pressKey(whichDir);
int timeWaited = 0;
while (getCameraAngle() > degrees + 5 || getCameraAngle() < degrees - 5) {
wait(10);
timeWaited += 10;
if (timeWaited > 500) {
int time = timeWaited - 500;
if (time == 0) {
Bot.getInputManager().pressKey(whichDir);
} else if (time % 40 == 0) {
Bot.getInputManager().pressKey(whichDir);
}
}
}
Bot.getInputManager().releaseKey(whichDir);
}
@Override
public void turnToTile(RSTile tile) {
int angle = getAngleToCoordinates(tile.getX(), tile.getY());
angle = angle + random(-20, 20);
if (angle < 0) {
angle = 360 + angle;
}
if (angle >= 360) {
angle -= 360;
}
setCameraRotation2(angle);
}
}
import java.awt.Graphics;
import java.awt.Point;
import java.util.Map;
import org.rsbot.bot.Bot;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.Calculations;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(authors = { "iPodnano" }, category = "Agility", name = "iGnomeAgility", version = 1.0, description = ("<html><head>"+
"</head><body>"
+ "<center><strong><h2>" + "iGnomeAgility" + " v" + 1.0 + "</h2></strong></center>"
+ "Start Script at the Log"
+ "</body></html>"))
public class iGnomeAgility extends Script implements ServerMessageListener {
public final RSTile clog = new RSTile(2474, 3428);
public final RSTile crlog = new RSTile(2474, 3433);
public final RSTile crope = new RSTile(2484, 3420);
boolean crossing = false;
int exp = 0;
int loops = 0;
String survmess = "";
public final RSTile net = new RSTile(2486, 3425);
final int object_downbranch = 2313;
final int object_log = 2295;
final int object_net = 2285;
final int object_net2 = 2286;
final int object_pipe1 = 43544;
final int object_pipe2 = 43543;
final int object_rope = 1259;
final int object_upbranch = 35970;
public final RSTile pipe1 = new RSTile(2484, 3432);
public final RSTile pipe2 = new RSTile(2487, 3432);
boolean rcrossing = false;
public final RSTile startTile = new RSTile(2474, 3437);
public long startTime = System.currentTimeMillis();
String status = "Starting script.";
int subtask = 0;
int task = 0;
int trips = 0;
public final RSTile ttile = new RSTile(2485, 3427);
public final RSTile ubranch = new RSTile(2473, 3422);
public String getAuthor( ) {
return "ipodnano";
}
public String getName( ) {
return "iGnomeAGility";
}
public String getScriptCategory() {
return "Agility";
}
public double getVersion( ) {
return 1.0;
}
@Override
public int loop( ) {
switch (task) {
case 0:
setCameraAltitude(true);
task = 1;
return(random(100,200));
case 1:
status = "Crossing log.";
setRun(true);
if (distanceTo(clog)<=1) {
crossing = false;
subtask = 0;
task = 2;
loops = 0;
exp = exp + (15 / 2);
}
else if (crossing) {
}
else {
if (myPlayer().isIdle()) {
RSObject log = getNearestObjectByID(object_log);
if (log != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(log.getLocation())) {
atObject(log, "Cross");
wait(random(800, 1200));
loops ++;
}
else if (!tileOnScreen(log.getLocation())) {
turnToTile(log.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 2:
status = "Climbing net.";
int height = getPlane();
if (height == 1) {
exp = exp + (15 / 2);
task = 3;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
RSObject net = getNearestObjectByID(object_net);
if (net != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(net.getLocation())) {
atObject(net, "Climb-over");
wait(random(800, 1200));
loops++;
}
else if (!tileOnScreen(net.getLocation())) {
turnToTile(net.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 3:
status = "Climbing branch.";
int height1 = getPlane();
if (height1 == 2) {
exp = exp + 5;
task = 4;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
Point branch = Calculations.tileToScreen(ubranch, 150);
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(ubranch)) {
moveMouse(branch,3,3);
wait(random(200,600));
loops++;
if(getMenuItems().get(0).toLowerCase().contains("climb")) {
clickMouse(true);
wait(random(800,1200));
}
}
else if (tileOnScreen(ubranch)) {
turnToTile(ubranch);
wait(random(200,400));
}
}
}
return(random(100,200));
case 4:
status = "Crossing rope.";
if (distanceTo(crope)<=1) {
rcrossing = false;
exp = exp + (15 / 2);
task = 5;
loops = 0;
}
else
{
if (!tileOnScreen(new RSTile(2478 , 3420)))
{
turnToTile(new RSTile (2478 , 3420));
wait(random(200,400));
}
else
{
atTile(new RSTile(2478,3420), "Walk-on");
wait(random(2000,4500));
}
return(random(100,200));
}
return(random(100,200));
case 5:
status = "Climbing branch.";
int height11 = getPlane();
if (height11 == 0) {
exp = exp + 5;
task = 6;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
RSObject branch = getNearestObjectByID(object_downbranch + random(1, 2));
if (branch != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(branch.getLocation())) {
atObject(branch, "Climb-down");
wait(random(800, 1200));
loops ++;
}
else if (!tileOnScreen(branch.getLocation())) {
turnToTile(branch.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 6:
status = "Climbing net.";
if (myPlayer().getLocation().getY() > 3426) {
exp = exp + (15 / 2);
task = 7;
loops = 0;
}
else {
if (myPlayer().isIdle()) {
RSObject net = getNearestObjectByID(object_net2);
if (net != null) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(net.getLocation())) {
atObject(net, "Climb-over");
loops ++;
wait(random(800, 1200));
}
else if (!tileOnScreen(net.getLocation())) {
turnToTile(net.getLocation());
wait(random(200,400));
if (!tileOnScreen(net.getLocation())) {
int x = net.getLocation().getX() + random(0,-2);
int y = net.getLocation().getY() + random(0,-2);
RSTile t = new RSTile (x, y);
walkTileMM(t);
wait(random(800,1200));
}
}
}
}
else if (myPlayer().isMoving()) {
}
}
return(random(100,200));
case 7:
switch (subtask) {
case 0:
if ((myPlayer().getLocation().getY() > 3435) && (myPlayer().getLocation().getX() > 2482)){
exp = exp + (15 / 2);
subtask = 1;
loops = 0;
}
else if ((myPlayer().getLocation().getY() > 3432) && (myPlayer().getLocation().getX() > 2482)){
}
else {
status = "Squeezing.";
if (myPlayer().isIdle()) {
RSObject opipe1 = getObjectAt(pipe1);
RSObject opipe2 = getObjectAt(pipe2);
if (opipe1.getID() == object_pipe1) {
if (loops > 0) {
int x = ttile.getX() + random(-5, 5);
int y = ttile.getY() + random(-5, 5);
RSTile tTile = new RSTile(x, y);
turnToTile(tTile);
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(opipe1.getLocation())) {
int sucessfulsqueezing = 0;
do
{
if (survmess == "Failed" || survmess == "")
{
atObject(opipe1, "Squeeze");
survmess = "";
sucessfulsqueezing = 0;
wait(random(2500,4000));
}
if (survmess == "Sucessful")
{
survmess = "";
sucessfulsqueezing = 1;
wait(random(2000,3000));
}
}
while (sucessfulsqueezing == 0);
sucessfulsqueezing = 0;
wait(random(1000, 1400));
loops ++;
}
else if (!tileOnScreen(opipe1.getLocation())) {
turnToTile(opipe1.getLocation());
wait(random(200,400));
}
}
else if (opipe2.getID() == object_pipe2) {
if (loops > 1) {
setCameraRotation(random(1, 300));
wait(random(200, 400));
loops = 0;
}
else if (tileOnScreen(opipe2.getLocation())) {
atObject(opipe2, "Squeeze");
wait(random(1000, 1400));
loops ++;
}
else if (!tileOnScreen(opipe2.getLocation())) {
turnToTile(opipe2.getLocation());
wait(random(200,400));
}
}
}
}
return(random(100,200));
case 1:
status = "Starting over.";
if (myPlayer().isIdle()) {
if (distanceTo(startTile) > 4) {
RSTile starttile = new RSTile (2474+(random(-2,2)), 3437+(random(-2,2)));
walkTileMM(starttile);
wait(random(800, 1200));
}
else if (distanceTo(startTile) <= 4) {
task = 1;
loops = 0;
trips ++;
exp = exp + 39;
}
}
else if (myPlayer().isMoving()) {
}
return(random(100,200));
}
return(random(100,200));
}
return random(100,150);
}
private boolean atTile3(RSTile rsTile, String string, int i, int j) {
return false;
}
private RSPlayer myPlayer() {
return new RSPlayer(Bot.getClient().getMyRSPlayer());
}
@Override
public void onFinish( ) {
}
@Override
public boolean onStart( Map<String, String> args ) {
return true;
}
public void serverMessageRecieved(ServerMessageEvent e) {
if (e.getMessage().equalsIgnoreCase("You walk carefully across the slippery log..."))
{
crossing = true;
}
if (e.getMessage().equalsIgnoreCase("You carefully cross the tightrope."))
{
rcrossing = true;
}
if(e.getMessage().equalsIgnoreCase("The pipe is being used"))
{
survmess = "Failed";
}
if(e.getMessage().equalsIgnoreCase("You squeeze into the pipe..."))
{
survmess = "Sucessful";
}
}
public void setCameraRotation2(int degrees) {
char left = 37;
char right = 39;
char whichDir = left;
int start = getCameraAngle();
if (start < 180) {
start += 360;
}
if (degrees < 180) {
degrees += 360;
}
if (degrees > start) {
if (degrees - 180 < start) {
whichDir = right;
}
}
else if (start > degrees) {
if (start - 180 >= degrees) {
whichDir = right;
}
}
degrees %= 360;
Bot.getInputManager().pressKey(whichDir);
int timeWaited = 0;
while (getCameraAngle() > degrees + 5 || getCameraAngle() < degrees - 5) {
wait(10);
timeWaited += 10;
if (timeWaited > 500) {
int time = timeWaited - 500;
if (time == 0) {
Bot.getInputManager().pressKey(whichDir);
} else if (time % 40 == 0) {
Bot.getInputManager().pressKey(whichDir);
}
}
}
Bot.getInputManager().releaseKey(whichDir);
}
@Override
public void turnToTile(RSTile tile) {
int angle = getAngleToCoordinates(tile.getX(), tile.getY());
angle = angle + random(-20, 20);
if (angle < 0) {
angle = 360 + angle;
}
if (angle >= 360) {
angle -= 360;
}
setCameraRotation2(angle);
}
}