Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as JavaScript by DivYews.java ( 16 years ago )
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.util.Map;

import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Constants;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSInterface;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;


@ScriptManifest(authors = "Diverse", category = "Woodcutting", name = "DivYews", version = 1.0, description = "Script by Diverse, start at G.E Yews.")
public class DivYews extends Script implements PaintListener{

    public RSObject tree;
    RSTile[] bankToTrees = {new RSTile(3167,3489), new RSTile(3181,3490), new RSTile(3196,3496), new RSTile(3210,3501)};
    RSTile[] treesToBank = {new RSTile(3210,3501), new RSTile(3196,3492), new RSTile(3180,3489), new RSTile(3167,3489)};
    public int logID = 1515;
    public int hatchetID [] = {6739,1359, 1357, 1361, 1351, 1349, 1355, 1353};
    RSObject yewTree;
    RSTile bankTile = new RSTile(3167,3489);
    RSTile wcAreaTile = new RSTile(3210,3501);
    RSNPC banker;
    int yew = 1309;
    int axe = 1359;
    public long startTime = System.currentTimeMillis();
    public int startexp;
    public int yewPrice = 513;
    public int exp;
    public int Tree = 1309;
    public int expGained;
    public int levelsGained;
    public int energyToRunAt = random(20, 100);
    public int bankerID = 6533;
    private String status = "";
    
        public boolean onStart( Map<String,String> args ) {
               setCompass('w'); 
                       return true;
        }
    public void serverMessageRecieved(ServerMessageEvent e) {
        if(e.getMessage().contains("You've just advanced a Woodcutting level!")) {
        levelsGained++;
        }
    }
    private boolean openBank() {
        RSNPC banker = getNearestNPCByID(6533);
        if (banker != null) {
        if (tileOnScreen(banker.getLocation())) {
            wait(random(50,100));
            turnToTile(banker.getLocation(), 15);
            atNPC(banker, "Bank Banker");
        }
    }
    return false;
        }
    public int Chop() {
    if(getMyPlayer().getAnimation() == -1) {
        RSObject Tree = getNearestObjectByID(1309);
        if (Tree != null){
                    if(distanceTo(Tree.getLocation()) <= 3){
            turnToTile(Tree.getLocation());
            wait(random(200, 340));
        }
        
        if (distanceTo(Tree.getLocation()) >= 4) {
             turnToTile(Tree.getLocation());
             wait(random(150,240 ));
         }

        if (distanceTo(Tree.getLocation()) > random(5,6)) {
            walkTileMM(Tree.getLocation());
            wait(random(150,240));
        }
            if(tileOnScreen(Tree.getLocation())) {
         setCompass('w');           
           atObject(Tree, "Chop down Yew");
           wait(random(300,500));
            }
    }
        }
            return 500;
}
    public boolean walkToBank(){
        if (distanceTo(bankTile) > 8) {
        if (distanceTo(getDestination()) < random(5, 12)
                || distanceTo(getDestination()) > 100) {
        if (!walkPathMM(treesToBank)) {
                walkToClosestTile(treesToBank);
        }
}
        }
  return true;
    
    }
    public boolean walkToTrees(){
        if (distanceTo(wcAreaTile) > 20) {
        if (distanceTo(getDestination()) < random(5, 12)
                || distanceTo(getDestination()) > 40) {
        if (!walkPathMM(bankToTrees)) {
                walkToClosestTile(bankToTrees);
        }
}
        }
return true;
    }
    private int antiBan(){
        final int random = random(1,20);
        switch (random) {
        case 1:
        
        if(random(1, 45) == 3){
            moveMouseRandomly(300);
            
            
        }
        return random(100, 500);
        
        case 2:
        if(random(1, 50) == 19){
            

        }
        return random(100, 500);
        case 3:
        if(random(1, 35) == 4){
            openTab(Constants.TAB_STATS);
            moveMouse(random(665, 395), random(709, 412));
        }
        return random(100, 500);
        
        case 4:
        if(random(1, 23) == 8){
            moveMouseRandomly(600);
        }
        return random(100, 500);
        case 5:
        if(random(1, 29) == 6){
        }
        return random(100, 500);
        }
        return 800;
        
    }
public int loop() {
    if(getEnergy() >= energyToRunAt){
        setRun(true);
    }
    if(getMyPlayer().getAnimation() != -1){
    status = "Cutting...";
    }
    if(isInventoryFull()){
    antiBan();
    status = "Walking to bank..";
        walkToBank();
        if (RSInterface.getInterface(Constants.INTERFACE_BANK).isValid()) {
            bank.depositAllExcept(hatchetID);
        } else {
            openBank();
        }
    }else{
        walkToTrees();
        Chop();
        
    }
    return random(100,150);
}
public void onRepaint(Graphics g) {
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     if (isLoggedIn()) {
         
         if ( startexp == 0) {
            startexp = skills.getCurrentSkillExp(Constants.STAT_WOODCUTTING);
       }
            
       expGained = skills.getCurrentSkillExp(Constants.STAT_WOODCUTTING) - startexp;

         
         
         long millis = System.currentTimeMillis() - startTime;
        long hours = millis / (1000 * 60 * 60);
        millis -= hours * (1000 * 60 * 60);
        long minutes = millis / (1000 * 60);
        millis -= minutes * (1000 * 60);
        long seconds = millis / 1000;
        g.setColor(new Color(0, 0, 0, 140));
        g.fillRect(549, 207, 186, 256);
        g.setColor(new Color(47, 47, 89, 200));
        g.setColor(Color.ORANGE);
        g.setFont(new Font("arial", Font.PLAIN, 15));
        g.drawString("DivYews", 565, 237);
        g.setFont(new Font("tahoma", Font.PLAIN, 13));
        g.drawString("Script by Diverse" , 578, 253);
        g.drawString("Gained : " + levelsGained+" Level(s)" , 580, 272);
        g.setFont(new Font("tahoma", Font.PLAIN, 13));
        g.drawString("Time running:"+hours+":"+minutes+":"+seconds+"." , 566, 309);
        g.drawString("EXP Gained:"+expGained , 566, 349);
        g.drawString("Logs Cut: "+ expGained / 175  + " Yew log" , 569, 443);
        g.drawString("Status:"+ status , 566, 410);
        g.setFont(new Font("tahoma", Font.PLAIN, 13));
        g.setColor(Color.RED);  
        g.fill3DRect(566, 386, 150, 11, true); 
        g.setColor(Color.RED); 
        g.fill3DRect(566, 386, skills.getPercentToNextLevel(Constants.STAT_WOODCUTTING), 11, true);  
         g.setColor(Color.WHITE); 
        g.drawString(skills.getPercentToNextLevel(Constants.STAT_WOODCUTTING) + "%  to " + (skills.getCurrentSkillLevel(Constants.STAT_WOODCUTTING) + 1), 586, 396);        
    }
}
}

 

Revise this Paste

Parent: 17342
Your Name: Code Language: