Jump to content

Acerd's Gnome Agility


Acerd

Recommended Posts

couldnt find one so i made one.

 

was going to upload to sdn but ill do it when its open again. (for free ofc)

 

link: http://uppit.com/a2vw6blsa74j

 
 
how to add script:
put the .jar file in: C:\Users\YOURNAME\OSBot\Scripts , then press "Refresh" on the script selector. (in the client)
 
source:

package gnomeagility;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Point;
import java.util.function.BooleanSupplier;

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.event.InteractionEvent;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

@ScriptManifest(author = "Acerd", info = "", logo = "", name = "Acerd's Gnome Agility", version = 1.0)
public class AcerdGnomeAgility extends Script {
	private final Area start = new Area(2477, 3436, 2471, 3438);
	private final Area action1 = new Area(2476, 3426, 2470, 3429);
	private final Area action1ObjArea = new Area(2476, 3425, 2471, 3425);
	private final Area action2 = new Area(new Position(2476, 3422, 1), new Position(2471, 3424, 1));
	private final Area action3 = new Area(new Position(2477, 3419, 2), new Position(2472, 3420, 2));
	private final Area action4 = new Area(new Position(2488, 3419, 2), new Position(2483, 3420, 2));
	private final Area action5 = new Area(2483, 3425, 2488, 3419);
	private final Area action5ObjArea = new Area(2483, 3426, 2488, 3426);
	private final Area action6 = new Area(2483, 3431, 2488, 3427);
	private final Area end = new Area(2488, 3436, 2483, 3438);
	private final Position endWalk = new Position(2474, 3436, 0);
	private RS2Object obstacle;
	private long hours;
	private long minutes;
	private long seconds;
	private long millis;
	private long timeStart;
	private boolean started;
	private String state;

	@[member=Override]
	public void onStart() throws InterruptedException {
		super.onStart();
		state = "Starting";
                timeStart = System.currentTimeMillis();
		started = true;
		getExperienceTracker().start(Skill.AGILITY);
	}

	@[member=Override]
	public int onLoop() throws InterruptedException {
		if (started) {
			if (!myPlayer().isMoving()) {
				if (mustContinue()) {
					state = "Pressing continue";
					pressContinue();
				} else if (playerContains(start)) {
					obstacle = getObjects().closest("Log balance");
					state = "Walking across log balance..";
					if (obstacle != null)
						if (interact(obstacle, "Walk-across")) {
							sleepTill(playerContains(action1), 4000);
						}
				} else if (playerContains(action1)) {
					state = "Climbing over obstacle net..";
					obstacle = getObjects().closest(action1ObjArea, "Obstacle net");
					if (obstacle != null)
						if (interact(obstacle, "Climb-over")) {
							sleepTill(playerContains(action2), 4000);
						}
				} else if (playerContains(action2)) {
					state = "Climbing tree branch..";
					obstacle = getObjects().closest("Tree branch");
					if (obstacle != null)
						if (interact(obstacle, "Climb")) {
							sleepTill(playerContains(action3), 4000);
						}
				} else if (playerContains(action3)) {
					state = "Walking on balancing rope..";
					obstacle = getObjects().closest("Balancing rope");
					if (obstacle != null)
						if (interact(obstacle, "Walk-on")) {
							sleepTill(playerContains(action4), 4000);
						}
				} else if (playerContains(action4)) {
					state = "Climbing down tree branch..";
					obstacle = getObjects().closest("Tree branch");
					if (obstacle != null)
						if (interact(obstacle, "Climb-down")) {
							sleepTill(playerContains(action5), 4000);
						}
				} else if (playerContains(action5)) {
					if (getCamera().getPitchAngle() != getCamera().getLowestPitchAngle()) {
						state = "Fixing camera pitch..";
						getCamera().movePitch(getCamera().getLowestPitchAngle());
					} else {
						obstacle = getObjects().closest(action5ObjArea, "Obstacle net");
						state = "Climbing over obstacle net..";
						if (obstacle != null)
							if (interact(obstacle, "Climb-over")) {
								sleepTill(playerContains(action6), 4000);
							}
					}
				} else if (playerContains(action6)) {
					state = "Squeezing through obstacle pipe..";
					obstacle = getObjects().closest("Obstacle pipe");
					if (obstacle != null)
						if (interact(obstacle, "Squeeze-through")) {
							sleepTill(playerContains(end), 5000);
						}
				} else if (playerContains(end)) {
					state = "Walking back to start..";
					getWalking().walk(endWalk);
				}
			}
		}
		return random(250, 350);
	}

	@[member=Override]
	public void onPaint(Graphics2D g) {
		super.onPaint(g);
		if (started) {
			Point mP = getMouse().getPosition();

			g.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5);
			g.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5);
			this.millis = System.currentTimeMillis() - this.timeStart;
			this.hours = this.millis / 3600000L;
			this.millis -= this.hours * 3600000L;
			this.minutes = this.millis / 60000L;
			this.millis -= this.minutes * 60000L;
			this.seconds = this.millis / 1000L;
			Font font = new Font("Arial", Font.BOLD, 12);
			g.setFont(font);
			g.setColor(Color.WHITE);
			g.drawString("RUNTIME: " + this.hours + ":" + this.minutes + ":" + this.seconds, 15, 250);
			g.drawString("XP GAINED: " + getExperienceTracker().getGainedXP(Skill.AGILITY), 15, 265);
			g.drawString("XP/HR: " + getExperienceTracker().getGainedXPPerHour(Skill.AGILITY), 15, 280);
			g.drawString("STATE: " + state, 15, 310);
		}
	}

	private boolean interact(RS2Object obj, String action) {
		InteractionEvent ie = new InteractionEvent(obj);
		ie.setAction(action);
		ie.setWalkTo(true);
		ie.setOperateCamera(true);
		execute(ie);
		return ie.hasFinished();
	}

	private boolean playerContains(Area area) {
		return area.contains(myPlayer());
	}

	private boolean mustContinue() {
		return getDialogues().isPendingContinuation();
	}

	private void pressContinue() throws InterruptedException {
		if (getDialogues().clickContinue()) {
			sleepTill(!mustContinue(), 700);
		}
	}

	private void sleepTill(boolean condition, int timeout) {
		new CSleep(() -> condition, timeout).sleep();
	}

	private final class CSleep extends ConditionalSleep {

		private final BooleanSupplier condition;

		public CSleep(final BooleanSupplier condition, int timeout) {
			super(timeout);
			this.condition = condition;
		}

		@[member=Override]
		public boolean condition() throws InterruptedException {
			return condition.getAsBoolean();
		}
	}
}

 

enjoy priks

 

Edited by Acerd
  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...