Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Runescape
You last visited: Today at 07:48

  • Please register to post and access all features, it's quick, easy and FREE!

 

rs Bot Script Fehler

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2010
Posts: 153
Received Thanks: 0
rs Bot Script Fehler

Hallo

ich hab mir den Script WWoodcutter geholt(der ist nicht von mir):
Code:
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

import javax.swing.ButtonGroup;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;

import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSGroundItem;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSModel;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;


@ScriptManifest( name = "WWoodcutter" , authors = { "wormhole95" } , keywords =  "Woodcutting" , version = 0.71, description = "An unstoppable woodcutter!")

public class WWoodcutter extends Script implements PaintListener, MessageListener {	
	
	public WWoodcutterGUI gui;
	public String location;
	public String logType;
	
	//ID's
	private final static int[] hatchetID = { 1351, 1349, 1353, 1361, 1355, 1357, 1359, 6739 };
	private static int[] treeID;
	private static int logID;
	private static int stumpID;
	private static int bankID;
	private static final int[] normalTreeID = { 1276, 1278 };
	private static final int[] oakTreeID = { 1281 };
	private static final int[] willowTreeID = { 5551, 5552, 5553 };
	private static final int[] yewTreeID = { 1309 };
	private static final int[] mapleTreeID = { 1307 };
	private static final int[] magicTreeID = { 1306 };
	
	//Boolean's
	private boolean guiWait = true;
	private boolean guiExit = false;
	private boolean banking = false;
	private boolean powercut = false;
	private boolean antiban = false;
	
	//Paint
    private final RenderingHints antialiasing = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    private final Color color1 = new Color(34, 149, 30);
    private final Color color2 = new Color(0, 0, 0);
    private final Color color3 = new Color(34, 149, 30, 100);
    private final Color color4 = new Color(170, 254, 161);
    private final BasicStroke stroke1 = new BasicStroke(1);
    private final Font font1 = new Font("Verdana", 1, 13);
    private final Font font2 = new Font("Verdana", 1, 11);
    @SuppressWarnings("unused")
	private int startLevel;
    private int startEXP;
    private int logsCut;
    public long startTime = System.currentTimeMillis();
    private double version = 0.71;
    private long timeToLevel;
    private int logPrice = 0;
	
	//Paths
	private RSTile[] pathToBank;	
	private RSTile[] pathToTrees;
    private RSTile bankTile;
    private RSTile yewTile;
    private RSTile yewTile2;
    
    //Other
	private static int runPercentage = 0;
	private int mouseHopx;
	private int mouseHopy;
    private boolean noWalk = false;
	
	//Areas
	private RSArea atBank;
	private RSArea atTrees;
	private RSArea outsideBank;
	private RSArea atDraynorBank = new RSArea(new RSTile(3092, 3246), new RSTile (3096, 3240)),
	atDraynorWillows = new RSArea(new RSTile(3091, 3241), new RSTile (3080, 3224)),
	atDraynorYews = new RSArea(new RSTile(3058, 3277), new RSTile(3048, 3266)),
	outsideDraynorBank = new RSArea(new RSTile(3089, 3249), new RSTile (3098, 3246)),
	atGE = new RSArea(new RSTile(3171, 3494), new RSTile(3159, 3484)),
	atGEYews = new RSArea(new RSTile(3199, 3499), new RSTile(3227, 3507)),
	atGEYew3 = new RSArea(new RSTile(3218, 3500), new RSTile (3226, 3506)),
	atSeersBank = new RSArea(new RSTile(2721, 3494), new RSTile(2730, 3490)),
	atSeersMaples = new RSArea(new RSTile(2717, 3497), new RSTile(2734, 3607)),
	atSeersYews = new RSArea(new RSTile(2717, 3468), new RSTile(2701, 3456)),
	atSeersMagics = new RSArea(new RSTile(2699, 3403), new RSTile(2707, 3395)),
	atEdgeBank = new RSArea(new RSTile(3090, 3500), new RSTile(3099, 3487)),
	atEdgeYews = new RSArea(new RSTile(3092, 3467), new RSTile(3084, 3483)),
	atDraynorOaksAndNormals = new RSArea(new RSTile(3121, 3234), new RSTile(3109, 3251));
	
	private void highlightTile(Graphics g, RSTile t, Color outline, Color fill) {
        Point pn = calc.tileToScreen(t, 0, 0, 0);
        Point px = calc.tileToScreen(t, 1, 0, 0);
        Point py = calc.tileToScreen(t, 0, 1, 0);
        Point pxy = calc.tileToScreen(t, 1, 1, 0);
        if (py.x == -1 || pxy.x == -1 || px.x == -1 || pn.x == -1) {
                return;
        }
        g.setColor(outline);
        g.drawPolygon(new int[]{py.x, pxy.x, px.x, pn.x},
                        new int[]{py.y, pxy.y, px.y, pn.y}, 4);
        g.setColor(fill);
        g.fillPolygon(new int[]{py.x, pxy.x, px.x, pn.x},
                        new int[]{py.y, pxy.y, px.y, pn.y}, 4);
}
	
