Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Very bad Agility script (just started scripting) MEMES


    Nex

    Recommended Posts

    Ya so its pretty terrible but HEY! it works..?

     

    I made this when i just started scripting java & dreambot so dont take this to seriously... ( over a year ago)

    mabey someone will get some use out of it so dumpin it here

     

    Anyway have fun & dont forget to add zAntiban() :kappa:  : 

     

     

     

    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.Point;
    import java.io.IOException;
    import java.net.URL;
    
    import javax.imageio.ImageIO;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.MethodContext;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.skills.Skill;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.utilities.Timer;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.items.GroundItem;
    
    @ScriptManifest(author = "Nex", name = "Nex Agility", version = 1.0, description = "", category = Category.AGILITY)
    public class main extends AbstractScript {
    	private long timeStarted = System.currentTimeMillis();
    	private int mogGain = 0;
    	private String status = "Starting";
    	private final Image bg = getImage("http://i.imgur.com/MwlOO1U.png");
    	
    	/**
    	 * Created by Nex
    	 * 
    	 */
    	
    	// Gnome
    	private final Area agnome = new Area(2468, 3440, 2490, 3414);
    	private final Area agnome1 = new Area(2468, 3440, 2490, 3414, 1);
    	private final Area agnome2 = new Area(2468, 3440, 2490, 3414, 2);
    	Area gnomeStart = new Area(2477, 3436, 2471, 3438);
    	Area gnome2 = new Area(2470, 3429, 2477, 3425);
    	Area tree1 = new Area(2476, 3422, 2471, 3424, 1);
    	Area tree2 = new Area(2488, 3421, 2483, 3418, 2);
    	Area rope1 = new Area(2477,3421,2472,3418,2);
    	Area net2 = new Area(2489, 3418, 2481, 3425);
    	Area gnome4 = new Area(2489, 3427, 2481, 3430);
    	Area gnome5 = new Area(2488, 3436, 2483, 3438);
    	Tile ropeTile = new Tile(2477, 3420, 2);
    	
    	// Draynor
    	private final Area draynor = new Area(3105, 3251, 3082, 3281);
    	private final Area draynor1 = new Area(3105, 3251, 3082, 3281, 1);
    	private final Area draynor2 = new Area(3105, 3251, 3082, 3281, 2);
    	private final Area draynor3 = new Area(3105, 3251, 3082, 3281, 3);
    	Area draynorStart = new Area(3103, 3280, 3103, 3278);
    	Area drope1 = new Area(3102, 3277, 3097, 3281, 3);
    	Area drope2 = new Area(3086, 3272, 3093, 3278, 3);
    	Area dwall1 = new Area(3089, 3268, 3095, 3265, 3);
    	Area djump1 = new Area(3088, 3261, 3088, 3256, 3);
    	Area djump2 = new Area(3087, 3255, 3094, 3255, 3);
    	Area dcrate1 = new Area(3096, 3256, 3101, 3261, 3);
    	Area dend = new Area(3102, 3257, 3105, 3263);
    	Tile jumpTile = new Tile(3088, 3257, 3);
    	Tile jump2Tile = new Tile(3101,3261, 3);
    	Tile camTile = new Tile(3103, 3279, 0);
    	Tile dropeTile = new Tile(3098, 3277, 3);
    	// Al Kharid
    	
    	// Varrock
    	
    	// Canifis
    	
    	// Falador
    	
    	// Seer's Village
    	
    	// Pollniveach
    	
    	// Rellekka
    	
    	// Ardougne
    	
    	@Override
    	public void onStart() {
    		getSkillTracker().start(Skill.AGILITY);
    	}
    	
    
    	private enum State {
    		WALKING,GNOME,DRAYNOR,MOG
    	};
    	
    	private State getState() {
    		if (getNearbyMOG() != null) {
    			return State.MOG;
    		}
    		if (agnome.contains(getLocalPlayer()) || agnome1.contains(getLocalPlayer()) || agnome2.contains(getLocalPlayer())) {
        		return State.GNOME;
        	}
    		if (draynor.contains(getLocalPlayer()) || draynor1.contains(getLocalPlayer()) || draynor2.contains(getLocalPlayer()) || draynor3.contains(getLocalPlayer())) {
        		return State.DRAYNOR;
        	}
    		return State.WALKING; 
    	}
    	    	
    	@Override
    	public int onLoop() {
    		switch(getState()) {
    		case MOG:
    			GroundItem mog = getNearbyMOG();
    			status = "Looting MOG..";
            	Tile tile = getNearbyMOG().getTile();
            	if (getMap().canReach(tile) && !getMap().isTileOnScreen(tile)) {
            		status = "Walking to loot..";
            		getWalking().walk(tile);
            	}
            	if (getMap().canReach(tile) && getMap().isTileOnScreen(tile)) {
            		if (getMouse().move(tile)) {
            			if (getClient().getMenu().getDefaultAction().contains("Take" + getNearbyMOG().getName())) {
            				if (!getMouse().click()) {
            				}
            			} else {
            				status = "Menu Looting..";
            				if (getClient().getMenu().open()) {
            					mog.interact("Take");
            				}
            			}
            		}
            	}
            	sleep(1050,1300);
            	sleepUntil(() -> !getLocalPlayer().isMoving(), 2500);
    			status = "Getting MOG";
    			int mogCount = getInventory().count("Mark of Grace");
                sleepUntil(() -> getInventory().count("Mark of Grace") > mogCount, 3000);
    			if (getInventory().count("Mark of Grace") > mogCount) {
    				mogGain++;
                }
                break;               
    		case WALKING:
    			status = "Walking";
    			if (!agnome.contains(getLocalPlayer())) {
    				if (getWalking().shouldWalk())
    				getWalking().walk(gnomeStart.getRandomTile());
    			}
    			break;
    		case GNOME:
    			GameObject log = getGameObjects().closest("Log balance");
    			GameObject netu = getGameObjects().closest("Obstacle net");
    			GameObject treeu = getGameObjects().closest("Tree branch");
    			GameObject rope = getGameObjects().closest("Balancing rope");
    			GameObject treed = getGameObjects().closest("Tree branch");		
    			GameObject neto = getGameObjects().closest("Obstacle net");
    			GameObject pipe = getGameObjects().closest("Obstacle pipe");
    			
    			if (gnomeStart.contains(getLocalPlayer())) {
    				status = "Crossing log";
    				if (log != null)
    					log.interact("Walk-across");
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (gnome2.contains(getLocalPlayer())) {
    				status = "Climbing net";
    				if (netu != null)
    					netu.interact("Climb-over");
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (tree1.contains(getLocalPlayer())) {
    				status = "Climing tree";
    				if (treeu != null)
    					treeu.interact("Climb");
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (rope1.contains(getLocalPlayer())) {
    				status = "Crossing rope";
    				if (rope != null)
    					getCamera().rotateToEntity(rope);
    					rope.interactForceRight("Walk-on");
    					sleep(500,750);
    					getWalking().walk(ropeTile);
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (tree2.contains(getLocalPlayer())) {
    				status = "Going down tree";
    				if (treed != null)
    					treed.interact("Climb-down");
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (net2.contains(getLocalPlayer())) {
    				status = "Going over net";
    				if (neto != null)
    					neto.interact("Climb-over");
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (gnome4.contains(getLocalPlayer())) {
    				status = "Going in pipe";
    				if (pipe != null)
    					getCamera().rotateToEntity(pipe);
    					pipe.interact("Squeeze-through");
    					sleepUntil(() -> getLocalPlayer().isStandingStill(), 3500);
    			}
    			else if (gnome5.contains(getLocalPlayer())) {
    				status = "Back to start";
    				if (getWalking().shouldWalk())
    					getWalking().walk(gnomeStart.getRandomTile());
    					return Calculations.random(10, 500);
    			}			
    			break;
    			
    		case DRAYNOR:
    			GameObject odwall = getGameObjects().closest("Rough wall"); // Climb
    			GameObject odrope = getGameObjects().closest("Tightrope"); // Cross
    			GameObject odrope2 = getGameObjects().closest("Tightrope"); // Cross
    			GameObject odwall2 = getGameObjects().closest("Narrow wall"); // Balance
    			GameObject odwall3 = getGameObjects().closest("Wall");		// Jump-up
    			GameObject odgap = getGameObjects().closest("Gap"); // Jump
    			GameObject odcrate = getGameObjects().closest("Crate"); // Climb-down
    						
    			if (draynorStart.contains(getLocalPlayer())) {
    				status = "Climbing building";
    				if (odwall != null) {
    					if (!odwall.isOnScreen()) {
    						getCamera().rotateToEntity(odwall);
    					} else {
    						if(odwall.interactForceRight("Climb")) {
    							sleepUntil(() -> getLocalPlayer().isStandingStill(), 4000);
    						}
    					}
    				}
    			}
    			else if (draynor.contains(getLocalPlayer())) {
    				status = "Back to start";
    				if (getWalking().shouldWalk()) {
    					getWalking().walk(draynorStart.getCenter());
    				}
    			}
    			else if (drope1.contains(getLocalPlayer())) {
    				status = "Crossing rope";
    				if (odrope != null) {
    					odrope.interact("Cross");
    					sleep(4500,4750);
    					sleepUntil(() -> getLocalPlayer().isMoving(), 4500);
    					sleepWhile(() -> getLocalPlayer().isMoving(), 2000);
    					sleepUntil(() -> drope2.contains(getLocalPlayer()), 2000);
    				}
    			}
    			else if (drope2.contains(getLocalPlayer())) {
    				status = "Crossing 2nd rope";
    				if (odrope2 != null) {
    					odrope2.interact("Cross");
    					sleep(2500,2600);
    					sleepUntil(() -> getLocalPlayer().isMoving(), 4500);
    					sleepWhile(() -> getLocalPlayer().isMoving(), 2000);
    					sleepUntil(() -> dwall1.contains(getLocalPlayer()), 2000);
    				}
    			}
    			else if (dwall1.contains(getLocalPlayer())) {
    				status = "Balancing wall";
    				if (odwall2 != null) {
    					odwall2.interactForceLeft("Balance");
    					sleep(2500,2600);
    					sleepUntil(() -> getLocalPlayer().isMoving(), 4500);
    					sleepWhile(() -> getLocalPlayer().isMoving(), 2000);
    					sleepUntil(() -> djump1.contains(getLocalPlayer()), 2000);
    				}
    			}
    			else if (djump1.contains(getLocalPlayer())) {
    				status = "Jumping building";
                	Tile odwall3T = new Tile(3088, 3256, 3);
                	if (!getMap().isTileOnScreen(odwall3T)) {
                		getWalking().walk(odwall3);
                		getCamera().rotateToEntity(odwall3);
                	}
                	if (getMap().isTileOnScreen(odwall3T)) {
                		if (getMouse().move(odwall3T)) {
                			if (getClient().getMenu().getDefaultAction().contains("Jump-up")) {
                				if (getMouse().click(odwall3)) {
                					sleepUntil(() -> djump2.contains(getLocalPlayer()), 2500);
                				}
                			} else {
                				if (getClient().getMenu().open()) {
                					odwall3.interact("Jump-on");
                					sleepUntil(() -> djump2.contains(getLocalPlayer()), 2500);
                				}
                			}
                		}
                	}
                	sleep(1050,1300);
                	sleepUntil(() -> !getLocalPlayer().isMoving(), 2500);
    			}            
    			else if (djump2.contains(getLocalPlayer())) {
    				status = "Jumping down";
    				if (odgap != null) {
    					odgap.interact("Jump");
    					sleep(1250,1500);
    					sleepUntil(() -> getLocalPlayer().isMoving(), 4500);
    					sleepWhile(() -> getLocalPlayer().isMoving(), 2000);
    					sleepUntil(() -> dcrate1.contains(getLocalPlayer()), 2000);
    				}
    			}
    			else if (dcrate1.contains(getLocalPlayer())) {
    				status = "Climbing Down";
                	Tile dcrate1T = new Tile(3102, 3261, 3);
                	if (!getMap().isTileOnScreen(dcrate1T)) {
                		getCamera().rotateToTile(dcrate1T);
                		getWalking().walk(dcrate1T);
                	}
                	if (getMap().isTileOnScreen(dcrate1T)) {
                		if (getMouse().move(dcrate1T)) {
                			if (getClient().getMenu().getDefaultAction().contains("Climb-down")) {
                				if (!getMouse().click()) {
                					sleepUntil(() -> dend.contains(getLocalPlayer()), 2500);
                				}
                			} else {
                				if (getClient().getMenu().open()) {
                					odcrate.interact("Climb-down");
                					sleepUntil(() -> dend.contains(getLocalPlayer()), 2500);
                				}
                			}
                		}
                	}
                	sleep(1050,1300);
                	sleepUntil(() -> !getLocalPlayer().isMoving(), 2500);
    			}     
    			else if (dend.contains(getLocalPlayer())) {
    				status = "Back to start";
    				if (getWalking().shouldWalk()) {
    					getWalking().walk(draynorStart.getRandomTile());
    					return Calculations.random(10, 500);
    				}
    			}			
    			break;
    		}
    		return Calculations.random(400, 800);
    	}
    	
    	@Override
    	public void onPaint(Graphics g) {
    		super.onPaint(g);
    		g.setColor(Color.BLACK);
    		
    		long timeElapsed = System.currentTimeMillis() - timeStarted;
    		g.drawImage(bg, 1, 338, null);
    		g.drawString("Time ran: " + Timer.formatTime(timeElapsed), 100, 398);
    		g.drawString("Status: " + status, 248, 398);
    		g.drawString("Mark of Grace: " + mogGain, 100, 415);
    		g.drawString("Mark of Grace P/h: " + (int)(mogGain*3_600_000.0/timeElapsed), 248, 415);
    		g.drawString("EXP gained: " + getSkillTracker().getGainedExperience(Skill.AGILITY), 100, 432);
    		g.drawString("EXP per hour: " + getSkillTracker().getGainedExperiencePerHour(Skill.AGILITY), 248, 432 );
    		g.drawString("Agility level: " + getSkills().getRealLevel(Skill.AGILITY) + " (+" + 
    									getSkillTracker().getGainedLevels(Skill.AGILITY) + ")", 100, 449);
    		g.drawString("Time to level: " + Timer.formatTime(getSkillTracker().getTimeToLevel(Skill.AGILITY)), 248, 449);
    		
    		 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);
    	    }
    	private Image getImage(String url)
    {
      try
      {
        return ImageIO.read(new URL(url));
      }
      catch (IOException e) {}
      return null;
    }
    	private GroundItem getNearbyMOG() { 
            return getGroundItems().closest(i -> i != null && i.exists() && i.getName().contains("grace") && i.getZ() == getLocalPlayer().getZ() && i.distance(getLocalPlayer()) < 5);
        }
    } 

     

     

    Link to comment
    Share on other sites

    fren can be done better :(

    this was from over a year ago now.. just found a old usb so thought id just drop it here xD

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.