    private double getVersion() {
        return 0.71;
    }
	
	private void changeMouseSpeed() {
		if (random(1, 8) == 1) {
			mouse.setSpeed(random(4, 5));
		}
	}

	private void doAntiBan() {
		if (antiban) {
			switch(random(0, 70)) {
				
				case 1:
					camera.setAngle(random(0, 90));
					sleep(500,1000);
					if (random(1, 3) == 1) {
						mouseHopx = random(0,760);
						mouseHopy = random(0, 500);
						mouse.hop(mouseHopx, mouseHopy);
					}
				break;
				
				case 2:
					camera.setAngle(random(90, 180));
					sleep(500,1000);
					if (random(1, 3) == 1) {
						mouseHopx = random(0,760);
						mouseHopy = random(0, 500);
						mouse.hop(mouseHopx, mouseHopy);
					}
				break;
				
				case 3:
					mouse.moveSlightly();
					camera.setAngle(random(90, 180));
					if (random(1, 3) == 1) {
						mouseHopx = random(0,760);
						mouseHopy = random(0, 500);
						mouse.hop(mouseHopx, mouseHopy);
					}
				break;
				
				case 4:
					if (random(1, 3) == 1) {
						mouseHopx = random(0,760);
						mouseHopy = random(0, 500);
						mouse.hop(mouseHopx, mouseHopy);
					} else {
						if (random(1, 3) == 1) {
							mouseHopx = random(0,760);
							mouseHopy = random(0, 500);
							mouse.hop(mouseHopx, mouseHopy);
						}
					}
				break;
				
				case 5:
					camera.setAngle(random(180, 360));
					sleep(500,1000);
					if (random(1, 3) == 1) {
						mouseHopx = random(0,760);
						mouseHopy = random(0, 500);
						mouse.hop(mouseHopx, mouseHopy);
					}
				break;
				
			}
		}
	}

	private enum State {
		CHOP, WALKTOBANK, WALKTOTREES, BANK, SLEEP, DROP
	}
		

	private State getState() {		
		if (getMyPlayer().getAnimation() != -1 && getMyPlayer().isIdle()) {
			return State.SLEEP;
		}
		if(banking) {
			//Bank
			if(atBank.contains(getMyPlayer().getLocation())){		
				if (inventory.isFull()) {
					return State.BANK;
				}		
			}				
			//WalkToBank
			if(inventory.isFull()) {
				if (atTrees.contains(getMyPlayer().getLocation()) | !atBank.contains(getMyPlayer().getLocation()) | outsideBank.contains(getMyPlayer().getLocation())) {
					return State.WALKTOBANK;
				}
			}	
			//WalkToTrees
			if(!inventory.isFull()) {
				if (atBank.contains(getMyPlayer().getLocation()) | !atTrees.contains(getMyPlayer().getLocation())) {
					return State.WALKTOTREES;
				}
			}
		}
		//Chop
		if(!inventory.isFull() && getMyPlayer().getAnimation() == -1){			
			RSObject tree = objects.getNearest(treeID);
			if (tree != null) {
				if (calc.distanceTo(tree) <= 50) {				
					if (atTrees.contains(getMyPlayer().getLocation())) {
						return State.CHOP;		
					}
				}
			}
		}
		//Drop
		if(powercut) {
			if(inventory.isFull()) {
				return State.DROP;
			}
		}
		//Sleep
		return State.SLEEP;
	}
	
	
	public boolean onStart() {
        URLConnection url = null;
        BufferedReader in = null;
        BufferedWriter out = null;
        //Ask the user if they'd like to check for an update...
        if(JOptionPane.showConfirmDialog(null, "Would you like to check for updates?\nPlease Note this requires an internet connection and the script will write files to your harddrive!") == 0){ //If they would, continue
            try{
                //Open the version text file
                url = new URL("http://wormhole95.webs.com/WWoodcutter/WWoodcutterVERSION.txt").openConnection();
                //Create an input stream for it
                in = new BufferedReader(new InputStreamReader(url.getInputStream()));
                //Check if the current version is outdated
                if(Double.parseDouble(in.readLine()) > getVersion()) {
                    //If it is, check if the user would like to update.
                    if(JOptionPane.showConfirmDialog(null, "Update found. Do you want to update?") == 0){
                        //If so, allow the user to choose the file to be updated.
                           JOptionPane.showMessageDialog(null, "Please choose 'ScriptName.java' in your scripts folder and hit 'Open'");
                           JFileChooser fc = new JFileChooser();
                           //Make sure "Open" was clicked.
                           if(fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
                               //If so, set up the URL for the .java file and set up the IO.
                               url = new URL("http://wormhole95.webs.com/WWoodcutter/WWoodcutter.java").openConnection();
                            in = new BufferedReader(new InputStreamReader(url.getInputStream()));
                            out = new BufferedWriter(new FileWriter(fc.getSelectedFile().getPath()));
                            String inp;
                            /* Until we reach the end of the file, write the next line in the file
                             * and add a new line. Then flush the buffer to ensure we lose
                             * no data in the process.
                             */
                            while((inp = in.readLine()) != null){
                                out.write(inp);
                                out.newLine();
                                out.flush();
                            }
                            //Notify the user that the script has been updated, and a recompile and reload is needed.
                               log("Script successfully downloaded. Please recompile and reload your scripts!");
                            return false;
                           } else log("Update canceled");
                    } else log("Update canceled");
                } else
                    JOptionPane.showMessageDialog(null, "You have the latest version. :)"); //User has the latest version. Tell them!
                if(in != null)
                    in.close();
                if(out != null)
                    out.close();
            } catch (IOException e){
                log("Problem getting version :/");
                return false; //Return false if there was a problem
            }
        }
		startLevel = skills.getCurrentLevel(Skills.getIndex("woodcutting"));
		startEXP = skills.getCurrentExp(Skills.getIndex("woodcutting"));
		mouse.setSpeed(random(4, 5));
	    gui = new WWoodcutterGUI();
	    gui.setVisible(false);
	    while(guiWait) {
	        sleep(100);
	      }
    	if (gui.checkBox1.isSelected()) {
    		antiban = true;
    	}
	    if (gui.radioButton1.isSelected()) {
	    	banking = true;
	    	powercut = false;
	    } else if (gui.radioButton2.isSelected()) {
	    	banking = false;
	    	powercut = true;
	    }
	    
	    //Check location begins
	    if (location.contains("Draynor") && logType.contains("Willows")){
	    	log("Cutting Willows at Draynor");
	    	pathToBank = new RSTile[] { new RSTile(3094, 3243) };
	    	pathToTrees =  new RSTile[] { new RSTile(3086, 3234) };
	    	logID = 1519;
	    	treeID = willowTreeID;
	    	atBank = atDraynorBank;
	    	atTrees = atDraynorWillows;
	    	outsideBank = outsideDraynorBank;
	    	bankID = 2213;
	    }
	    if (location.contains("Draynor") && logType.contains("Yews")) {
	    	log("Cutting Yews at Draynor");
	    	pathToBank = new RSTile[] { new RSTile(3065, 3277), new RSTile(3073, 3265), new RSTile(3078, 3253), new RSTile(3084, 3248), new RSTile(3094, 3243) };
	    	pathToTrees = new RSTile[] { new RSTile(3081, 3249), new RSTile(3071, 3260), new RSTile(3059, 3268), new RSTile(3055, 3273) };
	    	logID = 1515;
	    	treeID = yewTreeID;
	    	atBank = atDraynorBank;
	    	atTrees = atDraynorYews;
	    	outsideBank = outsideDraynorBank;
	    	stumpID = 7402;
	    	bankID = 2213;
	    }
	    if (location.contains("Grand Exchange") && logType.contains("Yews")) {
	    	log("Cutting Yews at Grand Exchange");
	    	pathToBank = new RSTile[] { new RSTile(3200, 3502),
	    	new RSTile(3197, 3499), new RSTile(3196, 3493),
	    	new RSTile(3192, 3489), new RSTile(3186, 3488),
	    	new RSTile(3181, 3489), new RSTile(3176, 3488),
	    	new RSTile(3172, 3488), new RSTile(3169, 3489) };
	    	pathToTrees = new RSTile[] { new RSTile(3170, 3489),
	    	new RSTile(3174, 3488), new RSTile(3178, 3488),
	    	new RSTile(3182, 3489), new RSTile(3185, 3488), new RSTile(3188, 3488),
	    	new RSTile(3192, 3488), new RSTile(3195, 3490), new RSTile(3196, 3492),
	    	new RSTile(3196, 3496), new RSTile(3197, 3499), new RSTile(3199, 3501),
	    	new RSTile(3201, 3503), new RSTile(3206, 3502) };
	    	logID = 1515;
	    	treeID = yewTreeID;
	    	atBank = atGE;
	    	atTrees = atGEYews;
	    	outsideBank = atGE;
	    	stumpID = 7402;
	    	bankID = 6533;
	    }
	    if (location.contains("Seers Village") && logType.contains("Maples")) {
	    	log("Cutting Maples at Seers Village");
	    	pathToBank = new RSTile[] { new RSTile(2725, 3491) };
	    	pathToTrees = new RSTile[] { new RSTile(2726, 3501) };
	    	logID = 1517;
	    	treeID = mapleTreeID;
	    	atBank = atSeersBank;
	    	atTrees = atSeersMaples;
	    	outsideBank = atSeersBank;
	    	stumpID = 7400;
	    	bankID = 25808;
	    }
	    if (location.contains("Seers Village") && logType.contains("Yews")) {
	    	log("Cutting Yews at Seers Village");
	    	pathToBank = new RSTile[] { new RSTile(2721, 3464),
	    	new RSTile(2721, 3469), new RSTile(2722, 3474),
	      	new RSTile(2725, 3479), new RSTile(2725, 3485),
	   	   	new RSTile(2725, 3491) };
	    	pathToTrees = new RSTile[] { new RSTile(2725, 3487),
	    	new RSTile(2724, 3482), new RSTile(2724, 3478),
	    	new RSTile(2723, 3474), new RSTile(2722, 3470),
	    	new RSTile(2720, 3467), new RSTile(2720, 3464),
	    	new RSTile(2716, 3463), new RSTile(2713, 3462) };
	    	logID = 1515;
	    	treeID = yewTreeID;
	    	atBank = atSeersBank;
	    	atTrees = atSeersYews;
	    	outsideBank = atSeersBank;
	    	stumpID = 7402;
	    	bankID = 25808;
	    }
	    if (location.contains("Seers Village") && logType.contains("Magics")) {
	    	log("Cutting Magics at Seers Village");
	    	pathToBank = new RSTile[] { new RSTile(2702, 3394),
	    	new RSTile(2705, 3392), new RSTile(2708, 3392),
	    	new RSTile(2711, 3393), new RSTile(2714, 3394),
	    	new RSTile(2715, 3397), new RSTile(2716, 3399),
	    	new RSTile(2716, 3401), new RSTile(2717, 3404),
	    	new RSTile(2718, 3407), new RSTile(2719, 3409),
	    	new RSTile(2719, 3412), new RSTile(2720, 3415),
	    	new RSTile(2722, 3417), new RSTile(2722, 3419),
	    	new RSTile(2722, 3422), new RSTile(2723, 3425),
	    	new RSTile(2723, 3428), new RSTile(2723, 3431),
	    	new RSTile(2723, 3433), new RSTile(2724, 3435),
	    	new RSTile(2724, 3437), new RSTile(2723, 3440),
	    	new RSTile(2721, 3442), new RSTile(2721, 3444),
	    	new RSTile(2721, 3447), new RSTile(2721, 3449),
	    	new RSTile(2721, 3451), new RSTile(2721, 3454),
	    	new RSTile(2722, 3456), new RSTile(2721, 3459),
	    	new RSTile(2722, 3462), new RSTile(2723, 3465),
	    	new RSTile(2723, 3468), new RSTile(2722, 3470),
	    	new RSTile(2722, 3473), new RSTile(2724, 3475),
	    	new RSTile(2725, 3478), new RSTile(2726, 3481),
	    	new RSTile(2726, 3485), new RSTile(2725, 3489),
	    	new RSTile(2724, 3492) };
	    	pathToTrees = new RSTile[] { new RSTile(2725, 3489),
	    	new RSTile(2725, 3486), new RSTile(2724, 3482),
	    	new RSTile(2725, 3479), new RSTile(2724, 3476),
	    	new RSTile(2723, 3473), new RSTile(2722, 3470),
	    	new RSTile(2723, 3467), new RSTile(2723, 3464),
	    	new RSTile(2723, 3461), new RSTile(2722, 3458),
	    	new RSTile(2723, 3456), new RSTile(2723, 3453),
	    	new RSTile(2721, 3450), new RSTile(2721, 3447),
	    	new RSTile(2721, 3444), new RSTile(2721, 3442),
	    	new RSTile(2723, 3438), new RSTile(2724, 3435),
	    	new RSTile(2722, 3433), new RSTile(2722, 3430),
	    	new RSTile(2723, 3427), new RSTile(2723, 3424),
	    	new RSTile(2722, 3421), new RSTile(2722, 3418),
	    	new RSTile(2722, 3415), new RSTile(2720, 3413),
	    	new RSTile(2720, 3410), new RSTile(2720, 3407),
	    	new RSTile(2720, 3404), new RSTile(2719, 3402),
	    	new RSTile(2716, 3399), new RSTile(2715, 3396),
	    	new RSTile(2714, 3393), new RSTile(2710, 3393),
	    	new RSTile(2707, 3391), new RSTile(2703, 3392),
	    	new RSTile(2701, 3394), new RSTile(2702, 3398) };
	    	logID = 1513;
	    	treeID = magicTreeID;
	    	atBank = atSeersBank;
	    	atTrees = atSeersMagics;
	    	outsideBank = atSeersBank;
	    	stumpID = 7401;
	    	bankID = 25808;
	    }
	    if(location.contains("Edgeville") && logType.contains("Yews")) {
	    	pathToBank = new RSTile[] { new RSTile(3094, 3479),
	    	new RSTile(3093, 3484), new RSTile(3090, 3486),
	    	new RSTile(3089, 3489), new RSTile(3093, 3491) };
	    	pathToTrees = new RSTile[] { new RSTile(3089, 3490),
	    	new RSTile(3089, 3487), new RSTile(3092, 3485),
	    	new RSTile(3093, 3482), new RSTile(3094, 3479),
	    	new RSTile(3093, 3476), new RSTile(3094, 3473),
	    	new RSTile(3093, 3470), new RSTile(3089, 3470),
	    	new RSTile(3087, 3473) };
	    	logID = 1515;
	    	treeID = yewTreeID;
	    	atBank = atEdgeBank;
	    	atTrees = atEdgeYews;
	    	outsideBank = atEdgeBank;
	    	stumpID = 7402;
	    	yewTile = new RSTile(3087, 3478);
	    	yewTile2 = new RSTile(3087, 3417);
	    	noWalk = true;
	    	bankID = 26972;
	    }
        log("Loading Log Prices....");
        if (logType.contains("Normal")) {
        	logPrice = grandExchange.loadItemInfo(1511).getMarketPrice();
        } else if (logType.contains("Oaks")) {
        	logPrice = grandExchange.loadItemInfo(1521).getMarketPrice();
		} else if (logType.contains("Willows")) {
        	logPrice = grandExchange.loadItemInfo(1519).getMarketPrice();
        } else if (logType.contains("Maples")) {
        	logPrice = grandExchange.loadItemInfo(1517).getMarketPrice();
        } else if (logType.contains("Yews")) {
        	logPrice = grandExchange.loadItemInfo(1515).getMarketPrice();
        } else if (logType.contains("Magics")) {
        	logPrice = grandExchange.loadItemInfo(1513).getMarketPrice();
        }
    log("Price of log: " + logPrice + "gp");
	    return guiExit;
	}
	
	public void onFinish() {
		env.saveScreenshot(true);
		log("Always remember to post your proggies in the thread!!");
	}
	
	
	public int loop() {	
		if (!game.isLoggedIn()) {
			return random(600, 900);
		}	
		
		switch (getState()) {
						
		case BANK:
			log("bank");
			if (bank.isOpen()) {				
				RSItem logs = inventory.getItem(logID);
				logs.doAction("All");
				bank.depositAllExcept(hatchetID);
				bank.close();
				doAntiBan();
			} else {
				if (bankID == 6533) {
					RSNPC banker = npcs.getNearest(bankID);
					RSModel temp = banker.getModel();
					Point p = temp.getPoint();
					mouse.move(p);
					mouse.click(false);
					sleep(200, 300);
					menu.doAction("Use-quickly");
					sleep(1100, 1300);
					if (!bank.isOpen()) {
						sleep(500, 600);
						mouse.move(p);
						mouse.click(false);
						sleep(200, 300);
						menu.doAction("Use-quickly");
						sleep(500, 600);
					}
				} else {
					RSObject object = objects.getNearest(bankID);
					RSModel temp = object.getModel();
					Point p = temp.getPoint();
					mouse.move(p);
					mouse.click(false);
					sleep(200, 300);
					menu.doAction("Use-quickly");
					sleep(1100, 1300);
					if (!bank.isOpen()) {
						sleep(500, 600);
						mouse.move(p);
						mouse.click(false);
						sleep(200, 300);
						menu.doAction("Use-quickly");
						sleep(500, 600);
					}
				}
			}
		break;
		
		case CHOP:
			RSObject tree = objects.getNearest(treeID);
			RSObject stump = objects.getNearest(stumpID);
			if (atTrees.contains(tree.getLocation())) {
				if (tree.isOnScreen()) {
					RSModel nearestTree = tree.getModel();
					Point pointOnTree = nearestTree.getPoint();
					mouse.move(pointOnTree);
					mouse.click(true);
					sleep(random(3000,4000));
					doAntiBan();
				}
				else if (!tree.isOnScreen() && noWalk == false) {
					if (random(0, 2) == 0) {
						changeMouseSpeed();
						walking.walkTileMM(tree.getLocation());
						sleep(random(2000,2500));
						doAntiBan();
					} else {
						changeMouseSpeed();
						walking.walkTileOnScreen(tree.getLocation());
						sleep(random(300,500));
						doAntiBan();
					}
					doAntiBan();
				} else if (!tree.isOnScreen() && noWalk == true) {
					if (stump.getLocation() == new RSTile(3086, 3481)) {
						if (random(0, 2) == 0) {
							changeMouseSpeed();
							walking.walkTileMM(yewTile2);
							sleep(random(2000,2500));
							doAntiBan();
						} else {
							changeMouseSpeed();
							walking.walkTileOnScreen(yewTile2);
							sleep(random(300,500));
							doAntiBan();
						}
					} else if (stump.getLocation() != new RSTile(3086, 3481)) {
						if (random(0, 2) == 0) {
							changeMouseSpeed();
							walking.walkTileMM(yewTile);
							sleep(random(2000,2500));
							doAntiBan();
						} else {
							changeMouseSpeed();
							walking.walkTileOnScreen(yewTile);
							sleep(random(300,500));
							doAntiBan();
						}
					}
				}
			}
		break;
		
		
		
		case WALKTOBANK:
			doAntiBan();
			if (atGEYew3.contains(getMyPlayer().getLocation())) {
				walking.walkTileMM(new RSTile(3208, 3501), 3, 3);
			}
			if (!atBank.contains(getMyPlayer().getLocation())) {
				changeMouseSpeed();
				walking.walkPathMM(pathToBank, 2, 2);
				sleep(random(200, 500));
				doAntiBan();
				runPercentage = random(30, 60);
				if (walking.getEnergy() >= runPercentage) {
					walking.setRun(true);
				} else {
					sleep(1);
				}
			}
		break;
		
		
		
		case WALKTOTREES:
			doAntiBan();
			changeMouseSpeed();
			walking.walkPathMM(pathToTrees, 2, 2);				
			sleep(random(200, 500));
			doAntiBan();
			runPercentage = random(30, 60);
			if (walking.getEnergy() >= runPercentage) {
				walking.setRun(true);		
			}
			break;
		
		
		
		case SLEEP:
			RSGroundItem birdsNest = groundItems.getNearest(5073);
			if (birdsNest != null) {
				if (atTrees.contains(birdsNest.getLocation())) {
					birdsNest.doAction("Take Bird");
				}
			}
			if (random(0, 8) == 0) {
				doAntiBan();	
			}
			RSObject stump1 = objects.getNearest(stumpID);
			if (stump1 != null && !inventory.isFull()) {
				sleep(200,500);
				if (random(0, 5) == 0) {
					doAntiBan();
				}
			} else {
			if (inventory.isFull()) {
				if (!atBank.contains(getMyPlayer().getLocation()) && !outsideBank.contains(getMyPlayer().getLocation()) && !atTrees.contains(getMyPlayer().getLocation())) {
					if (calc.distanceTo(bankTile) > 1) {
						doAntiBan();
						changeMouseSpeed();
						walking.walkPathMM(pathToBank, 2, 2);
						sleep(random(200, 500));
						doAntiBan();
						runPercentage = random(30, 60);
						if (walking.getEnergy() >= runPercentage) {
							walking.setRun(true);
						} else {
							sleep(1);
						}
					}
				}
			} else if (!inventory.isFull()) {
				if (!atBank.contains(getMyPlayer().getLocation()) | !outsideBank.contains(getMyPlayer().getLocation()) && !atTrees.contains(getMyPlayer().getLocation())) {
					if (!atTrees.contains(getMyPlayer().getLocation())) {
						if (random(1, 3) == 1) {
							walking.walkPathMM(pathToTrees, 2, 2);
							doAntiBan();
							sleep(200, 500);
						}
					}
				}
			}
			}
			sleep(random(50, 100));
		break;
		
		
		
		case DROP:
			mouse.setSpeed(random(6, 7));
			inventory.dropAllExcept(hatchetID);
			doAntiBan();
			changeMouseSpeed();
		break;
		}
		
	return random(300, 500);
	}

	
	//GUI
	public class WWoodcutterGUI extends JFrame  {
        public WWoodcutterGUI() {
            initComponents();
        }
        
		private static final long serialVersionUID = 1L;
		private void initComponents() {
			frame1 = new JFrame();
			panel1 = new JPanel();
			checkBox1 = new JCheckBox();
			button1 = new JButton();
			radioButton1 = new JRadioButton();
			radioButton2 = new JRadioButton();
			comboBox1 = new JComboBox();
			comboBox2 = new JComboBox();

		{
				Container frame1ContentPane = frame1.getContentPane();
				frame1ContentPane.setLayout(null);
				frame1.setTitle("WWoodcutter GUI");
	            frame1.setVisible(true);
	            frame1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

				{

					panel1.setLayout(null);

					{
						Dimension preferredSize = new Dimension();
						for(int i = 0; i < panel1.getComponentCount(); i++) {
							Rectangle bounds = panel1.getComponent(i).getBounds();
							preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
							preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
						}
						Insets insets = panel1.getInsets();
						preferredSize.width += insets.right;
						preferredSize.height += insets.bottom;
						panel1.setMinimumSize(preferredSize);
						panel1.setPreferredSize(preferredSize);
					}
				}
				frame1ContentPane.add(panel1);
				panel1.setBounds(new Rectangle(new Point(25, 30), panel1.getPreferredSize()));

				checkBox1.setText("Use Antiban");
				frame1ContentPane.add(checkBox1);
				checkBox1.setSelected(true);
				checkBox1.setBounds(new Rectangle(new Point(5, 5), checkBox1.getPreferredSize()));

				button1.setText("Start Cutting!");
				button1.addActionListener(new ActionListener() {
				      public void actionPerformed(ActionEvent e) {
				        button1ActionPerformed(e);
				      }
				    });
				frame1ContentPane.add(button1);
				button1.setBounds(5, 100, 295, 77);

				radioButton1.setText("Bank");
				frame1ContentPane.add(radioButton1);
				radioButton1.setSelected(true);
				radioButton1.setBounds(new Rectangle(new Point(5, 25), radioButton1.getPreferredSize()));

				radioButton2.setText("Powercut");
				frame1ContentPane.add(radioButton2);
				radioButton2.setBounds(new Rectangle(new Point(65, 25), radioButton2.getPreferredSize()));
				
				comboBox1.setModel(new DefaultComboBoxModel(new String[] {
						"Willows",
						"Maples",
						"Yews",
						"Magics"
					}));
					frame1ContentPane.add(comboBox1);
					comboBox1.setBounds(5, 50, 295, comboBox1.getPreferredSize().height);
					
					comboBox2.setModel(new DefaultComboBoxModel(new String[] {
							"Draynor",
							"South Falador",
							"Edgeville",
							"Grand Exchange",
							"Catherby",
							"Seers Village"
						}));
					frame1ContentPane.add(comboBox2);
					comboBox2.setBounds(5, 75, 295, comboBox2.getPreferredSize().height);

				{
					Dimension preferredSize = new Dimension();
					for(int i = 0; i < frame1ContentPane.getComponentCount(); i++) {
						Rectangle bounds = frame1ContentPane.getComponent(i).getBounds();
						preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
						preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
					}
					Insets insets = frame1ContentPane.getInsets();
					preferredSize.width += insets.right;
					preferredSize.height += insets.bottom;
					frame1ContentPane.setMinimumSize(preferredSize);
					frame1ContentPane.setPreferredSize(preferredSize);
				}
				frame1.pack();
				frame1.setLocationRelativeTo(frame1.getOwner());
			}


			ButtonGroup buttonGroup1 = new ButtonGroup();
			buttonGroup1.add(radioButton1);
			buttonGroup1.add(radioButton2);
		}
		private void button1ActionPerformed(ActionEvent e) {
			logType = comboBox1.getSelectedItem().toString();
			location = comboBox2.getSelectedItem().toString();
			if (!gui.radioButton1.isSelected() && !gui.radioButton2.isSelected()) {
		    	log("Please choose either bank or powercut in the GUI");
			} else if (gui.radioButton1.isSelected() | gui.radioButton2.isSelected()) {
	    		try {
	    			guiWait = false;
	    			guiExit = true;
	    			frame1.setVisible(false);
	    			gui.setVisible(false);
		    		} catch(Exception ex) {
		    			log("You noob");
		    		}
	    		}
			}

		
		private JFrame frame1;
		private JPanel panel1;
		private JCheckBox checkBox1;
		private JButton button1;
		private JRadioButton radioButton1;
		private JRadioButton radioButton2;
		private JComboBox comboBox1;
		private JComboBox comboBox2;

	}

	//Paint
    public void onRepaint(Graphics g1) {
    	
		long runTime = 0;
		long seconds = 0;
		long minutes = 0;
		long hours = 0;
		long sToLevel = 0;
		long mToLevel = 0;
		long hToLevel = 0;
		runTime = System.currentTimeMillis() - startTime;
		seconds = runTime / 1000;
		if (seconds >= 60) {
			minutes = seconds / 60;
			seconds -= (minutes * 60);	
		}
		if (minutes >= 60) {
			hours = minutes / 60;
			minutes -= (hours * 60);
		}
    	
    	int currentXP = skills.getCurrentExp(Skills.getIndex("woodcutting"));
    	int expGained = currentXP - startEXP;
    	int expPerHour = (int) ((expGained) * 3600000.0 / runTime);
    	int expToLevel = skills.getExpToNextLevel(8);
    	timeToLevel = (long) ((double) expToLevel / (double) expPerHour * 3600000);
    	int profit = logPrice * logsCut;
    	long profitPerHour = (int) ((profit) * 3600000.0 / runTime); 
    	int nextLevel = skills.getRealLevel(8) + 1;
    	int percentToLevel = skills.getPercentToNextLevel(8);
    	
		sToLevel = timeToLevel / 1000;
		if (sToLevel >= 60) {
			mToLevel = sToLevel / 60;
			sToLevel -= (mToLevel * 60);	
		}
		if (mToLevel >= 60) {
			hToLevel = mToLevel / 60;
			mToLevel -= (hToLevel * 60);
		}
    	
        Graphics2D g = (Graphics2D)g1;
        g.setRenderingHints(antialiasing);
		g.setColor(Color.GREEN);
		g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
		g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
		Point mousePoint = mouse.getLocation();
		final long mousePressedTime = System.currentTimeMillis() - mouse.getPressTime();
        if (mousePressedTime < 1000) {
        	g.setColor(Color.RED);
        	g.drawOval(mousePoint.x - 4, mousePoint.y - 4, 8, 8);	
        	g.fillOval(mousePoint.x - 4, mousePoint.y - 4, 8, 8);
        }
		if ((!game.isLoggedIn() || !isActive() || isPaused()))
		return;
		
		RSObject tree = objects.getNearest(treeID);
		highlightTile(g1, tree.getLocation(), Color.GREEN, Color.GREEN);
		
        g.setColor(color1);
        g.fillRect(5, 4, 511, 20);
        g.setColor(color2);
        g.setStroke(stroke1);
        g.drawRect(5, 4, 511, 20);
        g.setColor(color3);
        g.fillRoundRect(5, 26, 180, 164, 16, 16);
        g.setColor(color2);
        g.drawRoundRect(5, 26, 180, 164, 16, 16);
        g.setFont(font1);
        g.setColor(color4);
        g.drawString("WWoodcutter: v" + version, 10, 21);
        g.setColor(color2);
        g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 238, 21);
        g.setFont(font1);
        g.setColor(color2);
        g.drawString("Logs Cut: " + logsCut, 11, 43);
        g.drawString("Exp Gained: " + expGained, 11, 63);
        g.drawString("Time To Level: " + hToLevel + ":" + mToLevel + ":" + sToLevel, 11, 83);
        g.drawString("Exp/h: " + expPerHour, 11, 103);
        g.drawString("Profit: " + profit + "gp", 11, 123);
        g.drawString("Profit per hour: " + profitPerHour + "gp", 11, 143);
        g.drawString("Exp to " + nextLevel + ": " + expToLevel , 11, 163);
        g.drawString("% to " + nextLevel + ":", 11, 183);
        g.setColor(Color.RED);
        g.fillRoundRect(80, 173, 100, 13, 10, 10);
        g.setColor(Color.GREEN);
        g.fillRoundRect(80, 173, percentToLevel, 13, 10, 10);
        g.setColor(Color.BLACK);
        g.setFont(font2);
        g.drawString("" + percentToLevel, 125, 183); //this must be on the center of the bar
        g.drawRoundRect(80, 173, 100, 13, 10, 10); //these must be on same cordinates
        g.drawRoundRect(80, 173, percentToLevel, 13, 10, 10); //these must be on same cordinates

    }

	@Override
	public void messageReceived(MessageEvent e) {
        String msg = e.getMessage();
        if (msg.contains("logs.")) {
        	logsCut = logsCut + 1;
        }	
	}    
}

und der funktioniert auch super, aber nach 1-10 min. stürtzt der script ab (vor 2 Tagen ging der noch über eine Stunde)und unten steht:

Uncaught exception fromscript: Java.lang.NullPointerException
at WWoodcutter.loop(WWoodcutter.java:564)
at org.rsbot.script.Script.run(Script.java:286)
at java.lang.Thread.run(Unknown Source)

Wass mach ich falsch oder muss geändert werden?



sirzento is offline  
Old   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 56
Received Thanks: 2
hi kannst du mir vileicht ma helfen


warstar14 is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
fehler im script? pls help
hallo liebe epvper ;D ich hab ein problem mit meinem WoW launcher den ich mir per autoit bastel wenn ich das erste mal den button drücke dann...
9 Replies - AutoIt
fehler im script
Hi ein kumpel hat mir mal seinen script geschickt der bei den browsergame die stämme spieler einladen soll^^. Er hat neuerdings auch einen fehler das...
10 Replies - AutoIt
Script Fehler
<html> <title>Startseite</title> <head> <center> <style type="text/css"> #header { position:absolute; background-img: url (img/box-bottom.png)...
5 Replies - General Coding
Fehler im Script ?
Da ich erst eine kurze Zeit mich mit Autoit beschäftige hätte ich gerne mal Hilfe von ein paar Profis. Habe für Aion einen AutoLoginBot geschrieben,...
0 Replies - AutoIt
Fehler Bei AutoIt Script
Hallo Leutz =) Also ich habe einen script für einen Bot Geschrieben nur tritt jetzt folgender fehler auf. Der zeigt mir beim Ausführen des...
5 Replies - Guild Wars



All times are GMT +2. The time now is 07:48.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.