Whats the best FREE pest control bot?

Discussion in 'RuneScape 3 Cheating' started by phat-master, Mar 6, 2010.

Whats the best FREE pest control bot?
  1. Unread #1 - Mar 6, 2010 at 8:43 PM
  2. phat-master
    Joined:
    Jul 18, 2009
    Posts:
    284
    Referrals:
    1
    Sythe Gold:
    0

    phat-master Forum Addict
    Banned

    Whats the best FREE pest control bot?

    hey guys just wanting to kno what the best way to get a free pest control bot is? i have tryed using a couple of the pest control bots from rsbot.org but they dotn seem to be working too well, so if anyone is using a working pc bot or knows of a good pc bot plz let me kno, cheers.
     
  3. Unread #2 - Mar 6, 2010 at 8:47 PM
  4. tofurocks
    Joined:
    Nov 8, 2008
    Posts:
    2,344
    Referrals:
    2
    Sythe Gold:
    0

    tofurocks Iloveroy

    Whats the best FREE pest control bot?

    RSBot.org is the only site that I know of that offers a working PC bot for free.
    Villavu.com might have one after they update reflection, but I doubt it.
     
  5. Unread #3 - Mar 6, 2010 at 8:54 PM
  6. R33l2r3al
    Joined:
    Jul 7, 2007
    Posts:
    3,443
    Referrals:
    1
    Sythe Gold:
    0

    R33l2r3al Grand Master
    $5 USD Donor Retired Global Moderator

    Whats the best FREE pest control bot?

    Well given that rsbot.org no longer exists it's going to be hard to find a completely free bot to use. That being said, if you don't mind paying some money, you can use RID's Pest Control bot. There is a free 4 hour trial you can do as well, and I will vouch for how good RID's bots are.

    Just go to the website and click the Pest Control Tab. Then register an account and get the free trial. :)

    https://www.robotzindisguise.com/
     
  7. Unread #4 - Mar 6, 2010 at 8:55 PM
  8. phat-master
    Joined:
    Jul 18, 2009
    Posts:
    284
    Referrals:
    1
    Sythe Gold:
    0

    phat-master Forum Addict
    Banned

    Whats the best FREE pest control bot?

    ty might try the trial
     
  9. Unread #5 - Mar 6, 2010 at 9:28 PM
  10. Tigerz
    Joined:
    Dec 24, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Tigerz Member

    Whats the best FREE pest control bot?

    Code:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Map;
    
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.SwingConstants;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    
    import org.rsbot.bot.Bot;
    import org.rsbot.bot.input.Mouse;
    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.RSInterfaceChild;
    import org.rsbot.script.wrappers.RSNPC;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    
    
    
    
    
    @ScriptManifest(authors = { "Zasz" }, category = "Combat", name = "Zasz's Pest Control", version = 1.00, description = "<html><head>"
    	+ "</head><body>"
    	+ "<center><strong><h2>Zasz's Pest Control!</h2></strong></center>"
    	+ "<center></center><br />"
    	+ "<br>"
    	+ " <center><B>Click start for the GUI!.</b>"
    	+ "<strong></strong>" 
    	+ "</center><br>"
    	+ "</body></html>")
    
    public class ZaSzPC extends Script implements PaintListener {
    	public long startTime = System.currentTimeMillis();
    	public long tsa,tsw;
        boolean hasset, buys,buymace,buytop,buybottom,buygloves,buyskills,mappedisland,firstlogin,setangleisland;
        boolean macebuy,topbuy,bottombuy,glovesbuy;
        boolean newround,usespec, logfullz, outdated, walkd, attportals, useqp, defendk, p4match;
        boolean makep =  true;
        public boolean startScript = false;
        private String status = "";
        String wtbs,portalname;
        String tskill, amode,tskilld, skilltobuy, helmtobuy, boattb;
        int dfightm, startlvl,gamesplayed, pcpoints, cons, startEXP, Location,ladderd,boatp,loz;
    	long eph;
    	int lastportalopend,portalid;
        int zealgained = 0;
        int westp,eastp,sep,swp;
        int[] monsters = {3734,3735,3733};
        String[] wtb, ta;
        RSTile knighttile, boattilen, boattiles;
        RSTile rocktile,bottomrighttile,toplefttile,battlefield;
        RSTile bottomrightk,topleftk, bottomrightbb, topleftbb;
        RSTile laddertile;
        RSTile portaltw;
        String cp = "";
        public double version = 1.5;
    	private RSTile[] path,toboat,topoints;
    
        public class gui extends JFrame 
        { 
        	/**
    		 * 
    		 */
    		private static final long serialVersionUID = 1337L;
    		// Variables declaration 
        	private JTabbedPane jTabbedPane1; 
        	private JButton jButton1; 
        	private JPanel contentPane; 
        	//----- 
        	private JLabel jLabel2; 
        	private JLabel jLabel5; 
        	private JLabel jLabel6; 
        	private JPanel jPanel1; 
        	//----- 
        	private JLabel jLabel7; 
        	private JLabel jLabel8; 
        	private JLabel jLabel9; 
        	private JLabel jLabel10; 
        	private JLabel jLabel12; 
        	private JComboBox jComboBox1; 
        	private JComboBox jComboBox2; 
        	private JComboBox jComboBox3;
        	private JComboBox jComboBox4;
        	private JComboBox jComboBox5; // Boat
        	private JCheckBox jCheckBox3;  
        	private JCheckBox jCheckBox4; 
         	private JCheckBox jCheckBox5; 
         	private JCheckBox jCheckBox6;// Att portal 
         	private JCheckBox jCheckBox7; // Use quick Prayer
         	private JCheckBox jCheckBox8; // Defend Knight
        	private JPanel jPanel2; 
        	//----- 
        	private JPanel jPanel3; 
        	//----- 
        	private JPanel jPanel4; 
        	
        	private JRadioButton jRadioButton1; 
         	private JRadioButton jRadioButton2; 
         	private JRadioButton jRadioButton3; 
         	private JRadioButton jRadioButton4; 
         	private JRadioButton jRadioButton5; 
         	private JRadioButton jRadioButton6; 
         	private JRadioButton jRadioButton7; 
         	private JRadioButton jRadioButton8; 
         	private JRadioButton jRadioButton9; 
         	private JRadioButton jRadioButton10; 
         	private JRadioButton jRadioButton11; 
        	// End of variables declaration 
         
         
        	public gui() 
        	{ 
        		super(); 
        		initializeComponent(); 
        		
         
        		this.setVisible(true); 
        	} 
         
        	/** 
        	 * This method is called from within the constructor to initialize the form. 
        	 * WARNING: Do NOT modify this code. The content of this method is always regenerated 
        	 * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
        	 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
        	 * to retrieve your design properly in future, before revising this method. 
        	 */ 
        	private void initializeComponent() 
        	{ 
        		jTabbedPane1 = new JTabbedPane(); 
        		jButton1 = new JButton(); 
        		contentPane = (JPanel)this.getContentPane(); 
        		//----- 
        		jLabel2 = new JLabel(); 
        		jLabel5 = new JLabel(); 
        		jLabel6 = new JLabel(); 
        		jPanel1 = new JPanel(); 
        		jCheckBox3 = new JCheckBox(); 
        		//----- 
        		jLabel7 = new JLabel(); 
        		jLabel8 = new JLabel(); 
        		jLabel9 = new JLabel();
        		jLabel10 = new JLabel();
        		jLabel12 = new JLabel();
        		jComboBox1 = new JComboBox(); 
        		jComboBox2 = new JComboBox(); 
        		jComboBox3 = new JComboBox(); 
        		jComboBox4 = new JComboBox();
        		jComboBox5 = new JComboBox();
        		jPanel2 = new JPanel();
        		jCheckBox4 = new JCheckBox(); 
         		jCheckBox5 = new JCheckBox(); 
         		jCheckBox6 = new JCheckBox();
         		jCheckBox7 = new JCheckBox();
         		jCheckBox8 = new JCheckBox();
        		jRadioButton1 = new JRadioButton(); 
         		jRadioButton2 = new JRadioButton(); 
         		jRadioButton3 = new JRadioButton();
         		jRadioButton4 = new JRadioButton(); 
        		jRadioButton5 = new JRadioButton();
        		jRadioButton6 = new JRadioButton();
        		jRadioButton7 = new JRadioButton();
        		jRadioButton8 = new JRadioButton();
        		jRadioButton9 = new JRadioButton();
        		jRadioButton10 = new JRadioButton();
        		jRadioButton11 = new JRadioButton();
        		//----- 
        		jPanel3 = new JPanel(); 
        		//----- 
        		jPanel4 = new JPanel();
        		// 
        		// jTabbedPane1 
        		// 
        		jTabbedPane1.addTab("Description", jPanel1); 
        		jTabbedPane1.addTab("Combat Options", jPanel2); 
        		jTabbedPane1.addTab("Island Options", jPanel4); 
        		jTabbedPane1.addTab("Zeal Options", jPanel3); 
        		jTabbedPane1.addChangeListener(new ChangeListener() { 
        			public void stateChanged(ChangeEvent e) 
        			{ 
        				jTabbedPane1_stateChanged(e); 
        			} 
         
        		}); 
        		// 
        		// jButton1 
        		// 
        		jButton1.setText("Start Script!"); 
        		jButton1.addActionListener(new ActionListener() { 
        			public void actionPerformed(ActionEvent e) 
        			{ 
        				jButton1_actionPerformed(e); 
        			} 
         
        		}); 
        		// 
        		// contentPane 
        		// 
        		contentPane.setLayout(null); 
        		addComponent(contentPane, jTabbedPane1, 0,0,373,221); 
        		addComponent(contentPane, jButton1, 124,240,106,28); 
        		// 
        		// jLabel2 
        		// 
        		jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); 
        		jLabel2.setHorizontalTextPosition(SwingConstants.LEADING); 
        		jLabel2.setText("ZaSz\'s Pest Control: By ZaSz"); 
        		// 
        		// jLabel5 
        		// 
        		jLabel5.setText("Start this script either at Pest Control bank. Or near the landers!"); 
        		// 
        		// jLabel6 
        		// 
        		jLabel6.setText("Make sure to fill out all the options! Or this script won\'t work for you!"); 
        		// 
        		// jPanel1 
        		// 
        		jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel1.add(jLabel2, 0); 
        		jPanel1.add(jLabel5, 1); 
        		jPanel1.add(jLabel6, 2); 
        		jPanel1.setOpaque(true); 
        		// 
        		// jLabel7 
        		// 
        		jLabel7.setText("Combat Style"); 
        		// 
         		// jLabel8 
         		// 
         		jLabel8.setText("Attack style "); 
         		// 
         		// jLabel9 
         		// 
         		jLabel9.setText("Skill to buy");
         		// 
         		// jLabel10 
         		// 
         		jLabel10.setText("Boat to use:    ");
         		// 
         		// jCheckBox3 
         		// 
         		jCheckBox3.setText("Use special Attacks when applicable? (Range/Melee only)"); 
         		// jCheckBox4 
         		// 
         		jCheckBox4.setText("logout at full zeal (Can't buy anything else if you pick)"); 
         		// 
         		// jCheckBox5 
         		// 
         		jCheckBox5.setText("Use Zeal to buy skills.    ");
         		// 
         		// jCheckBox6 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox7
         		// 
         		jCheckBox7.setText("Use Quick Prayer.       "); 
         		// 
         		// jCheckBox8
         		// 
         		jCheckBox8.setText("Defend the knight instead of portals.  "); 
         		// 
         		// jRadioButton1 
         		// 
         		//(Use dropdown box to select)
         		jRadioButton1.setText("Buy a helm  (Helms/Void armour not able this version)"); 
         		// 
         		// jRadioButton2 
         		// 
         		jRadioButton2.setText("Buy Void Top"); 
         		// 
         		// jRadioButton3 
         		// 
         		jRadioButton3.setText("Buy Void Bottom"); 
         		// 
         		// jRadioButton4 
         		// 
         		jRadioButton4.setText("Buy Void Gloves"); 
         		// 
         		// jRadioButton5 
         		// 
         		jRadioButton5.setText("Buy Void Mace         "); 
        		// 
        		// jComboBox1 
        		// 
        		jComboBox1.addItem("Melee"); 
        		jComboBox1.addItem("Range"); 
        		jComboBox1.addItem("Mage"); 
        		// 
         		// jComboBox2 
         		// 
         		jComboBox2.addItem("Accurate (Att/Range/Mage)"); 
         		jComboBox2.addItem("Strength/Rapid (Str/Range/Mage)"); 
         		jComboBox2.addItem("Defensive (Def/Def+range/Def+Mage"); 
         		// 
         		// jComboBox3 
         		// 
         		jComboBox3.addItem("Attack"); 
         		jComboBox3.addItem("Strength"); 
         		jComboBox3.addItem("Defence"); 
         		jComboBox3.addItem("Ranged"); 
         		jComboBox3.addItem("Magic"); 
         		jComboBox3.addItem("Hitpoints"); 
         		jComboBox3.addItem("Prayer"); 
         		
         		//
         		// jComboBox4
         		//
         		jComboBox4.addItem("Mage helm");
         		jComboBox4.addItem("Melee helm");
         		jComboBox4.addItem("Range helm");	
         		//
         		// jComboBox5
         		//
         		jComboBox5.addItem("Novice Boat");
         		jComboBox5.addItem("Intermediate Boat");
         		jComboBox5.addItem("Expert Boat");
        		// 
        		// jPanel2 
        		// 
         		jPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel2.add(jLabel7, 0); 
         		jPanel2.add(jComboBox1, 1); 
         		jPanel2.add(jCheckBox7,2);
         		jPanel2.add(jCheckBox3, 3); 
         		jPanel2.add(jLabel8, 4); 
         		jPanel2.add(jComboBox2, 5);
        		// 
        		// jPanel3 
        		// 
        		jPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel3.add(jCheckBox4, 0); 
         		jPanel3.add(jCheckBox5, 1); 
         		//jPanel3.add(jRadioButton1, 2); 
         		jPanel3.add(jRadioButton2, 2); 
         		jPanel3.add(jRadioButton3, 3); 
         		jPanel3.add(jRadioButton4, 4); 
         		jPanel3.add(jRadioButton5, 5); 
         		jPanel3.add(jLabel9, 6); 
         		jPanel3.add(jComboBox3, 7); 
         		//jPanel3.add(jComboBox4,9);
         		
         		/////////////////////////////////////////////////////////////////
         	// 
         		// jLabel1 
         		// 
         		jLabel10.setText("Boat To Use"); 
         		// 
         		// jLabel2 
         		// 
         		jLabel12.setText(" Monsters to Attack:  MUST HAVE SHIFTER IF DEFENDING KNIGHT!!!!          "); 
         		// 
         		// jCheckBox1 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox2 
         		// 
         		jCheckBox8.setText("Defend Knight instead of portals"); 
         		// 
         		// jRadioButton1 "Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter"
         		// 
         		jRadioButton6.setText("  Spinner"); 
         		jRadioButton6.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton7.setText("Shifter"); 
         		jRadioButton7.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton8.setText("Torcher"); 
         		jRadioButton8.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton9.setText("Defiler"); 
         		jRadioButton9.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton10.setText("Brawler");
         		jRadioButton10.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton11.setText("Splatter"); 
         		jRadioButton11.setSelected(true);
         		////////////////////////////////////////////////////////////////////////
         		// 
        		// jPanel4  (ISLAND OPTIONS)
        		// 
         		jPanel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel4.add(jLabel10,0);
         		jPanel4.add(jComboBox5, 1); 
         		jPanel4.add(jCheckBox6, 2); 
         		jPanel4.add(jCheckBox8, 3); 
         		jPanel4.add(jLabel12, 4); 
         		jPanel4.add(jRadioButton6, 5); 
         		jPanel4.add(jRadioButton7, 6); 
         		jPanel4.add(jRadioButton8, 7); 
         		jPanel4.add(jRadioButton9, 8); 
         		jPanel4.add(jRadioButton10, 9); 
         		jPanel4.add(jRadioButton11, 10); 
         		
         		//jPanel4.add(, 4); 
         		//jPanel4.add();
        		// 
        		// gui 
        		// 
        		this.setTitle("Zasz\'s Pest Control!"); 
        		this.setLocation(new Point(168, 107)); 
        		this.setSize(new Dimension(395, 311)); 
        	} 
         
        	/** Add Component Without a Layout Manager (Absolute Positioning) */ 
        	private void addComponent(Container container,Component c,int x,int y,int width,int height) 
        	{ 
        		c.setBounds(x,y,width,height); 
        		container.add(c); 
        	} 
         
        	
        	private void jTabbedPane1_stateChanged(ChangeEvent e) 
        	{ 
        		System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called."); 
      
        	} 
      
        	
        	private void jButton1_actionPerformed(ActionEvent e) 
        	{ 
        		System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); 
         
        		amode = jComboBox2.getSelectedItem().toString(); 
        		tskill = jComboBox1.getSelectedItem().toString();
        		Location = jComboBox1.getSelectedIndex();
        		usespec = jCheckBox3.isSelected();
        		buyskills = jCheckBox5.isSelected();
        		logfullz = jCheckBox4.isSelected();
        		//logfullz = true;
             	//int leng = 0;	
             	//if(jRadioButton6.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton7.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton8.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton9.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton10.isSelected()){
             ///		leng++;
        		//}
        		//if(jRadioButton11.isSelected()){
        		//	leng++;
        		//}
        		ArrayList<String> monsterztoatt = new ArrayList<String>();
    
        		if(jRadioButton6.isSelected()){
        			monsterztoatt.add("Spinner");
        		}
        		if(jRadioButton7.isSelected()){
        			monsterztoatt.add("Shifter");
        		}
        		if(jRadioButton8.isSelected()){
        				monsterztoatt.add("Torcher");
        			}
        		if(jRadioButton9.isSelected()){
        			monsterztoatt.add("Defiler");
        		}
        		if(jRadioButton10.isSelected()){
        			monsterztoatt.add("Brawler");
        		 }
        		if(jRadioButton11.isSelected()){
        			monsterztoatt.add("Splatter");
        		}
        		ta = monsterztoatt.toArray( new String[ monsterztoatt.size() ] );
        		if(!buyskills){
        			logfullz = true;
        		}
        		defendk = jCheckBox8.isSelected();
        		attportals = jCheckBox6.isSelected();
        		useqp = jCheckBox7.isSelected();
        		boattb = jComboBox5.getSelectedItem().toString();
        		if(boattb=="Novice Boat"){
        			ladderd = 14315;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2657, 2640)} ;
        			boattiles = new RSTile (2663, 2638); //SE
        			boattilen = new RSTile (2660, 2643); //NW
        			laddertile = new RSTile (2657,2639);
        			boatp = 2;
        		}
        		if(boattb=="Intermediate Boat"){
        			ladderd = 25631;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2644, 2644)} ;
        			boattiles = new RSTile (2641, 2642); //SE
        			boattilen = new RSTile (2638, 2647); //NW
        			laddertile = new RSTile (2644,2644);
        			boatp = 3;
        		}
        		if(boattb=="Expert Boat"){
        			ladderd = 25632;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2638, 2653)} ;
        			boattiles = new RSTile (2635, 2649); //SE
        			boattilen = new RSTile (2632, 2654); //NW
        			laddertile = new RSTile (2638,2653);
        			boatp = 4;
        		}
        		topoints = reversePath(toboat);
        		if(amode=="Accurate (Att/Range/Mage)"){
        			dfightm = 0;
        			tskilld = "Att";
        		} else
        		
        		if(amode=="Strength/Rapid (Str/Range/Mage)"){
        			dfightm = 1;
        			tskilld = "Str";
        		} else
        		if(amode=="Defensive (Def/Def+range/Def+Mage"){
        			if(!(tskill=="Range") || !(tskill=="Mage")){
        				dfightm = 3;
        			} else
        				dfightm = 2;
        			tskilld = "Def";
        		} else {		
        			tskilld=amode;			
        		}
        		
        		if(buyskills){
        			  skilltobuy = jComboBox3.getSelectedItem().toString();
        			  log("Buying: "+skilltobuy);
        		}
        		;
        		if(jRadioButton1.isSelected()){
        			helmtobuy = jComboBox4.getSelectedItem().toString();
        			//buyhelm = false; //delete when implemented TODO
        			//log("Buying: "+helmtobuy);
        		}
        		if(jRadioButton2.isSelected()){
        			buytop = true;
        			log("Buying: top");
        		}
        		if(jRadioButton3.isSelected()){
        			buybottom = true;
        			log("Buying: bottom");
        		}
        		if(jRadioButton4.isSelected()){
        			buygloves = true;
        			log("Buying: gloves");
        		}
        		if(jRadioButton5.isSelected()){
        			buymace = true;
        			buymace = false; //delete when implemented TODO
        			log("Buying: mace");
        			
        		}
        		
        		
    		
        		
        		
        		
        		
        		
        		
        		
    
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		//if(leng==0){
        		// log("Must select a monster to attack!");	
        		//} else {
        			setVisible(false);
        			startScript = true;
        			//}
        	} 
       
        }
        
        public boolean outsideboat() {
        	return distanceTo(laddertile)<40;
        }
        
        public boolean insideboat() {
        	final RSInterface IFACE = RSInterface.getInterface(407);
        	//if (pcpoints==0){
        	
        		if (IFACE.isValid()) {
        			String interfacet;
        			interfacet = RSInterface.getChildInterface(407,16).getText();
        			int interfacel,source,tempzeal;
        			interfacel = interfacet.length();
        			source = interfacet.indexOf(":");
        			String pointtext;
        			pointtext = interfacet.substring(source+2, interfacel);
        			tempzeal = Integer.parseInt(pointtext);
        			if(!(tempzeal==pcpoints)){
        				pcpoints = tempzeal;
        			}
        		}
        	//}
        	return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),boattiles.getX(),boattiles.getY(), boattilen.getX(), boattilen.getY());
        }
        
        public boolean onisland() {
        	if(!mappedisland){
        		final RSObject rock = getNearestObjectByID(5605);
        		if (rock != null) {
        			//log(""+rock.getLocation().getX()+","+rock.getLocation().getY()+" Distance:"+distanceTo(rock.getLocation()));
        			return distanceTo(rock.getLocation())<10;	
        		} else {
        			return false;
        		}
        	} else {
        		return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),toplefttile.getX(),toplefttile.getY(),bottomrighttile.getX(),bottomrighttile.getY());
        	}
        }
        
        public boolean inArea(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
        
        public String between(String main,String s1, String s2) {
        	  
        	  int length=s1.length();
    
        	  return main.substring(length,main.indexOf(s2,length));
    
        }
        
        public boolean gotzealforround() {
        	final RSInterface IFACE = RSInterface.getInterface(408);
        	if (IFACE.isValid()) {
        		return Integer.parseInt(RSInterface.getChildInterface(408,11).getText())>49;
        	} else
        		return false;
        }
        
        
        public void onFinish() {
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    	}
    
        
        public boolean flags() {
        	if(getMyPlayer().isMoving()){
        		long st = System.currentTimeMillis();
        		RSTile tile = getMyPlayer().getLocation();
        		while(System.currentTimeMillis() - st < 2000){
        			if(!tile.equals(getMyPlayer().getLocation())){
        				st = System.currentTimeMillis();
        	                        tile = getMyPlayer().getLocation();
        			}
        		}
        	} else {
        		return false;
        	}
        	return true;
        }
        
        public int antiban() {
        	final int randomNum = random(1, 18);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(4, 750);
    			final int y = random(4, 500);
    			moveMouse(x, y);
    			return random(1000, 1500);
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return random(500, 750);
    			} else {
    				return random(500, 750);
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return random(750, 1000);
    			}
    			if (getCurrentTab() != Constants.TAB_STATS) {
    				openTab(Constants.TAB_STATS);
    			}
    			moveMouse(560, 230, 40, 180);
    			wait(random(1000, 2000));
    			return random(500, 1500);
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return random(500, 750);
    			}
    		}	
    		return random(200,2000);
        }
        
        public void antiban2() {
        	if(!shouldattack()){
        		status = "Waiting Till end of round!";
        	}
        	final int randomNum = random(1, 14);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(7, 750);
    			final int y = random(9, 500);
    			moveMouse(x, y);
    			return;
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return;
    			} else {
    				return;
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return;
    			}
    			
    			moveMouse(0, 0, 580, 480);
    			wait(random(1000, 2000));
    			return;
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return;
    			}	
    		
    		case 6:
    			if(random(1,2)==1) {
    				setCameraAltitude(random(50,100));
    				return;
    			}
    		case 7: if(random(1,2)==1) {
    			setCameraAltitude(true);
    		}
    		case 8: if (random(1, 2) == 1){
    		    moveMouseSlightly();
    		    break;
    		}
    		}
    		return;
        }
        
        public void mapisland() {    	
        	final RSObject rock = getNearestObjectByID(5605);
        	if (rock != null) {
        		rocktile = rock.getLocation();
        		mappedisland = true;
        		status = "Mapping Out Island";
    			
        		bottomrightk = new RSTile (rocktile.getX()-8,rocktile.getY()-15);
    			topleftk = new RSTile (rocktile.getX()-3,rocktile.getY()-20);
        		knighttile = new RSTile (rocktile.getX()-6,rocktile.getY()-17);     		
        		toplefttile = new RSTile (rocktile.getX()+35,rocktile.getY()-55);  
        		bottomrighttile = new RSTile (rocktile.getX()-35,rocktile.getY()+20);  
        		bottomrightbb = new RSTile (rocktile.getX()-6,rocktile.getY()+4); // Boat on island
        		topleftbb = new RSTile (rocktile.getX()-3,rocktile.getY()-2); // Boat on island
        		battlefield = new RSTile (rocktile.getX()-5,rocktile.getY()-28);
        		//log("Rock Tile:"+rocktile.getX()+","+rocktile.getY());
        		//log("Knight Tile:"+knighttile.getX()+","+knighttile.getY());
        	} else {
        	}
        }
       
        public String side() {
        	if(getLocation().getX()-(rocktile.getX()-6)>=0){
        		return "Left";
        	} else 
        		return "Right";
        }
        
        public boolean byknight() {
        	return distanceTo(knighttile)<8;
        }
        
        public void walktoknight() {
        	RSTile TempTile = new RSTile (rocktile.getX()-random(((rocktile.getX()-knighttile.getX())/2),((rocktile.getX()-knighttile.getX())/2)+2),rocktile.getY()-random(((rocktile.getY()-knighttile.getY())/2),((rocktile.getY()-knighttile.getY())/2)+2));
        	walkTo(TempTile); 	
        	wait(random(1200,1700)+random(1000,1800));
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				//walkPathMM(temp);
    			}
    		}
        	RSTile TempTile2 = new RSTile (knighttile.getX()+random(-2,2),knighttile.getY()+random(-2,2));
        	walkTo(TempTile2); 	
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				fights();
    			}
    		}
        }    
        
        //private void openGate() {
    		
    	//}
    
        
        public RSTile getNearest(final ArrayList<RSTile> tiles, final RSTile t) {
    		RSTile nearest = tiles.get(0);
    		for (int i = 0; i < tiles.size(); i++) {
    			if (distanceBetween(tiles.get(i), t) < distanceBetween(nearest, t)) {
    				nearest = tiles.get(i);
    			}
    		}
    		return nearest;
    	}
    
        
        public RSTile[] genPath(final RSTile t) {
    		RSTile current = getMyPlayer().getLocation();
    		final ArrayList<RSTile> tiles = new ArrayList<RSTile>();
    		final ArrayList<RSTile> path = new ArrayList<RSTile>();
    
    		while (distanceBetween(t, current) > 2) {
    			final int x = current.getX();
    			final int y = current.getY();
    			tiles.add(new RSTile(x, y - 1));
    			tiles.add(new RSTile(x - 1, y));
    			tiles.add(new RSTile(x + 1, y));
    			tiles.add(new RSTile(x, y + 1));
    			tiles.add(new RSTile(x - 1, y - 1));
    			tiles.add(new RSTile(x + 1, y - 1));
    			tiles.add(new RSTile(x + 1, y + 1));
    			tiles.add(new RSTile(x - 1, y + 1));
    			final RSTile tile = getNearest(tiles, t);
    			path.add(tile);
    			this.path = path.toArray(new RSTile[path.size()]);
    			current = tile;
    			tiles.clear();
    		}
    		this.path = path.toArray(new RSTile[path.size()]);
    		return this.path;
    	}
    
        public boolean WalkCorrectPath(String SideLoc, String portal, RSTile[] Paths){
        	if(SideLoc=="Left"){
        		if(portal=="West" || portal=="South West"){
        			Paths = reversePath(Paths);
        		}
        	}
        	if(!(SideLoc=="Left")){
        		if(portal=="West" || portal=="South West"){
        			if(getLocation().getX()>portaltw.getX()){
        				if(getLocation().getY()>rocktile.getY()+20)
        					Paths = reversePath(Paths);
        			}
        		}
        	}
        	if(!(walkPathMM(Paths))){
    			if(onisland()){
    				//if(!(walkPathMM(randomizePath(genPath(path.get(path.size()-1)), 2, 2), 10))){
    				if(!(walkPathMM(randomizePath(genPath(Paths[Paths.length-1]), 2, 2), 10))){
    					if(onisland()){
    						if(!walkPathMM(randomizePath(genPath(portaltw), 2, 2), 12)) {
    							log("Please post about a walk SUGGESTION (Not error)");
    							log("Suggestion to post: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()+ " P:"+portal));
    						}
    					}
    				}
    			}
    		}
        	return true;
        }
        
        public void walktoportal(String portal) {
        	 ArrayList<RSTile> path = new ArrayList<RSTile>();
        	 if(path.size()>1){
        		 path.clear();
        	 }
        	if(onisland()){
        		if(portal=="West") {
        			portaltw = new RSTile (rocktile.getX()-31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-random(10,12),rocktile.getY()-random(9,11)));
        			path.add(new RSTile (rocktile.getX()-random(17,19),rocktile.getY()-random(13,15))); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-18));//Right before portal
        			path.add(new RSTile (rocktile.getX()-28,rocktile.getY()-17)); 
        		}
        		if(portal=="East"){
        			portaltw = new RSTile (rocktile.getX()+31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+random(7,9),rocktile.getY()-28));
        			path.add(new RSTile (rocktile.getX()+random(16,18),rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()+random(26,31),rocktile.getY()-random(18,21)));
        		}
        		if(portal=="South East"){
        			portaltw = new RSTile (rocktile.getX()+7,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate		
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+8,rocktile.getY()-36)); //Right before portal
        		}
        		if(portal=="South West"){
        			portaltw = new RSTile (rocktile.getX()-16,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()-14,rocktile.getY()-33));
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-38)); //Right before portal
        		}
        		//if(gateclosed){
        			//opengate();
        		//}
        		WalkCorrectPath(side(), portal,path.toArray( new RSTile[ path.size() ] ));
        		//walkPathMM(randomizePath(genPath(portaltw), 2, 2), 10);
        	}
        }
        
        public boolean closeportal(String Portalz){
        	int westpi, eastpi, sepi,swpi;
        	westpi = distanceTo(new RSTile (rocktile.getX()-31,rocktile.getY()-20));
        	eastpi = distanceTo(new RSTile (rocktile.getX()+31,rocktile.getY()-20));
        	sepi = distanceTo(new RSTile (rocktile.getX()+7,rocktile.getY()-40));
        	swpi = distanceTo(new RSTile (rocktile.getX()-16,rocktile.getY()-40));
    	    if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    	 log("Close west");
    	    }
    		if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    			log("Close east");
    		}
    		if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    			log("Close sep");
    		}
    		if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    			log("Close swp");
    		}
        	
        	if(Portalz=="westp"){
    	    	if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    		return true;
    	    	}
        	}
        	if(Portalz=="eastp"){
    			if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    				return true;
    			}
        	}
    		if(Portalz=="sep"){
    			if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    				return true;
    			}
    		}
    		if(Portalz=="swp"){
    			if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    				return true;
    			}
    		}
        	return false;
        }
        
        public boolean walktoaportal(boolean realwalk) {
        	if(onisland()){
        		final RSInterface portalface = RSInterface.getInterface(408);
        		if (portalface.isValid()) {
        			westp = Integer.parseInt(RSInterface.getChildInterface(408,13).getText());
        			eastp = Integer.parseInt(RSInterface.getChildInterface(408,14).getText());
        			sep = Integer.parseInt(RSInterface.getChildInterface(408,15).getText());
        			swp = Integer.parseInt(RSInterface.getChildInterface(408,16).getText());
        			
        		}
        		portalname = "null!";
        		//boolean skip = false;
        		//int myrand;
        		if(p4match){
        			//myrand=10;
        		} else {
        			//myrand = random(1,4);
        		}
        		//log("Random portal = "+ myrand);
        		if(eastp>=40){//&& closeportal("eastp")){
        			portalname = "East";
        			//if(myrand==1){
        				//skip = true;
        				//p4match = true;
        				
        			//}
        		}
        		if(sep>=40){ //&& !(skip) && closeportal("sep")){
        			portalname = "South East";
        			//if(myrand==2){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(swp>=40){ //&& !(skip) && closeportal("swp")){
        			portalname = "South West";
        			//if(myrand==3){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(westp>=40){ // && !(skip) && closeportal("westp")){
        			//if(myrand==4){
        				//skip = true;
        				//p4match = true;
        			//}
        			portalname = "West";
        		}
        		if(!(portalname=="null!")&&realwalk){
        			walktoportal(portalname);
        		} else if(!(portalname=="null!")){
        			return true;
        		}
        		else return false;
        	}
        	return true;
        }
    
    	public boolean abletoattack() {
          return(getMyPlayer().getInteracting() == null);	
        }
        
        public int getSpec() {
    		return getSetting(300)/10;
    	}
        
        public boolean prayerenabled() {
    		return getSetting(1396)>0;
    	}
    
    	boolean specEnabled() {
    		return (getSetting(301)) == 1;
    	}
    
    	void doSpec() {
    		if(onisland()){
    			if (getSpec() == 100 && !specEnabled() && usespec) {
    				openTab(Constants.TAB_ATTACK);
    				clickMouse(645 + random(0, 4), 425 + random(0, 4), true);
    				wait(random(500, 1000));
    			} else {
    				wait(random(10, 50));
    			}
    		}
    	}
    
        
        public boolean cangetonboat(String boat) {
        	return !(RSInterface.getInterface(243).isValid()) || !(RSInterface.getInterface(211).isValid() || !RSInterface.getInterface(242).isValid()); 	
        }
        
        public boolean notbuyarmour() {
        	if(buytop&&!(topbuy)){
        		return false;
        	}
        	if(buybottom&&!(bottombuy)){
        		return false;
        	}
        	if(buygloves&&!(glovesbuy)){
        		return false;
        	}
        	if(buymace&&!(macebuy)){
        		return false;
        	}
        	return true;
        }
        
        public boolean canaffordanitem() {
        	if(pcpoints>=150){
        		if(buygloves&&!glovesbuy) {
        			return true;
        		}
        	}
        	if(pcpoints==250){
        		if(buybottom&&!bottombuy) {
        			return true;
        		}
        		if(buytop&&!topbuy) {
        			return true;
        		}
        	}
        	return false;
        }
        
        public int gettheskill(String skill) {
        	if(tskill=="Melee"){	
    			if(skill=="Att"){
    				cons = Constants.STAT_ATTACK; 
    			}
    			if(skill=="Str"){
    				cons = Constants.STAT_STRENGTH;
    			}
    			if(skill=="Def"){
    				cons = Constants.STAT_DEFENSE;
    			}
    		} else if(skill=="Mage"){
    			cons = Constants.STAT_MAGIC;
    		} else if(skill=="Range"){
    			cons = Constants.STAT_RANGE;
    		} 
        	return  skills.getCurrentSkillLevel(cons);
        }
        
        public boolean canbuysomething() {
          if(logfullz&&pcpoints>=250-boatp+1){
        	  log("Have full points, ending script");
        	  stopScript(true);
          }
          if(logfullz) {
        	  return false;
          }
          if(pcpoints>=100&&buyskills&&notbuyarmour()){
        	  return true;
          }
          if(!notbuyarmour()) {
        	if(canaffordanitem()){
        		return true;
        	}
          }
          if(!logfullz &&pcpoints>=250-boatp+1 ){
        	  log.warning("Can not buy because your boat points wont add up to desired item");
        	  stopScript(true);
          }
          return false;
        }
        
        public void DoExchange() {
        	RSNPC knight;
        	if(outsideboat()){
        		for (int i = 0; i < topoints.length; i++) {
        			if(getNearestNPCByName("Void Knight").isOnScreen()){
        				break;
        			}
        			wait(random(1000,2500));
        			flags();
        			walkPathMM(topoints);
        		}
        		knight = getNearestNPCByName("Void Knight");
        		if(!(knight==null)){
        			if(!getNearestNPCByName("Void Knight").isOnScreen()){
        				walkTo(knight.getLocation());
        				waitToMove(2000);
            			flags();
        			}
        			atNPC(getNearestNPCByID(3788), "change");
        			wait(random(500,800));
        			flags();
        			wait(random(5000,8000));
        			SpendingPoints();
        		}
        	}    	
        }
        
        public boolean doslider(){
        	if (RSInterface.getInterface(267).isValid()) {	
        		clickMouse(random(473,483),random(180,195),true);
        		wait(random(4000,5000));
        		return true;
        	}
        	return false;
        }
        
        public void confirms() {
        	if (RSInterface.getInterface(267).isValid()) {	
        		atInterface(RSInterface.getInterface(267).getChild(101));
        		wait(random(4000,5000));
        	}
        }
        
        public void SpendingPoints() {
    		if (RSInterface.getInterface(267).isValid()) {				
    			if (skilltobuy == "Attack") { 
    				atInterface(RSInterface.getInterface(267).getChild(56));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Strength") { 
    				atInterface(RSInterface.getInterface(267).getChild(57));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Defence") { 
    				atInterface(RSInterface.getInterface(267).getChild(58));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Ranged") { 
    				atInterface(RSInterface.getInterface(267).getChild(59));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Magic") { 
    				atInterface(RSInterface.getInterface(267).getChild(60));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Hitpoints") { 
    				atInterface(RSInterface.getInterface(267).getChild(61));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Prayer") { 
    				atInterface(RSInterface.getInterface(267).getChild(62));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if(!notbuyarmour()) {
    		    	if(canaffordanitem()){
    		    		if(pcpoints>=150){
    		        		if(buygloves&&!glovesbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(44));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				glovesbuy = true;
    		        		}
    		        	}
    		        	if(pcpoints==250){
    		        		if(buybottom&&!bottombuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(43));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				bottombuy = true;
    		        		}
    		        		if(buytop&&!topbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(42));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				topbuy = true;
    		        		}
    		        		if(buymace&&!(macebuy)){
    		        			atInterface(RSInterface.getInterface(267).getChild(41));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				macebuy = true;
    		            	}
    		        	}
    		    	}
    		      }
    		} else {
    			atNPC(getNearestNPCByID(3788), "change");
    			wait(random(1000, 2000));
    		}
    	}
    
        
        public boolean died() {
        	if(inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getX(),topleftbb.getX(),topleftbb.getY(),bottomrightbb.getX(),bottomrightbb.getY())){
        		walkd = false;
        		return true;
        	}
        	return false;
        }
        
        public boolean byaportal() {
        	if(onisland()){
        		final RSNPC portal = getNearestNPCByName("Portal");
        		if(!(portal==null)){
        			if(distanceTo(portal.getLocation())>5){
        				return false;	
        			}
        			else return true;
        		}
        	}
        	return false;
        }
        
        public boolean shouldattack(){
        	if(walktoaportal(false) && !gotzealforround()) {
        		return true;
        	}
        	if(walktoaportal(false)){
        		return true; 
        	}
        	return walktoaportal(false) && !gotzealforround(); 
        }
        
        public boolean fights() {
        	if(onisland()){
        		RSNPC Me,Portal = null;
        		String[] me;
        		ArrayList<String> attz = new ArrayList<String>();
        		attz.add("Attack");
        		boolean mee = false;
        		int I;
        		if(!defendk){
        			//Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
        			Me = getNearestNPCByName(ta);
        		} else {
        			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
        		}
        		if(attportals){
        			Portal = getNearestNPCToAttackByName("Portal");	
    	    		if(!(Portal==null)){
    	    			me =Portal.getActions(); 
    	    			for(I=0; I < me.length; I++){
    	    				//log(me[I]);
    	    				if(attz.contains(me[I])){
    	    					mee=true;
    	    				}
    	    			}
    	    		}
    	    		if(!mee){
    					Portal = null;
    				}
        		}
        		
        		if(attportals&&(Portal != null)&&Portal.isOnScreen() && shouldattack()){
        			if(getMyPlayer().getInteracting() == null && (Portal != null) && Portal.isOnScreen()) {
        				try {
        					if(atNPC(Portal, "Attack Por")) {
        						wait(random(500,1000));
        						flags();
        						return true;
        					} else {
        						status = "Doing antiban";
        						antiban2();
        					}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		} else {
        			if(getMyPlayer().getInteracting() == null && (Me != null) && Me.isOnScreen() && shouldattack()) {
        				try {
    	    				if(atNPC(Me, "Attack " + Me.getName())) {
    	    					wait(random(500,1000));
    	    					flags();
    	    					return true;
    	    				} else {
    	    					status = "Doing antiban";
    	    					antiban2();
    	    					if(!defendk){
    	    		    			//RSNPC Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
    	    		    			Me = getNearestNPCByName(ta);
    	    		    		} else {
    	    		    			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
    	    		    		}
    	    					if(!(Me==null)&&Me.isOnScreen()) {
    	    						return true;
    	    					}
    	    				}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		}
        	}
        	return false;
        }
         
        public RSInterfaceChild getPrayerInterface() {
    		if (Bot.getClient().getRSInterfaceCache() == null) {
    			return null;
    		}
    		final RSInterface iface = RSInterface.getInterface(749);
    		final RSInterfaceChild child = iface.getChild(4);
    		
    		return child;
    	}
        
        public boolean DoQuickPrayers() {
        	int prayerp;
        	if(onisland()){
        		prayerp = Integer.parseInt(RSInterface.getChildInterface(749,4).getText());
        		if(!prayerenabled()) {
        			if(prayerp>0&&useqp){
        				final RSInterfaceChild cont = getPrayerInterface();
        				return (atInterface(cont));	
        			}
        		}
        	}
    		return false;
        	
        }
        
        public boolean enterboat() {
        	wait(random(2000,4000));
        	final RSInterface IFACE = RSInterface.getInterface(243);
    		final RSInterface IFACE2 = RSInterface.getInterface(211);
    		if (IFACE.isValid()) {
        		zealgained = zealgained + boatp;
    		} else if (IFACE2.isValid()) {
    			loz++;
        	}
        	if(!tileOnScreen(laddertile)) {
    			if(!tileOnMap(laddertile)&& !getMyPlayer().isMoving()){
    				walkPathMM(toboat, 10);
    			} else {
    				if(!getMyPlayer().isMoving()){
    					walkTo(laddertile);
    				}
    			}
    		} else {
    			final RSObject ladderid = getNearestObjectByID(ladderd);
    			if (ladderid != null && !insideboat() && !canbuysomething()) {
    				status = "Entering Boat";
    				wait(random(700,2400));
    				atObject(ladderid, "Cross");
    				wait(random(1000,2000));
    				if(!insideboat()){
    					wait(random(1000,1500));
    					atObject(ladderid, "Cross");
    					wait(random(1000,2000));
    				}
    				if(!insideboat()&& !cangetonboat("novice")){
    					return false;
    				}	
    			} else {
    				if(!insideboat()&& !cangetonboat("novice")){
    					//log("Failed to board boat");
    					return false;
    				}	
    			}
    		}
        	return false;
        }
        
    	@Override
    	public int loop() {
    		if(!firstlogin){
    			wait(random(3000,5000));
    			firstlogin = true;
    		}
    		wait(random(400,600));
    		setCameraAltitude(true);
    		if(startlvl==0){
    			if(tskill=="Mage"){
    				tskilld = tskill;
    			} else if(tskill=="Range"){
    				tskilld = tskill;
    			}
    			startlvl = gettheskill(tskilld);
    			
    		}		
    		if(outsideboat()){
    			if(canbuysomething()&&!insideboat()){
    				DoExchange();
    			}
    			walkd = false;
    			mappedisland = false;
    			setangleisland = false;
    			knighttile = new RSTile (0,0);
    			toplefttile = new RSTile (0,0);
    			bottomrighttile = new RSTile (0,0);
    			newround = true;
    			p4match = false;
    			enterboat();
    		}
    		if(insideboat()){
    			mappedisland = false;
    			walkd= false;
    			newround = true;
    			setangleisland = false;
    			p4match = false;
    			status = "Waiting on boat.";
    			return antiban();
    		}
    		
    		if(onisland()){
    			status = "Fighting!!!";
    			if(!setangleisland){
    				setRun(true);
    				setFightMode(dfightm);
    				wait(random(200,300));
    				setangleisland=true;
    			}
    			if(!mappedisland){
    				mapisland();		
    			}
    			//if(!walkd || died()) {
    				//walktoaportal();
    			//}	
    			
    			DoQuickPrayers();
    			doSpec();
    			if(defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && (getMyPlayer().getInteracting() == null)){
    						if(!byknight()){
    							walktoknight();
    						}
    					  }
    					}
    				} else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}
    			}
    			if(!defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && !byaportal() && (getMyPlayer().getInteracting() == null)){
    						if(!getMyPlayer().isMoving()) {
    							walktoaportal(true); 
    						}
    					}
    				}else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}				
    			}
    
    		return 200;
    	}
    		
    	
    
    
    
    	@Override
    	public boolean onStart(final Map<String, String> args) {
    		wtbs = args.get("wtbs");
    		knighttile = new RSTile (0,0);
    		toplefttile = new RSTile (0,0);
    		bottomrighttile = new RSTile (0,0);
    		final gui gui = new gui();
    		gui.setVisible(true);
    		try {
    			log("Checking for updates");
    			// Open the version text file
    			URLConnection url = new URL("http://www.zaszmedia.com/scripts/zpc/version.txt").openConnection();
    			// Create an input stream for it
    			BufferedReader reader = new BufferedReader(new InputStreamReader(url.getInputStream()));
    			// Check if the current version is out dated
    			if (Double.parseDouble(reader.readLine()) > version){
    				outdated = true;
    				log("You have an old version of the script!");
    				log("You can update by visiting http://www.rsbot.org/vb/showthread.php?t=177106");
    			} else {
    				outdated = false;
    				log("You have the latest version of the script!");
    			}
    			if (reader != null)
    				reader.close();
    		} catch (IOException e) {
    			Bot.getEventManager().removeListener(PaintListener.class, this);
    			log("Problem getting version.");
    			stopScript();
    		}
    
    		while (!startScript) {
    			wait(20);
    		}
    		return true;
    	}
    
    	
    	public boolean inAreza(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
    
    	
    	public int optionpaint() {
    		Mouse m = Bot.getClient().getMouse();
    		//bottom left then top right
    		if (inArea(m.x,m.y,560+50,226-60,560,226-10)) {
                return  1;
            }
            if (inArea(m.x,m.y,560+110,226-60,560+51,226-10)) {
            	return  2;
            }
            if (inArea(m.x,m.y,560+170,226-60,560+111,226-10)) {
            	return  3;
            }
    		return 0;
    	}
    	
    	// final int x = 300-50; orig
    	//int y = 16+75; orig
    	//g.fill3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.draw3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.setColor(new Color(60, 140, 200, 50)); orig
    	
    	public void onRepaint(Graphics g) {
            if (isLoggedIn()) {	
                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;
                
                final int x = 560;
    			int y = 226;
    			
    			if(newround && onisland()){
    				gamesplayed = gamesplayed + 1;
    				newround = false;
    			}
    			if(!(startlvl==0)){
    				gettheskill(tskilld);
    				startEXP = skills.getCurrentSkillExp(cons);
    			}
    			if(optionpaint()==0){
    				g.setColor(new Color(0, 0, 0, 175));	//new
    				g.fillRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				
    			}
    			if(optionpaint()==1){	
    				
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				if(onisland()){
    					g.drawString("Games played:"+ (gamesplayed-1), x, y);
    				} else {
    					g.drawString("Games played:"+gamesplayed, x, y);
    				}
    				if(pcpoints>0){
    					y = y + 16;
    					g.drawString("PCP Gained: "+zealgained+" Total PCP: "+pcpoints, x, y);	
    				} else {
    					y = y + 16;
    					g.drawString("PC Points Gained: "+zealgained, x, y);
    				}
    				y = y + 16;
    				if(onisland()&&gamesplayed>0){
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+ ((gamesplayed-1) - (zealgained/2)+ " Lack of Z: " + loz), x, y);
    				} else {
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+(gamesplayed - (zealgained/2) + " Lack of Z: " + loz), x, y);
    				}
    			}
    			if(optionpaint()==2){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y +16;
    				g.drawString("Using: "+tskill+" Skill: "+tskilld, x, y);
    				y = y + 16;
    				g.drawString("Start "+tskilld+" lvl: "+startlvl+" Current lvl: "+gettheskill(tskilld), x, y);
    			}
    				//if(!(knighttile.getX()==0)){
    					//y = y + 16;
    					//g.drawString("Knight tile: " + knighttile.getX()+","+knighttile.getY(), x, y);
    				//}
    			if(optionpaint()==3){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				g.drawString("Boat Kind:"+ boattb , x, y);
    				if(!(amode=="Mage")){
    					if(usespec){
    						y = y + 16;
    						g.drawString("Set to use spec when able", x, y);
    					}
    				}
    				if(!(knighttile.getX()==0)){
    					y = y + 16;
    					g.drawString("Earned Zeal for round "+gotzealforround(), x, y);
    					
    				}
    				if(onisland()){
    					y = y + 16;
    					g.drawString("By a portal: "+ byaportal(), x, y);
    					y = y + 16;
    					y = y + 16;
    					g.drawString("Island Tile: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()), x, y);
    				}
    			}
            } 
        }
    }
    
    Zasz's PC script, made by a very good script writer.
    He has the best auto enchanter out there and Out of 600 games of PC, I've gotten no points 7 times.
     
  11. Unread #6 - Mar 6, 2010 at 9:29 PM
  12. Tigerz
    Joined:
    Dec 24, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Tigerz Member

    Whats the best FREE pest control bot?

    Code:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Map;
    
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.SwingConstants;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    
    import org.rsbot.bot.Bot;
    import org.rsbot.bot.input.Mouse;
    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.RSInterfaceChild;
    import org.rsbot.script.wrappers.RSNPC;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    
    
    
    
    
    @ScriptManifest(authors = { "Zasz" }, category = "Combat", name = "Zasz's Pest Control", version = 1.00, description = "<html><head>"
    	+ "</head><body>"
    	+ "<center><strong><h2>Zasz's Pest Control!</h2></strong></center>"
    	+ "<center></center><br />"
    	+ "<br>"
    	+ " <center><B>Click start for the GUI!.</b>"
    	+ "<strong></strong>" 
    	+ "</center><br>"
    	+ "</body></html>")
    
    public class ZaSzPC extends Script implements PaintListener {
    	public long startTime = System.currentTimeMillis();
    	public long tsa,tsw;
        boolean hasset, buys,buymace,buytop,buybottom,buygloves,buyskills,mappedisland,firstlogin,setangleisland;
        boolean macebuy,topbuy,bottombuy,glovesbuy;
        boolean newround,usespec, logfullz, outdated, walkd, attportals, useqp, defendk, p4match;
        boolean makep =  true;
        public boolean startScript = false;
        private String status = "";
        String wtbs,portalname;
        String tskill, amode,tskilld, skilltobuy, helmtobuy, boattb;
        int dfightm, startlvl,gamesplayed, pcpoints, cons, startEXP, Location,ladderd,boatp,loz;
    	long eph;
    	int lastportalopend,portalid;
        int zealgained = 0;
        int westp,eastp,sep,swp;
        int[] monsters = {3734,3735,3733};
        String[] wtb, ta;
        RSTile knighttile, boattilen, boattiles;
        RSTile rocktile,bottomrighttile,toplefttile,battlefield;
        RSTile bottomrightk,topleftk, bottomrightbb, topleftbb;
        RSTile laddertile;
        RSTile portaltw;
        String cp = "";
        public double version = 1.5;
    	private RSTile[] path,toboat,topoints;
    
        public class gui extends JFrame 
        { 
        	/**
    		 * 
    		 */
    		private static final long serialVersionUID = 1337L;
    		// Variables declaration 
        	private JTabbedPane jTabbedPane1; 
        	private JButton jButton1; 
        	private JPanel contentPane; 
        	//----- 
        	private JLabel jLabel2; 
        	private JLabel jLabel5; 
        	private JLabel jLabel6; 
        	private JPanel jPanel1; 
        	//----- 
        	private JLabel jLabel7; 
        	private JLabel jLabel8; 
        	private JLabel jLabel9; 
        	private JLabel jLabel10; 
        	private JLabel jLabel12; 
        	private JComboBox jComboBox1; 
        	private JComboBox jComboBox2; 
        	private JComboBox jComboBox3;
        	private JComboBox jComboBox4;
        	private JComboBox jComboBox5; // Boat
        	private JCheckBox jCheckBox3;  
        	private JCheckBox jCheckBox4; 
         	private JCheckBox jCheckBox5; 
         	private JCheckBox jCheckBox6;// Att portal 
         	private JCheckBox jCheckBox7; // Use quick Prayer
         	private JCheckBox jCheckBox8; // Defend Knight
        	private JPanel jPanel2; 
        	//----- 
        	private JPanel jPanel3; 
        	//----- 
        	private JPanel jPanel4; 
        	
        	private JRadioButton jRadioButton1; 
         	private JRadioButton jRadioButton2; 
         	private JRadioButton jRadioButton3; 
         	private JRadioButton jRadioButton4; 
         	private JRadioButton jRadioButton5; 
         	private JRadioButton jRadioButton6; 
         	private JRadioButton jRadioButton7; 
         	private JRadioButton jRadioButton8; 
         	private JRadioButton jRadioButton9; 
         	private JRadioButton jRadioButton10; 
         	private JRadioButton jRadioButton11; 
        	// End of variables declaration 
         
         
        	public gui() 
        	{ 
        		super(); 
        		initializeComponent(); 
        		
         
        		this.setVisible(true); 
        	} 
         
        	/** 
        	 * This method is called from within the constructor to initialize the form. 
        	 * WARNING: Do NOT modify this code. The content of this method is always regenerated 
        	 * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
        	 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
        	 * to retrieve your design properly in future, before revising this method. 
        	 */ 
        	private void initializeComponent() 
        	{ 
        		jTabbedPane1 = new JTabbedPane(); 
        		jButton1 = new JButton(); 
        		contentPane = (JPanel)this.getContentPane(); 
        		//----- 
        		jLabel2 = new JLabel(); 
        		jLabel5 = new JLabel(); 
        		jLabel6 = new JLabel(); 
        		jPanel1 = new JPanel(); 
        		jCheckBox3 = new JCheckBox(); 
        		//----- 
        		jLabel7 = new JLabel(); 
        		jLabel8 = new JLabel(); 
        		jLabel9 = new JLabel();
        		jLabel10 = new JLabel();
        		jLabel12 = new JLabel();
        		jComboBox1 = new JComboBox(); 
        		jComboBox2 = new JComboBox(); 
        		jComboBox3 = new JComboBox(); 
        		jComboBox4 = new JComboBox();
        		jComboBox5 = new JComboBox();
        		jPanel2 = new JPanel();
        		jCheckBox4 = new JCheckBox(); 
         		jCheckBox5 = new JCheckBox(); 
         		jCheckBox6 = new JCheckBox();
         		jCheckBox7 = new JCheckBox();
         		jCheckBox8 = new JCheckBox();
        		jRadioButton1 = new JRadioButton(); 
         		jRadioButton2 = new JRadioButton(); 
         		jRadioButton3 = new JRadioButton();
         		jRadioButton4 = new JRadioButton(); 
        		jRadioButton5 = new JRadioButton();
        		jRadioButton6 = new JRadioButton();
        		jRadioButton7 = new JRadioButton();
        		jRadioButton8 = new JRadioButton();
        		jRadioButton9 = new JRadioButton();
        		jRadioButton10 = new JRadioButton();
        		jRadioButton11 = new JRadioButton();
        		//----- 
        		jPanel3 = new JPanel(); 
        		//----- 
        		jPanel4 = new JPanel();
        		// 
        		// jTabbedPane1 
        		// 
        		jTabbedPane1.addTab("Description", jPanel1); 
        		jTabbedPane1.addTab("Combat Options", jPanel2); 
        		jTabbedPane1.addTab("Island Options", jPanel4); 
        		jTabbedPane1.addTab("Zeal Options", jPanel3); 
        		jTabbedPane1.addChangeListener(new ChangeListener() { 
        			public void stateChanged(ChangeEvent e) 
        			{ 
        				jTabbedPane1_stateChanged(e); 
        			} 
         
        		}); 
        		// 
        		// jButton1 
        		// 
        		jButton1.setText("Start Script!"); 
        		jButton1.addActionListener(new ActionListener() { 
        			public void actionPerformed(ActionEvent e) 
        			{ 
        				jButton1_actionPerformed(e); 
        			} 
         
        		}); 
        		// 
        		// contentPane 
        		// 
        		contentPane.setLayout(null); 
        		addComponent(contentPane, jTabbedPane1, 0,0,373,221); 
        		addComponent(contentPane, jButton1, 124,240,106,28); 
        		// 
        		// jLabel2 
        		// 
        		jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); 
        		jLabel2.setHorizontalTextPosition(SwingConstants.LEADING); 
        		jLabel2.setText("ZaSz\'s Pest Control: By ZaSz"); 
        		// 
        		// jLabel5 
        		// 
        		jLabel5.setText("Start this script either at Pest Control bank. Or near the landers!"); 
        		// 
        		// jLabel6 
        		// 
        		jLabel6.setText("Make sure to fill out all the options! Or this script won\'t work for you!"); 
        		// 
        		// jPanel1 
        		// 
        		jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel1.add(jLabel2, 0); 
        		jPanel1.add(jLabel5, 1); 
        		jPanel1.add(jLabel6, 2); 
        		jPanel1.setOpaque(true); 
        		// 
        		// jLabel7 
        		// 
        		jLabel7.setText("Combat Style"); 
        		// 
         		// jLabel8 
         		// 
         		jLabel8.setText("Attack style "); 
         		// 
         		// jLabel9 
         		// 
         		jLabel9.setText("Skill to buy");
         		// 
         		// jLabel10 
         		// 
         		jLabel10.setText("Boat to use:    ");
         		// 
         		// jCheckBox3 
         		// 
         		jCheckBox3.setText("Use special Attacks when applicable? (Range/Melee only)"); 
         		// jCheckBox4 
         		// 
         		jCheckBox4.setText("logout at full zeal (Can't buy anything else if you pick)"); 
         		// 
         		// jCheckBox5 
         		// 
         		jCheckBox5.setText("Use Zeal to buy skills.    ");
         		// 
         		// jCheckBox6 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox7
         		// 
         		jCheckBox7.setText("Use Quick Prayer.       "); 
         		// 
         		// jCheckBox8
         		// 
         		jCheckBox8.setText("Defend the knight instead of portals.  "); 
         		// 
         		// jRadioButton1 
         		// 
         		//(Use dropdown box to select)
         		jRadioButton1.setText("Buy a helm  (Helms/Void armour not able this version)"); 
         		// 
         		// jRadioButton2 
         		// 
         		jRadioButton2.setText("Buy Void Top"); 
         		// 
         		// jRadioButton3 
         		// 
         		jRadioButton3.setText("Buy Void Bottom"); 
         		// 
         		// jRadioButton4 
         		// 
         		jRadioButton4.setText("Buy Void Gloves"); 
         		// 
         		// jRadioButton5 
         		// 
         		jRadioButton5.setText("Buy Void Mace         "); 
        		// 
        		// jComboBox1 
        		// 
        		jComboBox1.addItem("Melee"); 
        		jComboBox1.addItem("Range"); 
        		jComboBox1.addItem("Mage"); 
        		// 
         		// jComboBox2 
         		// 
         		jComboBox2.addItem("Accurate (Att/Range/Mage)"); 
         		jComboBox2.addItem("Strength/Rapid (Str/Range/Mage)"); 
         		jComboBox2.addItem("Defensive (Def/Def+range/Def+Mage"); 
         		// 
         		// jComboBox3 
         		// 
         		jComboBox3.addItem("Attack"); 
         		jComboBox3.addItem("Strength"); 
         		jComboBox3.addItem("Defence"); 
         		jComboBox3.addItem("Ranged"); 
         		jComboBox3.addItem("Magic"); 
         		jComboBox3.addItem("Hitpoints"); 
         		jComboBox3.addItem("Prayer"); 
         		
         		//
         		// jComboBox4
         		//
         		jComboBox4.addItem("Mage helm");
         		jComboBox4.addItem("Melee helm");
         		jComboBox4.addItem("Range helm");	
         		//
         		// jComboBox5
         		//
         		jComboBox5.addItem("Novice Boat");
         		jComboBox5.addItem("Intermediate Boat");
         		jComboBox5.addItem("Expert Boat");
        		// 
        		// jPanel2 
        		// 
         		jPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel2.add(jLabel7, 0); 
         		jPanel2.add(jComboBox1, 1); 
         		jPanel2.add(jCheckBox7,2);
         		jPanel2.add(jCheckBox3, 3); 
         		jPanel2.add(jLabel8, 4); 
         		jPanel2.add(jComboBox2, 5);
        		// 
        		// jPanel3 
        		// 
        		jPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel3.add(jCheckBox4, 0); 
         		jPanel3.add(jCheckBox5, 1); 
         		//jPanel3.add(jRadioButton1, 2); 
         		jPanel3.add(jRadioButton2, 2); 
         		jPanel3.add(jRadioButton3, 3); 
         		jPanel3.add(jRadioButton4, 4); 
         		jPanel3.add(jRadioButton5, 5); 
         		jPanel3.add(jLabel9, 6); 
         		jPanel3.add(jComboBox3, 7); 
         		//jPanel3.add(jComboBox4,9);
         		
         		/////////////////////////////////////////////////////////////////
         	// 
         		// jLabel1 
         		// 
         		jLabel10.setText("Boat To Use"); 
         		// 
         		// jLabel2 
         		// 
         		jLabel12.setText(" Monsters to Attack:  MUST HAVE SHIFTER IF DEFENDING KNIGHT!!!!          "); 
         		// 
         		// jCheckBox1 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox2 
         		// 
         		jCheckBox8.setText("Defend Knight instead of portals"); 
         		// 
         		// jRadioButton1 "Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter"
         		// 
         		jRadioButton6.setText("  Spinner"); 
         		jRadioButton6.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton7.setText("Shifter"); 
         		jRadioButton7.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton8.setText("Torcher"); 
         		jRadioButton8.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton9.setText("Defiler"); 
         		jRadioButton9.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton10.setText("Brawler");
         		jRadioButton10.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton11.setText("Splatter"); 
         		jRadioButton11.setSelected(true);
         		////////////////////////////////////////////////////////////////////////
         		// 
        		// jPanel4  (ISLAND OPTIONS)
        		// 
         		jPanel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel4.add(jLabel10,0);
         		jPanel4.add(jComboBox5, 1); 
         		jPanel4.add(jCheckBox6, 2); 
         		jPanel4.add(jCheckBox8, 3); 
         		jPanel4.add(jLabel12, 4); 
         		jPanel4.add(jRadioButton6, 5); 
         		jPanel4.add(jRadioButton7, 6); 
         		jPanel4.add(jRadioButton8, 7); 
         		jPanel4.add(jRadioButton9, 8); 
         		jPanel4.add(jRadioButton10, 9); 
         		jPanel4.add(jRadioButton11, 10); 
         		
         		//jPanel4.add(, 4); 
         		//jPanel4.add();
        		// 
        		// gui 
        		// 
        		this.setTitle("Zasz\'s Pest Control!"); 
        		this.setLocation(new Point(168, 107)); 
        		this.setSize(new Dimension(395, 311)); 
        	} 
         
        	/** Add Component Without a Layout Manager (Absolute Positioning) */ 
        	private void addComponent(Container container,Component c,int x,int y,int width,int height) 
        	{ 
        		c.setBounds(x,y,width,height); 
        		container.add(c); 
        	} 
         
        	
        	private void jTabbedPane1_stateChanged(ChangeEvent e) 
        	{ 
        		System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called."); 
      
        	} 
      
        	
        	private void jButton1_actionPerformed(ActionEvent e) 
        	{ 
        		System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); 
         
        		amode = jComboBox2.getSelectedItem().toString(); 
        		tskill = jComboBox1.getSelectedItem().toString();
        		Location = jComboBox1.getSelectedIndex();
        		usespec = jCheckBox3.isSelected();
        		buyskills = jCheckBox5.isSelected();
        		logfullz = jCheckBox4.isSelected();
        		//logfullz = true;
             	//int leng = 0;	
             	//if(jRadioButton6.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton7.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton8.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton9.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton10.isSelected()){
             ///		leng++;
        		//}
        		//if(jRadioButton11.isSelected()){
        		//	leng++;
        		//}
        		ArrayList<String> monsterztoatt = new ArrayList<String>();
    
        		if(jRadioButton6.isSelected()){
        			monsterztoatt.add("Spinner");
        		}
        		if(jRadioButton7.isSelected()){
        			monsterztoatt.add("Shifter");
        		}
        		if(jRadioButton8.isSelected()){
        				monsterztoatt.add("Torcher");
        			}
        		if(jRadioButton9.isSelected()){
        			monsterztoatt.add("Defiler");
        		}
        		if(jRadioButton10.isSelected()){
        			monsterztoatt.add("Brawler");
        		 }
        		if(jRadioButton11.isSelected()){
        			monsterztoatt.add("Splatter");
        		}
        		ta = monsterztoatt.toArray( new String[ monsterztoatt.size() ] );
        		if(!buyskills){
        			logfullz = true;
        		}
        		defendk = jCheckBox8.isSelected();
        		attportals = jCheckBox6.isSelected();
        		useqp = jCheckBox7.isSelected();
        		boattb = jComboBox5.getSelectedItem().toString();
        		if(boattb=="Novice Boat"){
        			ladderd = 14315;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2657, 2640)} ;
        			boattiles = new RSTile (2663, 2638); //SE
        			boattilen = new RSTile (2660, 2643); //NW
        			laddertile = new RSTile (2657,2639);
        			boatp = 2;
        		}
        		if(boattb=="Intermediate Boat"){
        			ladderd = 25631;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2644, 2644)} ;
        			boattiles = new RSTile (2641, 2642); //SE
        			boattilen = new RSTile (2638, 2647); //NW
        			laddertile = new RSTile (2644,2644);
        			boatp = 3;
        		}
        		if(boattb=="Expert Boat"){
        			ladderd = 25632;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2638, 2653)} ;
        			boattiles = new RSTile (2635, 2649); //SE
        			boattilen = new RSTile (2632, 2654); //NW
        			laddertile = new RSTile (2638,2653);
        			boatp = 4;
        		}
        		topoints = reversePath(toboat);
        		if(amode=="Accurate (Att/Range/Mage)"){
        			dfightm = 0;
        			tskilld = "Att";
        		} else
        		
        		if(amode=="Strength/Rapid (Str/Range/Mage)"){
        			dfightm = 1;
        			tskilld = "Str";
        		} else
        		if(amode=="Defensive (Def/Def+range/Def+Mage"){
        			if(!(tskill=="Range") || !(tskill=="Mage")){
        				dfightm = 3;
        			} else
        				dfightm = 2;
        			tskilld = "Def";
        		} else {		
        			tskilld=amode;			
        		}
        		
        		if(buyskills){
        			  skilltobuy = jComboBox3.getSelectedItem().toString();
        			  log("Buying: "+skilltobuy);
        		}
        		;
        		if(jRadioButton1.isSelected()){
        			helmtobuy = jComboBox4.getSelectedItem().toString();
        			//buyhelm = false; //delete when implemented TODO
        			//log("Buying: "+helmtobuy);
        		}
        		if(jRadioButton2.isSelected()){
        			buytop = true;
        			log("Buying: top");
        		}
        		if(jRadioButton3.isSelected()){
        			buybottom = true;
        			log("Buying: bottom");
        		}
        		if(jRadioButton4.isSelected()){
        			buygloves = true;
        			log("Buying: gloves");
        		}
        		if(jRadioButton5.isSelected()){
        			buymace = true;
        			buymace = false; //delete when implemented TODO
        			log("Buying: mace");
        			
        		}
        		
        		
    		
        		
        		
        		
        		
        		
        		
        		
    
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		//if(leng==0){
        		// log("Must select a monster to attack!");	
        		//} else {
        			setVisible(false);
        			startScript = true;
        			//}
        	} 
       
        }
        
        public boolean outsideboat() {
        	return distanceTo(laddertile)<40;
        }
        
        public boolean insideboat() {
        	final RSInterface IFACE = RSInterface.getInterface(407);
        	//if (pcpoints==0){
        	
        		if (IFACE.isValid()) {
        			String interfacet;
        			interfacet = RSInterface.getChildInterface(407,16).getText();
        			int interfacel,source,tempzeal;
        			interfacel = interfacet.length();
        			source = interfacet.indexOf(":");
        			String pointtext;
        			pointtext = interfacet.substring(source+2, interfacel);
        			tempzeal = Integer.parseInt(pointtext);
        			if(!(tempzeal==pcpoints)){
        				pcpoints = tempzeal;
        			}
        		}
        	//}
        	return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),boattiles.getX(),boattiles.getY(), boattilen.getX(), boattilen.getY());
        }
        
        public boolean onisland() {
        	if(!mappedisland){
        		final RSObject rock = getNearestObjectByID(5605);
        		if (rock != null) {
        			//log(""+rock.getLocation().getX()+","+rock.getLocation().getY()+" Distance:"+distanceTo(rock.getLocation()));
        			return distanceTo(rock.getLocation())<10;	
        		} else {
        			return false;
        		}
        	} else {
        		return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),toplefttile.getX(),toplefttile.getY(),bottomrighttile.getX(),bottomrighttile.getY());
        	}
        }
        
        public boolean inArea(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
        
        public String between(String main,String s1, String s2) {
        	  
        	  int length=s1.length();
    
        	  return main.substring(length,main.indexOf(s2,length));
    
        }
        
        public boolean gotzealforround() {
        	final RSInterface IFACE = RSInterface.getInterface(408);
        	if (IFACE.isValid()) {
        		return Integer.parseInt(RSInterface.getChildInterface(408,11).getText())>49;
        	} else
        		return false;
        }
        
        
        public void onFinish() {
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    	}
    
        
        public boolean flags() {
        	if(getMyPlayer().isMoving()){
        		long st = System.currentTimeMillis();
        		RSTile tile = getMyPlayer().getLocation();
        		while(System.currentTimeMillis() - st < 2000){
        			if(!tile.equals(getMyPlayer().getLocation())){
        				st = System.currentTimeMillis();
        	                        tile = getMyPlayer().getLocation();
        			}
        		}
        	} else {
        		return false;
        	}
        	return true;
        }
        
        public int antiban() {
        	final int randomNum = random(1, 18);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(4, 750);
    			final int y = random(4, 500);
    			moveMouse(x, y);
    			return random(1000, 1500);
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return random(500, 750);
    			} else {
    				return random(500, 750);
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return random(750, 1000);
    			}
    			if (getCurrentTab() != Constants.TAB_STATS) {
    				openTab(Constants.TAB_STATS);
    			}
    			moveMouse(560, 230, 40, 180);
    			wait(random(1000, 2000));
    			return random(500, 1500);
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return random(500, 750);
    			}
    		}	
    		return random(200,2000);
        }
        
        public void antiban2() {
        	if(!shouldattack()){
        		status = "Waiting Till end of round!";
        	}
        	final int randomNum = random(1, 14);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(7, 750);
    			final int y = random(9, 500);
    			moveMouse(x, y);
    			return;
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return;
    			} else {
    				return;
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return;
    			}
    			
    			moveMouse(0, 0, 580, 480);
    			wait(random(1000, 2000));
    			return;
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return;
    			}	
    		
    		case 6:
    			if(random(1,2)==1) {
    				setCameraAltitude(random(50,100));
    				return;
    			}
    		case 7: if(random(1,2)==1) {
    			setCameraAltitude(true);
    		}
    		case 8: if (random(1, 2) == 1){
    		    moveMouseSlightly();
    		    break;
    		}
    		}
    		return;
        }
        
        public void mapisland() {    	
        	final RSObject rock = getNearestObjectByID(5605);
        	if (rock != null) {
        		rocktile = rock.getLocation();
        		mappedisland = true;
        		status = "Mapping Out Island";
    			
        		bottomrightk = new RSTile (rocktile.getX()-8,rocktile.getY()-15);
    			topleftk = new RSTile (rocktile.getX()-3,rocktile.getY()-20);
        		knighttile = new RSTile (rocktile.getX()-6,rocktile.getY()-17);     		
        		toplefttile = new RSTile (rocktile.getX()+35,rocktile.getY()-55);  
        		bottomrighttile = new RSTile (rocktile.getX()-35,rocktile.getY()+20);  
        		bottomrightbb = new RSTile (rocktile.getX()-6,rocktile.getY()+4); // Boat on island
        		topleftbb = new RSTile (rocktile.getX()-3,rocktile.getY()-2); // Boat on island
        		battlefield = new RSTile (rocktile.getX()-5,rocktile.getY()-28);
        		//log("Rock Tile:"+rocktile.getX()+","+rocktile.getY());
        		//log("Knight Tile:"+knighttile.getX()+","+knighttile.getY());
        	} else {
        	}
        }
       
        public String side() {
        	if(getLocation().getX()-(rocktile.getX()-6)>=0){
        		return "Left";
        	} else 
        		return "Right";
        }
        
        public boolean byknight() {
        	return distanceTo(knighttile)<8;
        }
        
        public void walktoknight() {
        	RSTile TempTile = new RSTile (rocktile.getX()-random(((rocktile.getX()-knighttile.getX())/2),((rocktile.getX()-knighttile.getX())/2)+2),rocktile.getY()-random(((rocktile.getY()-knighttile.getY())/2),((rocktile.getY()-knighttile.getY())/2)+2));
        	walkTo(TempTile); 	
        	wait(random(1200,1700)+random(1000,1800));
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				//walkPathMM(temp);
    			}
    		}
        	RSTile TempTile2 = new RSTile (knighttile.getX()+random(-2,2),knighttile.getY()+random(-2,2));
        	walkTo(TempTile2); 	
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				fights();
    			}
    		}
        }    
        
        //private void openGate() {
    		
    	//}
    
        
        public RSTile getNearest(final ArrayList<RSTile> tiles, final RSTile t) {
    		RSTile nearest = tiles.get(0);
    		for (int i = 0; i < tiles.size(); i++) {
    			if (distanceBetween(tiles.get(i), t) < distanceBetween(nearest, t)) {
    				nearest = tiles.get(i);
    			}
    		}
    		return nearest;
    	}
    
        
        public RSTile[] genPath(final RSTile t) {
    		RSTile current = getMyPlayer().getLocation();
    		final ArrayList<RSTile> tiles = new ArrayList<RSTile>();
    		final ArrayList<RSTile> path = new ArrayList<RSTile>();
    
    		while (distanceBetween(t, current) > 2) {
    			final int x = current.getX();
    			final int y = current.getY();
    			tiles.add(new RSTile(x, y - 1));
    			tiles.add(new RSTile(x - 1, y));
    			tiles.add(new RSTile(x + 1, y));
    			tiles.add(new RSTile(x, y + 1));
    			tiles.add(new RSTile(x - 1, y - 1));
    			tiles.add(new RSTile(x + 1, y - 1));
    			tiles.add(new RSTile(x + 1, y + 1));
    			tiles.add(new RSTile(x - 1, y + 1));
    			final RSTile tile = getNearest(tiles, t);
    			path.add(tile);
    			this.path = path.toArray(new RSTile[path.size()]);
    			current = tile;
    			tiles.clear();
    		}
    		this.path = path.toArray(new RSTile[path.size()]);
    		return this.path;
    	}
    
        public boolean WalkCorrectPath(String SideLoc, String portal, RSTile[] Paths){
        	if(SideLoc=="Left"){
        		if(portal=="West" || portal=="South West"){
        			Paths = reversePath(Paths);
        		}
        	}
        	if(!(SideLoc=="Left")){
        		if(portal=="West" || portal=="South West"){
        			if(getLocation().getX()>portaltw.getX()){
        				if(getLocation().getY()>rocktile.getY()+20)
        					Paths = reversePath(Paths);
        			}
        		}
        	}
        	if(!(walkPathMM(Paths))){
    			if(onisland()){
    				//if(!(walkPathMM(randomizePath(genPath(path.get(path.size()-1)), 2, 2), 10))){
    				if(!(walkPathMM(randomizePath(genPath(Paths[Paths.length-1]), 2, 2), 10))){
    					if(onisland()){
    						if(!walkPathMM(randomizePath(genPath(portaltw), 2, 2), 12)) {
    							log("Please post about a walk SUGGESTION (Not error)");
    							log("Suggestion to post: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()+ " P:"+portal));
    						}
    					}
    				}
    			}
    		}
        	return true;
        }
        
        public void walktoportal(String portal) {
        	 ArrayList<RSTile> path = new ArrayList<RSTile>();
        	 if(path.size()>1){
        		 path.clear();
        	 }
        	if(onisland()){
        		if(portal=="West") {
        			portaltw = new RSTile (rocktile.getX()-31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-random(10,12),rocktile.getY()-random(9,11)));
        			path.add(new RSTile (rocktile.getX()-random(17,19),rocktile.getY()-random(13,15))); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-18));//Right before portal
        			path.add(new RSTile (rocktile.getX()-28,rocktile.getY()-17)); 
        		}
        		if(portal=="East"){
        			portaltw = new RSTile (rocktile.getX()+31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+random(7,9),rocktile.getY()-28));
        			path.add(new RSTile (rocktile.getX()+random(16,18),rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()+random(26,31),rocktile.getY()-random(18,21)));
        		}
        		if(portal=="South East"){
        			portaltw = new RSTile (rocktile.getX()+7,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate		
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+8,rocktile.getY()-36)); //Right before portal
        		}
        		if(portal=="South West"){
        			portaltw = new RSTile (rocktile.getX()-16,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()-14,rocktile.getY()-33));
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-38)); //Right before portal
        		}
        		//if(gateclosed){
        			//opengate();
        		//}
        		WalkCorrectPath(side(), portal,path.toArray( new RSTile[ path.size() ] ));
        		//walkPathMM(randomizePath(genPath(portaltw), 2, 2), 10);
        	}
        }
        
        public boolean closeportal(String Portalz){
        	int westpi, eastpi, sepi,swpi;
        	westpi = distanceTo(new RSTile (rocktile.getX()-31,rocktile.getY()-20));
        	eastpi = distanceTo(new RSTile (rocktile.getX()+31,rocktile.getY()-20));
        	sepi = distanceTo(new RSTile (rocktile.getX()+7,rocktile.getY()-40));
        	swpi = distanceTo(new RSTile (rocktile.getX()-16,rocktile.getY()-40));
    	    if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    	 log("Close west");
    	    }
    		if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    			log("Close east");
    		}
    		if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    			log("Close sep");
    		}
    		if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    			log("Close swp");
    		}
        	
        	if(Portalz=="westp"){
    	    	if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    		return true;
    	    	}
        	}
        	if(Portalz=="eastp"){
    			if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    				return true;
    			}
        	}
    		if(Portalz=="sep"){
    			if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    				return true;
    			}
    		}
    		if(Portalz=="swp"){
    			if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    				return true;
    			}
    		}
        	return false;
        }
        
        public boolean walktoaportal(boolean realwalk) {
        	if(onisland()){
        		final RSInterface portalface = RSInterface.getInterface(408);
        		if (portalface.isValid()) {
        			westp = Integer.parseInt(RSInterface.getChildInterface(408,13).getText());
        			eastp = Integer.parseInt(RSInterface.getChildInterface(408,14).getText());
        			sep = Integer.parseInt(RSInterface.getChildInterface(408,15).getText());
        			swp = Integer.parseInt(RSInterface.getChildInterface(408,16).getText());
        			
        		}
        		portalname = "null!";
        		//boolean skip = false;
        		//int myrand;
        		if(p4match){
        			//myrand=10;
        		} else {
        			//myrand = random(1,4);
        		}
        		//log("Random portal = "+ myrand);
        		if(eastp>=40){//&& closeportal("eastp")){
        			portalname = "East";
        			//if(myrand==1){
        				//skip = true;
        				//p4match = true;
        				
        			//}
        		}
        		if(sep>=40){ //&& !(skip) && closeportal("sep")){
        			portalname = "South East";
        			//if(myrand==2){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(swp>=40){ //&& !(skip) && closeportal("swp")){
        			portalname = "South West";
        			//if(myrand==3){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(westp>=40){ // && !(skip) && closeportal("westp")){
        			//if(myrand==4){
        				//skip = true;
        				//p4match = true;
        			//}
        			portalname = "West";
        		}
        		if(!(portalname=="null!")&&realwalk){
        			walktoportal(portalname);
        		} else if(!(portalname=="null!")){
        			return true;
        		}
        		else return false;
        	}
        	return true;
        }
    
    	public boolean abletoattack() {
          return(getMyPlayer().getInteracting() == null);	
        }
        
        public int getSpec() {
    		return getSetting(300)/10;
    	}
        
        public boolean prayerenabled() {
    		return getSetting(1396)>0;
    	}
    
    	boolean specEnabled() {
    		return (getSetting(301)) == 1;
    	}
    
    	void doSpec() {
    		if(onisland()){
    			if (getSpec() == 100 && !specEnabled() && usespec) {
    				openTab(Constants.TAB_ATTACK);
    				clickMouse(645 + random(0, 4), 425 + random(0, 4), true);
    				wait(random(500, 1000));
    			} else {
    				wait(random(10, 50));
    			}
    		}
    	}
    
        
        public boolean cangetonboat(String boat) {
        	return !(RSInterface.getInterface(243).isValid()) || !(RSInterface.getInterface(211).isValid() || !RSInterface.getInterface(242).isValid()); 	
        }
        
        public boolean notbuyarmour() {
        	if(buytop&&!(topbuy)){
        		return false;
        	}
        	if(buybottom&&!(bottombuy)){
        		return false;
        	}
        	if(buygloves&&!(glovesbuy)){
        		return false;
        	}
        	if(buymace&&!(macebuy)){
        		return false;
        	}
        	return true;
        }
        
        public boolean canaffordanitem() {
        	if(pcpoints>=150){
        		if(buygloves&&!glovesbuy) {
        			return true;
        		}
        	}
        	if(pcpoints==250){
        		if(buybottom&&!bottombuy) {
        			return true;
        		}
        		if(buytop&&!topbuy) {
        			return true;
        		}
        	}
        	return false;
        }
        
        public int gettheskill(String skill) {
        	if(tskill=="Melee"){	
    			if(skill=="Att"){
    				cons = Constants.STAT_ATTACK; 
    			}
    			if(skill=="Str"){
    				cons = Constants.STAT_STRENGTH;
    			}
    			if(skill=="Def"){
    				cons = Constants.STAT_DEFENSE;
    			}
    		} else if(skill=="Mage"){
    			cons = Constants.STAT_MAGIC;
    		} else if(skill=="Range"){
    			cons = Constants.STAT_RANGE;
    		} 
        	return  skills.getCurrentSkillLevel(cons);
        }
        
        public boolean canbuysomething() {
          if(logfullz&&pcpoints>=250-boatp+1){
        	  log("Have full points, ending script");
        	  stopScript(true);
          }
          if(logfullz) {
        	  return false;
          }
          if(pcpoints>=100&&buyskills&&notbuyarmour()){
        	  return true;
          }
          if(!notbuyarmour()) {
        	if(canaffordanitem()){
        		return true;
        	}
          }
          if(!logfullz &&pcpoints>=250-boatp+1 ){
        	  log.warning("Can not buy because your boat points wont add up to desired item");
        	  stopScript(true);
          }
          return false;
        }
        
        public void DoExchange() {
        	RSNPC knight;
        	if(outsideboat()){
        		for (int i = 0; i < topoints.length; i++) {
        			if(getNearestNPCByName("Void Knight").isOnScreen()){
        				break;
        			}
        			wait(random(1000,2500));
        			flags();
        			walkPathMM(topoints);
        		}
        		knight = getNearestNPCByName("Void Knight");
        		if(!(knight==null)){
        			if(!getNearestNPCByName("Void Knight").isOnScreen()){
        				walkTo(knight.getLocation());
        				waitToMove(2000);
            			flags();
        			}
        			atNPC(getNearestNPCByID(3788), "change");
        			wait(random(500,800));
        			flags();
        			wait(random(5000,8000));
        			SpendingPoints();
        		}
        	}    	
        }
        
        public boolean doslider(){
        	if (RSInterface.getInterface(267).isValid()) {	
        		clickMouse(random(473,483),random(180,195),true);
        		wait(random(4000,5000));
        		return true;
        	}
        	return false;
        }
        
        public void confirms() {
        	if (RSInterface.getInterface(267).isValid()) {	
        		atInterface(RSInterface.getInterface(267).getChild(101));
        		wait(random(4000,5000));
        	}
        }
        
        public void SpendingPoints() {
    		if (RSInterface.getInterface(267).isValid()) {				
    			if (skilltobuy == "Attack") { 
    				atInterface(RSInterface.getInterface(267).getChild(56));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Strength") { 
    				atInterface(RSInterface.getInterface(267).getChild(57));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Defence") { 
    				atInterface(RSInterface.getInterface(267).getChild(58));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Ranged") { 
    				atInterface(RSInterface.getInterface(267).getChild(59));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Magic") { 
    				atInterface(RSInterface.getInterface(267).getChild(60));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Hitpoints") { 
    				atInterface(RSInterface.getInterface(267).getChild(61));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Prayer") { 
    				atInterface(RSInterface.getInterface(267).getChild(62));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if(!notbuyarmour()) {
    		    	if(canaffordanitem()){
    		    		if(pcpoints>=150){
    		        		if(buygloves&&!glovesbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(44));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				glovesbuy = true;
    		        		}
    		        	}
    		        	if(pcpoints==250){
    		        		if(buybottom&&!bottombuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(43));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				bottombuy = true;
    		        		}
    		        		if(buytop&&!topbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(42));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				topbuy = true;
    		        		}
    		        		if(buymace&&!(macebuy)){
    		        			atInterface(RSInterface.getInterface(267).getChild(41));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				macebuy = true;
    		            	}
    		        	}
    		    	}
    		      }
    		} else {
    			atNPC(getNearestNPCByID(3788), "change");
    			wait(random(1000, 2000));
    		}
    	}
    
        
        public boolean died() {
        	if(inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getX(),topleftbb.getX(),topleftbb.getY(),bottomrightbb.getX(),bottomrightbb.getY())){
        		walkd = false;
        		return true;
        	}
        	return false;
        }
        
        public boolean byaportal() {
        	if(onisland()){
        		final RSNPC portal = getNearestNPCByName("Portal");
        		if(!(portal==null)){
        			if(distanceTo(portal.getLocation())>5){
        				return false;	
        			}
        			else return true;
        		}
        	}
        	return false;
        }
        
        public boolean shouldattack(){
        	if(walktoaportal(false) && !gotzealforround()) {
        		return true;
        	}
        	if(walktoaportal(false)){
        		return true; 
        	}
        	return walktoaportal(false) && !gotzealforround(); 
        }
        
        public boolean fights() {
        	if(onisland()){
        		RSNPC Me,Portal = null;
        		String[] me;
        		ArrayList<String> attz = new ArrayList<String>();
        		attz.add("Attack");
        		boolean mee = false;
        		int I;
        		if(!defendk){
        			//Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
        			Me = getNearestNPCByName(ta);
        		} else {
        			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
        		}
        		if(attportals){
        			Portal = getNearestNPCToAttackByName("Portal");	
    	    		if(!(Portal==null)){
    	    			me =Portal.getActions(); 
    	    			for(I=0; I < me.length; I++){
    	    				//log(me[I]);
    	    				if(attz.contains(me[I])){
    	    					mee=true;
    	    				}
    	    			}
    	    		}
    	    		if(!mee){
    					Portal = null;
    				}
        		}
        		
        		if(attportals&&(Portal != null)&&Portal.isOnScreen() && shouldattack()){
        			if(getMyPlayer().getInteracting() == null && (Portal != null) && Portal.isOnScreen()) {
        				try {
        					if(atNPC(Portal, "Attack Por")) {
        						wait(random(500,1000));
        						flags();
        						return true;
        					} else {
        						status = "Doing antiban";
        						antiban2();
        					}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		} else {
        			if(getMyPlayer().getInteracting() == null && (Me != null) && Me.isOnScreen() && shouldattack()) {
        				try {
    	    				if(atNPC(Me, "Attack " + Me.getName())) {
    	    					wait(random(500,1000));
    	    					flags();
    	    					return true;
    	    				} else {
    	    					status = "Doing antiban";
    	    					antiban2();
    	    					if(!defendk){
    	    		    			//RSNPC Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
    	    		    			Me = getNearestNPCByName(ta);
    	    		    		} else {
    	    		    			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
    	    		    		}
    	    					if(!(Me==null)&&Me.isOnScreen()) {
    	    						return true;
    	    					}
    	    				}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		}
        	}
        	return false;
        }
         
        public RSInterfaceChild getPrayerInterface() {
    		if (Bot.getClient().getRSInterfaceCache() == null) {
    			return null;
    		}
    		final RSInterface iface = RSInterface.getInterface(749);
    		final RSInterfaceChild child = iface.getChild(4);
    		
    		return child;
    	}
        
        public boolean DoQuickPrayers() {
        	int prayerp;
        	if(onisland()){
        		prayerp = Integer.parseInt(RSInterface.getChildInterface(749,4).getText());
        		if(!prayerenabled()) {
        			if(prayerp>0&&useqp){
        				final RSInterfaceChild cont = getPrayerInterface();
        				return (atInterface(cont));	
        			}
        		}
        	}
    		return false;
        	
        }
        
        public boolean enterboat() {
        	wait(random(2000,4000));
        	final RSInterface IFACE = RSInterface.getInterface(243);
    		final RSInterface IFACE2 = RSInterface.getInterface(211);
    		if (IFACE.isValid()) {
        		zealgained = zealgained + boatp;
    		} else if (IFACE2.isValid()) {
    			loz++;
        	}
        	if(!tileOnScreen(laddertile)) {
    			if(!tileOnMap(laddertile)&& !getMyPlayer().isMoving()){
    				walkPathMM(toboat, 10);
    			} else {
    				if(!getMyPlayer().isMoving()){
    					walkTo(laddertile);
    				}
    			}
    		} else {
    			final RSObject ladderid = getNearestObjectByID(ladderd);
    			if (ladderid != null && !insideboat() && !canbuysomething()) {
    				status = "Entering Boat";
    				wait(random(700,2400));
    				atObject(ladderid, "Cross");
    				wait(random(1000,2000));
    				if(!insideboat()){
    					wait(random(1000,1500));
    					atObject(ladderid, "Cross");
    					wait(random(1000,2000));
    				}
    				if(!insideboat()&& !cangetonboat("novice")){
    					return false;
    				}	
    			} else {
    				if(!insideboat()&& !cangetonboat("novice")){
    					//log("Failed to board boat");
    					return false;
    				}	
    			}
    		}
        	return false;
        }
        
    	@Override
    	public int loop() {
    		if(!firstlogin){
    			wait(random(3000,5000));
    			firstlogin = true;
    		}
    		wait(random(400,600));
    		setCameraAltitude(true);
    		if(startlvl==0){
    			if(tskill=="Mage"){
    				tskilld = tskill;
    			} else if(tskill=="Range"){
    				tskilld = tskill;
    			}
    			startlvl = gettheskill(tskilld);
    			
    		}		
    		if(outsideboat()){
    			if(canbuysomething()&&!insideboat()){
    				DoExchange();
    			}
    			walkd = false;
    			mappedisland = false;
    			setangleisland = false;
    			knighttile = new RSTile (0,0);
    			toplefttile = new RSTile (0,0);
    			bottomrighttile = new RSTile (0,0);
    			newround = true;
    			p4match = false;
    			enterboat();
    		}
    		if(insideboat()){
    			mappedisland = false;
    			walkd= false;
    			newround = true;
    			setangleisland = false;
    			p4match = false;
    			status = "Waiting on boat.";
    			return antiban();
    		}
    		
    		if(onisland()){
    			status = "Fighting!!!";
    			if(!setangleisland){
    				setRun(true);
    				setFightMode(dfightm);
    				wait(random(200,300));
    				setangleisland=true;
    			}
    			if(!mappedisland){
    				mapisland();		
    			}
    			//if(!walkd || died()) {
    				//walktoaportal();
    			//}	
    			
    			DoQuickPrayers();
    			doSpec();
    			if(defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && (getMyPlayer().getInteracting() == null)){
    						if(!byknight()){
    							walktoknight();
    						}
    					  }
    					}
    				} else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}
    			}
    			if(!defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && !byaportal() && (getMyPlayer().getInteracting() == null)){
    						if(!getMyPlayer().isMoving()) {
    							walktoaportal(true); 
    						}
    					}
    				}else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}				
    			}
    
    		return 200;
    	}
    		
    	
    
    
    
    	@Override
    	public boolean onStart(final Map<String, String> args) {
    		wtbs = args.get("wtbs");
    		knighttile = new RSTile (0,0);
    		toplefttile = new RSTile (0,0);
    		bottomrighttile = new RSTile (0,0);
    		final gui gui = new gui();
    		gui.setVisible(true);
    		try {
    			log("Checking for updates");
    			// Open the version text file
    			URLConnection url = new URL("http://www.zaszmedia.com/scripts/zpc/version.txt").openConnection();
    			// Create an input stream for it
    			BufferedReader reader = new BufferedReader(new InputStreamReader(url.getInputStream()));
    			// Check if the current version is out dated
    			if (Double.parseDouble(reader.readLine()) > version){
    				outdated = true;
    				log("You have an old version of the script!");
    				log("You can update by visiting http://www.rsbot.org/vb/showthread.php?t=177106");
    			} else {
    				outdated = false;
    				log("You have the latest version of the script!");
    			}
    			if (reader != null)
    				reader.close();
    		} catch (IOException e) {
    			Bot.getEventManager().removeListener(PaintListener.class, this);
    			log("Problem getting version.");
    			stopScript();
    		}
    
    		while (!startScript) {
    			wait(20);
    		}
    		return true;
    	}
    
    	
    	public boolean inAreza(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
    
    	
    	public int optionpaint() {
    		Mouse m = Bot.getClient().getMouse();
    		//bottom left then top right
    		if (inArea(m.x,m.y,560+50,226-60,560,226-10)) {
                return  1;
            }
            if (inArea(m.x,m.y,560+110,226-60,560+51,226-10)) {
            	return  2;
            }
            if (inArea(m.x,m.y,560+170,226-60,560+111,226-10)) {
            	return  3;
            }
    		return 0;
    	}
    	
    	// final int x = 300-50; orig
    	//int y = 16+75; orig
    	//g.fill3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.draw3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.setColor(new Color(60, 140, 200, 50)); orig
    	
    	public void onRepaint(Graphics g) {
            if (isLoggedIn()) {	
                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;
                
                final int x = 560;
    			int y = 226;
    			
    			if(newround && onisland()){
    				gamesplayed = gamesplayed + 1;
    				newround = false;
    			}
    			if(!(startlvl==0)){
    				gettheskill(tskilld);
    				startEXP = skills.getCurrentSkillExp(cons);
    			}
    			if(optionpaint()==0){
    				g.setColor(new Color(0, 0, 0, 175));	//new
    				g.fillRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				
    			}
    			if(optionpaint()==1){	
    				
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				if(onisland()){
    					g.drawString("Games played:"+ (gamesplayed-1), x, y);
    				} else {
    					g.drawString("Games played:"+gamesplayed, x, y);
    				}
    				if(pcpoints>0){
    					y = y + 16;
    					g.drawString("PCP Gained: "+zealgained+" Total PCP: "+pcpoints, x, y);	
    				} else {
    					y = y + 16;
    					g.drawString("PC Points Gained: "+zealgained, x, y);
    				}
    				y = y + 16;
    				if(onisland()&&gamesplayed>0){
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+ ((gamesplayed-1) - (zealgained/2)+ " Lack of Z: " + loz), x, y);
    				} else {
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+(gamesplayed - (zealgained/2) + " Lack of Z: " + loz), x, y);
    				}
    			}
    			if(optionpaint()==2){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y +16;
    				g.drawString("Using: "+tskill+" Skill: "+tskilld, x, y);
    				y = y + 16;
    				g.drawString("Start "+tskilld+" lvl: "+startlvl+" Current lvl: "+gettheskill(tskilld), x, y);
    			}
    				//if(!(knighttile.getX()==0)){
    					//y = y + 16;
    					//g.drawString("Knight tile: " + knighttile.getX()+","+knighttile.getY(), x, y);
    				//}
    			if(optionpaint()==3){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				g.drawString("Boat Kind:"+ boattb , x, y);
    				if(!(amode=="Mage")){
    					if(usespec){
    						y = y + 16;
    						g.drawString("Set to use spec when able", x, y);
    					}
    				}
    				if(!(knighttile.getX()==0)){
    					y = y + 16;
    					g.drawString("Earned Zeal for round "+gotzealforround(), x, y);
    					
    				}
    				if(onisland()){
    					y = y + 16;
    					g.drawString("By a portal: "+ byaportal(), x, y);
    					y = y + 16;
    					y = y + 16;
    					g.drawString("Island Tile: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()), x, y);
    				}
    			}
            } 
        }
    }
    
    Zasz's PC script, made by a very good script writer.
    He has the best auto enchanter out there and Out of 600 games of PC, I've gotten no points 7 times.
     
  13. Unread #7 - Mar 6, 2010 at 9:31 PM
  14. Tigerz
    Joined:
    Dec 24, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Tigerz Member

    Whats the best FREE pest control bot?

    Code:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Map;
    
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.SwingConstants;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    
    import org.rsbot.bot.Bot;
    import org.rsbot.bot.input.Mouse;
    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.RSInterfaceChild;
    import org.rsbot.script.wrappers.RSNPC;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    
    
    
    
    
    @ScriptManifest(authors = { "Zasz" }, category = "Combat", name = "Zasz's Pest Control", version = 1.00, description = "<html><head>"
    	+ "</head><body>"
    	+ "<center><strong><h2>Zasz's Pest Control!</h2></strong></center>"
    	+ "<center></center><br />"
    	+ "<br>"
    	+ " <center><B>Click start for the GUI!.</b>"
    	+ "<strong></strong>" 
    	+ "</center><br>"
    	+ "</body></html>")
    
    public class ZaSzPC extends Script implements PaintListener {
    	public long startTime = System.currentTimeMillis();
    	public long tsa,tsw;
        boolean hasset, buys,buymace,buytop,buybottom,buygloves,buyskills,mappedisland,firstlogin,setangleisland;
        boolean macebuy,topbuy,bottombuy,glovesbuy;
        boolean newround,usespec, logfullz, outdated, walkd, attportals, useqp, defendk, p4match;
        boolean makep =  true;
        public boolean startScript = false;
        private String status = "";
        String wtbs,portalname;
        String tskill, amode,tskilld, skilltobuy, helmtobuy, boattb;
        int dfightm, startlvl,gamesplayed, pcpoints, cons, startEXP, Location,ladderd,boatp,loz;
    	long eph;
    	int lastportalopend,portalid;
        int zealgained = 0;
        int westp,eastp,sep,swp;
        int[] monsters = {3734,3735,3733};
        String[] wtb, ta;
        RSTile knighttile, boattilen, boattiles;
        RSTile rocktile,bottomrighttile,toplefttile,battlefield;
        RSTile bottomrightk,topleftk, bottomrightbb, topleftbb;
        RSTile laddertile;
        RSTile portaltw;
        String cp = "";
        public double version = 1.5;
    	private RSTile[] path,toboat,topoints;
    
        public class gui extends JFrame 
        { 
        	/**
    		 * 
    		 */
    		private static final long serialVersionUID = 1337L;
    		// Variables declaration 
        	private JTabbedPane jTabbedPane1; 
        	private JButton jButton1; 
        	private JPanel contentPane; 
        	//----- 
        	private JLabel jLabel2; 
        	private JLabel jLabel5; 
        	private JLabel jLabel6; 
        	private JPanel jPanel1; 
        	//----- 
        	private JLabel jLabel7; 
        	private JLabel jLabel8; 
        	private JLabel jLabel9; 
        	private JLabel jLabel10; 
        	private JLabel jLabel12; 
        	private JComboBox jComboBox1; 
        	private JComboBox jComboBox2; 
        	private JComboBox jComboBox3;
        	private JComboBox jComboBox4;
        	private JComboBox jComboBox5; // Boat
        	private JCheckBox jCheckBox3;  
        	private JCheckBox jCheckBox4; 
         	private JCheckBox jCheckBox5; 
         	private JCheckBox jCheckBox6;// Att portal 
         	private JCheckBox jCheckBox7; // Use quick Prayer
         	private JCheckBox jCheckBox8; // Defend Knight
        	private JPanel jPanel2; 
        	//----- 
        	private JPanel jPanel3; 
        	//----- 
        	private JPanel jPanel4; 
        	
        	private JRadioButton jRadioButton1; 
         	private JRadioButton jRadioButton2; 
         	private JRadioButton jRadioButton3; 
         	private JRadioButton jRadioButton4; 
         	private JRadioButton jRadioButton5; 
         	private JRadioButton jRadioButton6; 
         	private JRadioButton jRadioButton7; 
         	private JRadioButton jRadioButton8; 
         	private JRadioButton jRadioButton9; 
         	private JRadioButton jRadioButton10; 
         	private JRadioButton jRadioButton11; 
        	// End of variables declaration 
         
         
        	public gui() 
        	{ 
        		super(); 
        		initializeComponent(); 
        		
         
        		this.setVisible(true); 
        	} 
         
        	/** 
        	 * This method is called from within the constructor to initialize the form. 
        	 * WARNING: Do NOT modify this code. The content of this method is always regenerated 
        	 * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
        	 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
        	 * to retrieve your design properly in future, before revising this method. 
        	 */ 
        	private void initializeComponent() 
        	{ 
        		jTabbedPane1 = new JTabbedPane(); 
        		jButton1 = new JButton(); 
        		contentPane = (JPanel)this.getContentPane(); 
        		//----- 
        		jLabel2 = new JLabel(); 
        		jLabel5 = new JLabel(); 
        		jLabel6 = new JLabel(); 
        		jPanel1 = new JPanel(); 
        		jCheckBox3 = new JCheckBox(); 
        		//----- 
        		jLabel7 = new JLabel(); 
        		jLabel8 = new JLabel(); 
        		jLabel9 = new JLabel();
        		jLabel10 = new JLabel();
        		jLabel12 = new JLabel();
        		jComboBox1 = new JComboBox(); 
        		jComboBox2 = new JComboBox(); 
        		jComboBox3 = new JComboBox(); 
        		jComboBox4 = new JComboBox();
        		jComboBox5 = new JComboBox();
        		jPanel2 = new JPanel();
        		jCheckBox4 = new JCheckBox(); 
         		jCheckBox5 = new JCheckBox(); 
         		jCheckBox6 = new JCheckBox();
         		jCheckBox7 = new JCheckBox();
         		jCheckBox8 = new JCheckBox();
        		jRadioButton1 = new JRadioButton(); 
         		jRadioButton2 = new JRadioButton(); 
         		jRadioButton3 = new JRadioButton();
         		jRadioButton4 = new JRadioButton(); 
        		jRadioButton5 = new JRadioButton();
        		jRadioButton6 = new JRadioButton();
        		jRadioButton7 = new JRadioButton();
        		jRadioButton8 = new JRadioButton();
        		jRadioButton9 = new JRadioButton();
        		jRadioButton10 = new JRadioButton();
        		jRadioButton11 = new JRadioButton();
        		//----- 
        		jPanel3 = new JPanel(); 
        		//----- 
        		jPanel4 = new JPanel();
        		// 
        		// jTabbedPane1 
        		// 
        		jTabbedPane1.addTab("Description", jPanel1); 
        		jTabbedPane1.addTab("Combat Options", jPanel2); 
        		jTabbedPane1.addTab("Island Options", jPanel4); 
        		jTabbedPane1.addTab("Zeal Options", jPanel3); 
        		jTabbedPane1.addChangeListener(new ChangeListener() { 
        			public void stateChanged(ChangeEvent e) 
        			{ 
        				jTabbedPane1_stateChanged(e); 
        			} 
         
        		}); 
        		// 
        		// jButton1 
        		// 
        		jButton1.setText("Start Script!"); 
        		jButton1.addActionListener(new ActionListener() { 
        			public void actionPerformed(ActionEvent e) 
        			{ 
        				jButton1_actionPerformed(e); 
        			} 
         
        		}); 
        		// 
        		// contentPane 
        		// 
        		contentPane.setLayout(null); 
        		addComponent(contentPane, jTabbedPane1, 0,0,373,221); 
        		addComponent(contentPane, jButton1, 124,240,106,28); 
        		// 
        		// jLabel2 
        		// 
        		jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); 
        		jLabel2.setHorizontalTextPosition(SwingConstants.LEADING); 
        		jLabel2.setText("ZaSz\'s Pest Control: By ZaSz"); 
        		// 
        		// jLabel5 
        		// 
        		jLabel5.setText("Start this script either at Pest Control bank. Or near the landers!"); 
        		// 
        		// jLabel6 
        		// 
        		jLabel6.setText("Make sure to fill out all the options! Or this script won\'t work for you!"); 
        		// 
        		// jPanel1 
        		// 
        		jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel1.add(jLabel2, 0); 
        		jPanel1.add(jLabel5, 1); 
        		jPanel1.add(jLabel6, 2); 
        		jPanel1.setOpaque(true); 
        		// 
        		// jLabel7 
        		// 
        		jLabel7.setText("Combat Style"); 
        		// 
         		// jLabel8 
         		// 
         		jLabel8.setText("Attack style "); 
         		// 
         		// jLabel9 
         		// 
         		jLabel9.setText("Skill to buy");
         		// 
         		// jLabel10 
         		// 
         		jLabel10.setText("Boat to use:    ");
         		// 
         		// jCheckBox3 
         		// 
         		jCheckBox3.setText("Use special Attacks when applicable? (Range/Melee only)"); 
         		// jCheckBox4 
         		// 
         		jCheckBox4.setText("logout at full zeal (Can't buy anything else if you pick)"); 
         		// 
         		// jCheckBox5 
         		// 
         		jCheckBox5.setText("Use Zeal to buy skills.    ");
         		// 
         		// jCheckBox6 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox7
         		// 
         		jCheckBox7.setText("Use Quick Prayer.       "); 
         		// 
         		// jCheckBox8
         		// 
         		jCheckBox8.setText("Defend the knight instead of portals.  "); 
         		// 
         		// jRadioButton1 
         		// 
         		//(Use dropdown box to select)
         		jRadioButton1.setText("Buy a helm  (Helms/Void armour not able this version)"); 
         		// 
         		// jRadioButton2 
         		// 
         		jRadioButton2.setText("Buy Void Top"); 
         		// 
         		// jRadioButton3 
         		// 
         		jRadioButton3.setText("Buy Void Bottom"); 
         		// 
         		// jRadioButton4 
         		// 
         		jRadioButton4.setText("Buy Void Gloves"); 
         		// 
         		// jRadioButton5 
         		// 
         		jRadioButton5.setText("Buy Void Mace         "); 
        		// 
        		// jComboBox1 
        		// 
        		jComboBox1.addItem("Melee"); 
        		jComboBox1.addItem("Range"); 
        		jComboBox1.addItem("Mage"); 
        		// 
         		// jComboBox2 
         		// 
         		jComboBox2.addItem("Accurate (Att/Range/Mage)"); 
         		jComboBox2.addItem("Strength/Rapid (Str/Range/Mage)"); 
         		jComboBox2.addItem("Defensive (Def/Def+range/Def+Mage"); 
         		// 
         		// jComboBox3 
         		// 
         		jComboBox3.addItem("Attack"); 
         		jComboBox3.addItem("Strength"); 
         		jComboBox3.addItem("Defence"); 
         		jComboBox3.addItem("Ranged"); 
         		jComboBox3.addItem("Magic"); 
         		jComboBox3.addItem("Hitpoints"); 
         		jComboBox3.addItem("Prayer"); 
         		
         		//
         		// jComboBox4
         		//
         		jComboBox4.addItem("Mage helm");
         		jComboBox4.addItem("Melee helm");
         		jComboBox4.addItem("Range helm");	
         		//
         		// jComboBox5
         		//
         		jComboBox5.addItem("Novice Boat");
         		jComboBox5.addItem("Intermediate Boat");
         		jComboBox5.addItem("Expert Boat");
        		// 
        		// jPanel2 
        		// 
         		jPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel2.add(jLabel7, 0); 
         		jPanel2.add(jComboBox1, 1); 
         		jPanel2.add(jCheckBox7,2);
         		jPanel2.add(jCheckBox3, 3); 
         		jPanel2.add(jLabel8, 4); 
         		jPanel2.add(jComboBox2, 5);
        		// 
        		// jPanel3 
        		// 
        		jPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel3.add(jCheckBox4, 0); 
         		jPanel3.add(jCheckBox5, 1); 
         		//jPanel3.add(jRadioButton1, 2); 
         		jPanel3.add(jRadioButton2, 2); 
         		jPanel3.add(jRadioButton3, 3); 
         		jPanel3.add(jRadioButton4, 4); 
         		jPanel3.add(jRadioButton5, 5); 
         		jPanel3.add(jLabel9, 6); 
         		jPanel3.add(jComboBox3, 7); 
         		//jPanel3.add(jComboBox4,9);
         		
         		/////////////////////////////////////////////////////////////////
         	// 
         		// jLabel1 
         		// 
         		jLabel10.setText("Boat To Use"); 
         		// 
         		// jLabel2 
         		// 
         		jLabel12.setText(" Monsters to Attack:  MUST HAVE SHIFTER IF DEFENDING KNIGHT!!!!          "); 
         		// 
         		// jCheckBox1 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox2 
         		// 
         		jCheckBox8.setText("Defend Knight instead of portals"); 
         		// 
         		// jRadioButton1 "Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter"
         		// 
         		jRadioButton6.setText("  Spinner"); 
         		jRadioButton6.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton7.setText("Shifter"); 
         		jRadioButton7.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton8.setText("Torcher"); 
         		jRadioButton8.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton9.setText("Defiler"); 
         		jRadioButton9.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton10.setText("Brawler");
         		jRadioButton10.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton11.setText("Splatter"); 
         		jRadioButton11.setSelected(true);
         		////////////////////////////////////////////////////////////////////////
         		// 
        		// jPanel4  (ISLAND OPTIONS)
        		// 
         		jPanel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel4.add(jLabel10,0);
         		jPanel4.add(jComboBox5, 1); 
         		jPanel4.add(jCheckBox6, 2); 
         		jPanel4.add(jCheckBox8, 3); 
         		jPanel4.add(jLabel12, 4); 
         		jPanel4.add(jRadioButton6, 5); 
         		jPanel4.add(jRadioButton7, 6); 
         		jPanel4.add(jRadioButton8, 7); 
         		jPanel4.add(jRadioButton9, 8); 
         		jPanel4.add(jRadioButton10, 9); 
         		jPanel4.add(jRadioButton11, 10); 
         		
         		//jPanel4.add(, 4); 
         		//jPanel4.add();
        		// 
        		// gui 
        		// 
        		this.setTitle("Zasz\'s Pest Control!"); 
        		this.setLocation(new Point(168, 107)); 
        		this.setSize(new Dimension(395, 311)); 
        	} 
         
        	/** Add Component Without a Layout Manager (Absolute Positioning) */ 
        	private void addComponent(Container container,Component c,int x,int y,int width,int height) 
        	{ 
        		c.setBounds(x,y,width,height); 
        		container.add(c); 
        	} 
         
        	
        	private void jTabbedPane1_stateChanged(ChangeEvent e) 
        	{ 
        		System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called."); 
      
        	} 
      
        	
        	private void jButton1_actionPerformed(ActionEvent e) 
        	{ 
        		System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); 
         
        		amode = jComboBox2.getSelectedItem().toString(); 
        		tskill = jComboBox1.getSelectedItem().toString();
        		Location = jComboBox1.getSelectedIndex();
        		usespec = jCheckBox3.isSelected();
        		buyskills = jCheckBox5.isSelected();
        		logfullz = jCheckBox4.isSelected();
        		//logfullz = true;
             	//int leng = 0;	
             	//if(jRadioButton6.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton7.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton8.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton9.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton10.isSelected()){
             ///		leng++;
        		//}
        		//if(jRadioButton11.isSelected()){
        		//	leng++;
        		//}
        		ArrayList<String> monsterztoatt = new ArrayList<String>();
    
        		if(jRadioButton6.isSelected()){
        			monsterztoatt.add("Spinner");
        		}
        		if(jRadioButton7.isSelected()){
        			monsterztoatt.add("Shifter");
        		}
        		if(jRadioButton8.isSelected()){
        				monsterztoatt.add("Torcher");
        			}
        		if(jRadioButton9.isSelected()){
        			monsterztoatt.add("Defiler");
        		}
        		if(jRadioButton10.isSelected()){
        			monsterztoatt.add("Brawler");
        		 }
        		if(jRadioButton11.isSelected()){
        			monsterztoatt.add("Splatter");
        		}
        		ta = monsterztoatt.toArray( new String[ monsterztoatt.size() ] );
        		if(!buyskills){
        			logfullz = true;
        		}
        		defendk = jCheckBox8.isSelected();
        		attportals = jCheckBox6.isSelected();
        		useqp = jCheckBox7.isSelected();
        		boattb = jComboBox5.getSelectedItem().toString();
        		if(boattb=="Novice Boat"){
        			ladderd = 14315;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2657, 2640)} ;
        			boattiles = new RSTile (2663, 2638); //SE
        			boattilen = new RSTile (2660, 2643); //NW
        			laddertile = new RSTile (2657,2639);
        			boatp = 2;
        		}
        		if(boattb=="Intermediate Boat"){
        			ladderd = 25631;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2644, 2644)} ;
        			boattiles = new RSTile (2641, 2642); //SE
        			boattilen = new RSTile (2638, 2647); //NW
        			laddertile = new RSTile (2644,2644);
        			boatp = 3;
        		}
        		if(boattb=="Expert Boat"){
        			ladderd = 25632;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2638, 2653)} ;
        			boattiles = new RSTile (2635, 2649); //SE
        			boattilen = new RSTile (2632, 2654); //NW
        			laddertile = new RSTile (2638,2653);
        			boatp = 4;
        		}
        		topoints = reversePath(toboat);
        		if(amode=="Accurate (Att/Range/Mage)"){
        			dfightm = 0;
        			tskilld = "Att";
        		} else
        		
        		if(amode=="Strength/Rapid (Str/Range/Mage)"){
        			dfightm = 1;
        			tskilld = "Str";
        		} else
        		if(amode=="Defensive (Def/Def+range/Def+Mage"){
        			if(!(tskill=="Range") || !(tskill=="Mage")){
        				dfightm = 3;
        			} else
        				dfightm = 2;
        			tskilld = "Def";
        		} else {		
        			tskilld=amode;			
        		}
        		
        		if(buyskills){
        			  skilltobuy = jComboBox3.getSelectedItem().toString();
        			  log("Buying: "+skilltobuy);
        		}
        		;
        		if(jRadioButton1.isSelected()){
        			helmtobuy = jComboBox4.getSelectedItem().toString();
        			//buyhelm = false; //delete when implemented TODO
        			//log("Buying: "+helmtobuy);
        		}
        		if(jRadioButton2.isSelected()){
        			buytop = true;
        			log("Buying: top");
        		}
        		if(jRadioButton3.isSelected()){
        			buybottom = true;
        			log("Buying: bottom");
        		}
        		if(jRadioButton4.isSelected()){
        			buygloves = true;
        			log("Buying: gloves");
        		}
        		if(jRadioButton5.isSelected()){
        			buymace = true;
        			buymace = false; //delete when implemented TODO
        			log("Buying: mace");
        			
        		}
        		
        		
    		
        		
        		
        		
        		
        		
        		
        		
    
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		//if(leng==0){
        		// log("Must select a monster to attack!");	
        		//} else {
        			setVisible(false);
        			startScript = true;
        			//}
        	} 
       
        }
        
        public boolean outsideboat() {
        	return distanceTo(laddertile)<40;
        }
        
        public boolean insideboat() {
        	final RSInterface IFACE = RSInterface.getInterface(407);
        	//if (pcpoints==0){
        	
        		if (IFACE.isValid()) {
        			String interfacet;
        			interfacet = RSInterface.getChildInterface(407,16).getText();
        			int interfacel,source,tempzeal;
        			interfacel = interfacet.length();
        			source = interfacet.indexOf(":");
        			String pointtext;
        			pointtext = interfacet.substring(source+2, interfacel);
        			tempzeal = Integer.parseInt(pointtext);
        			if(!(tempzeal==pcpoints)){
        				pcpoints = tempzeal;
        			}
        		}
        	//}
        	return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),boattiles.getX(),boattiles.getY(), boattilen.getX(), boattilen.getY());
        }
        
        public boolean onisland() {
        	if(!mappedisland){
        		final RSObject rock = getNearestObjectByID(5605);
        		if (rock != null) {
        			//log(""+rock.getLocation().getX()+","+rock.getLocation().getY()+" Distance:"+distanceTo(rock.getLocation()));
        			return distanceTo(rock.getLocation())<10;	
        		} else {
        			return false;
        		}
        	} else {
        		return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),toplefttile.getX(),toplefttile.getY(),bottomrighttile.getX(),bottomrighttile.getY());
        	}
        }
        
        public boolean inArea(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
        
        public String between(String main,String s1, String s2) {
        	  
        	  int length=s1.length();
    
        	  return main.substring(length,main.indexOf(s2,length));
    
        }
        
        public boolean gotzealforround() {
        	final RSInterface IFACE = RSInterface.getInterface(408);
        	if (IFACE.isValid()) {
        		return Integer.parseInt(RSInterface.getChildInterface(408,11).getText())>49;
        	} else
        		return false;
        }
        
        
        public void onFinish() {
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    	}
    
        
        public boolean flags() {
        	if(getMyPlayer().isMoving()){
        		long st = System.currentTimeMillis();
        		RSTile tile = getMyPlayer().getLocation();
        		while(System.currentTimeMillis() - st < 2000){
        			if(!tile.equals(getMyPlayer().getLocation())){
        				st = System.currentTimeMillis();
        	                        tile = getMyPlayer().getLocation();
        			}
        		}
        	} else {
        		return false;
        	}
        	return true;
        }
        
        public int antiban() {
        	final int randomNum = random(1, 18);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(4, 750);
    			final int y = random(4, 500);
    			moveMouse(x, y);
    			return random(1000, 1500);
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return random(500, 750);
    			} else {
    				return random(500, 750);
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return random(750, 1000);
    			}
    			if (getCurrentTab() != Constants.TAB_STATS) {
    				openTab(Constants.TAB_STATS);
    			}
    			moveMouse(560, 230, 40, 180);
    			wait(random(1000, 2000));
    			return random(500, 1500);
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return random(500, 750);
    			}
    		}	
    		return random(200,2000);
        }
        
        public void antiban2() {
        	if(!shouldattack()){
        		status = "Waiting Till end of round!";
        	}
        	final int randomNum = random(1, 14);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(7, 750);
    			final int y = random(9, 500);
    			moveMouse(x, y);
    			return;
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return;
    			} else {
    				return;
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return;
    			}
    			
    			moveMouse(0, 0, 580, 480);
    			wait(random(1000, 2000));
    			return;
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return;
    			}	
    		
    		case 6:
    			if(random(1,2)==1) {
    				setCameraAltitude(random(50,100));
    				return;
    			}
    		case 7: if(random(1,2)==1) {
    			setCameraAltitude(true);
    		}
    		case 8: if (random(1, 2) == 1){
    		    moveMouseSlightly();
    		    break;
    		}
    		}
    		return;
        }
        
        public void mapisland() {    	
        	final RSObject rock = getNearestObjectByID(5605);
        	if (rock != null) {
        		rocktile = rock.getLocation();
        		mappedisland = true;
        		status = "Mapping Out Island";
    			
        		bottomrightk = new RSTile (rocktile.getX()-8,rocktile.getY()-15);
    			topleftk = new RSTile (rocktile.getX()-3,rocktile.getY()-20);
        		knighttile = new RSTile (rocktile.getX()-6,rocktile.getY()-17);     		
        		toplefttile = new RSTile (rocktile.getX()+35,rocktile.getY()-55);  
        		bottomrighttile = new RSTile (rocktile.getX()-35,rocktile.getY()+20);  
        		bottomrightbb = new RSTile (rocktile.getX()-6,rocktile.getY()+4); // Boat on island
        		topleftbb = new RSTile (rocktile.getX()-3,rocktile.getY()-2); // Boat on island
        		battlefield = new RSTile (rocktile.getX()-5,rocktile.getY()-28);
        		//log("Rock Tile:"+rocktile.getX()+","+rocktile.getY());
        		//log("Knight Tile:"+knighttile.getX()+","+knighttile.getY());
        	} else {
        	}
        }
       
        public String side() {
        	if(getLocation().getX()-(rocktile.getX()-6)>=0){
        		return "Left";
        	} else 
        		return "Right";
        }
        
        public boolean byknight() {
        	return distanceTo(knighttile)<8;
        }
        
        public void walktoknight() {
        	RSTile TempTile = new RSTile (rocktile.getX()-random(((rocktile.getX()-knighttile.getX())/2),((rocktile.getX()-knighttile.getX())/2)+2),rocktile.getY()-random(((rocktile.getY()-knighttile.getY())/2),((rocktile.getY()-knighttile.getY())/2)+2));
        	walkTo(TempTile); 	
        	wait(random(1200,1700)+random(1000,1800));
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				//walkPathMM(temp);
    			}
    		}
        	RSTile TempTile2 = new RSTile (knighttile.getX()+random(-2,2),knighttile.getY()+random(-2,2));
        	walkTo(TempTile2); 	
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				fights();
    			}
    		}
        }    
        
        //private void openGate() {
    		
    	//}
    
        
        public RSTile getNearest(final ArrayList<RSTile> tiles, final RSTile t) {
    		RSTile nearest = tiles.get(0);
    		for (int i = 0; i < tiles.size(); i++) {
    			if (distanceBetween(tiles.get(i), t) < distanceBetween(nearest, t)) {
    				nearest = tiles.get(i);
    			}
    		}
    		return nearest;
    	}
    
        
        public RSTile[] genPath(final RSTile t) {
    		RSTile current = getMyPlayer().getLocation();
    		final ArrayList<RSTile> tiles = new ArrayList<RSTile>();
    		final ArrayList<RSTile> path = new ArrayList<RSTile>();
    
    		while (distanceBetween(t, current) > 2) {
    			final int x = current.getX();
    			final int y = current.getY();
    			tiles.add(new RSTile(x, y - 1));
    			tiles.add(new RSTile(x - 1, y));
    			tiles.add(new RSTile(x + 1, y));
    			tiles.add(new RSTile(x, y + 1));
    			tiles.add(new RSTile(x - 1, y - 1));
    			tiles.add(new RSTile(x + 1, y - 1));
    			tiles.add(new RSTile(x + 1, y + 1));
    			tiles.add(new RSTile(x - 1, y + 1));
    			final RSTile tile = getNearest(tiles, t);
    			path.add(tile);
    			this.path = path.toArray(new RSTile[path.size()]);
    			current = tile;
    			tiles.clear();
    		}
    		this.path = path.toArray(new RSTile[path.size()]);
    		return this.path;
    	}
    
        public boolean WalkCorrectPath(String SideLoc, String portal, RSTile[] Paths){
        	if(SideLoc=="Left"){
        		if(portal=="West" || portal=="South West"){
        			Paths = reversePath(Paths);
        		}
        	}
        	if(!(SideLoc=="Left")){
        		if(portal=="West" || portal=="South West"){
        			if(getLocation().getX()>portaltw.getX()){
        				if(getLocation().getY()>rocktile.getY()+20)
        					Paths = reversePath(Paths);
        			}
        		}
        	}
        	if(!(walkPathMM(Paths))){
    			if(onisland()){
    				//if(!(walkPathMM(randomizePath(genPath(path.get(path.size()-1)), 2, 2), 10))){
    				if(!(walkPathMM(randomizePath(genPath(Paths[Paths.length-1]), 2, 2), 10))){
    					if(onisland()){
    						if(!walkPathMM(randomizePath(genPath(portaltw), 2, 2), 12)) {
    							log("Please post about a walk SUGGESTION (Not error)");
    							log("Suggestion to post: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()+ " P:"+portal));
    						}
    					}
    				}
    			}
    		}
        	return true;
        }
        
        public void walktoportal(String portal) {
        	 ArrayList<RSTile> path = new ArrayList<RSTile>();
        	 if(path.size()>1){
        		 path.clear();
        	 }
        	if(onisland()){
        		if(portal=="West") {
        			portaltw = new RSTile (rocktile.getX()-31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-random(10,12),rocktile.getY()-random(9,11)));
        			path.add(new RSTile (rocktile.getX()-random(17,19),rocktile.getY()-random(13,15))); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-18));//Right before portal
        			path.add(new RSTile (rocktile.getX()-28,rocktile.getY()-17)); 
        		}
        		if(portal=="East"){
        			portaltw = new RSTile (rocktile.getX()+31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+random(7,9),rocktile.getY()-28));
        			path.add(new RSTile (rocktile.getX()+random(16,18),rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()+random(26,31),rocktile.getY()-random(18,21)));
        		}
        		if(portal=="South East"){
        			portaltw = new RSTile (rocktile.getX()+7,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate		
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+8,rocktile.getY()-36)); //Right before portal
        		}
        		if(portal=="South West"){
        			portaltw = new RSTile (rocktile.getX()-16,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()-14,rocktile.getY()-33));
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-38)); //Right before portal
        		}
        		//if(gateclosed){
        			//opengate();
        		//}
        		WalkCorrectPath(side(), portal,path.toArray( new RSTile[ path.size() ] ));
        		//walkPathMM(randomizePath(genPath(portaltw), 2, 2), 10);
        	}
        }
        
        public boolean closeportal(String Portalz){
        	int westpi, eastpi, sepi,swpi;
        	westpi = distanceTo(new RSTile (rocktile.getX()-31,rocktile.getY()-20));
        	eastpi = distanceTo(new RSTile (rocktile.getX()+31,rocktile.getY()-20));
        	sepi = distanceTo(new RSTile (rocktile.getX()+7,rocktile.getY()-40));
        	swpi = distanceTo(new RSTile (rocktile.getX()-16,rocktile.getY()-40));
    	    if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    	 log("Close west");
    	    }
    		if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    			log("Close east");
    		}
    		if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    			log("Close sep");
    		}
    		if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    			log("Close swp");
    		}
        	
        	if(Portalz=="westp"){
    	    	if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    		return true;
    	    	}
        	}
        	if(Portalz=="eastp"){
    			if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    				return true;
    			}
        	}
    		if(Portalz=="sep"){
    			if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    				return true;
    			}
    		}
    		if(Portalz=="swp"){
    			if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    				return true;
    			}
    		}
        	return false;
        }
        
        public boolean walktoaportal(boolean realwalk) {
        	if(onisland()){
        		final RSInterface portalface = RSInterface.getInterface(408);
        		if (portalface.isValid()) {
        			westp = Integer.parseInt(RSInterface.getChildInterface(408,13).getText());
        			eastp = Integer.parseInt(RSInterface.getChildInterface(408,14).getText());
        			sep = Integer.parseInt(RSInterface.getChildInterface(408,15).getText());
        			swp = Integer.parseInt(RSInterface.getChildInterface(408,16).getText());
        			
        		}
        		portalname = "null!";
        		//boolean skip = false;
        		//int myrand;
        		if(p4match){
        			//myrand=10;
        		} else {
        			//myrand = random(1,4);
        		}
        		//log("Random portal = "+ myrand);
        		if(eastp>=40){//&& closeportal("eastp")){
        			portalname = "East";
        			//if(myrand==1){
        				//skip = true;
        				//p4match = true;
        				
        			//}
        		}
        		if(sep>=40){ //&& !(skip) && closeportal("sep")){
        			portalname = "South East";
        			//if(myrand==2){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(swp>=40){ //&& !(skip) && closeportal("swp")){
        			portalname = "South West";
        			//if(myrand==3){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(westp>=40){ // && !(skip) && closeportal("westp")){
        			//if(myrand==4){
        				//skip = true;
        				//p4match = true;
        			//}
        			portalname = "West";
        		}
        		if(!(portalname=="null!")&&realwalk){
        			walktoportal(portalname);
        		} else if(!(portalname=="null!")){
        			return true;
        		}
        		else return false;
        	}
        	return true;
        }
    
    	public boolean abletoattack() {
          return(getMyPlayer().getInteracting() == null);	
        }
        
        public int getSpec() {
    		return getSetting(300)/10;
    	}
        
        public boolean prayerenabled() {
    		return getSetting(1396)>0;
    	}
    
    	boolean specEnabled() {
    		return (getSetting(301)) == 1;
    	}
    
    	void doSpec() {
    		if(onisland()){
    			if (getSpec() == 100 && !specEnabled() && usespec) {
    				openTab(Constants.TAB_ATTACK);
    				clickMouse(645 + random(0, 4), 425 + random(0, 4), true);
    				wait(random(500, 1000));
    			} else {
    				wait(random(10, 50));
    			}
    		}
    	}
    
        
        public boolean cangetonboat(String boat) {
        	return !(RSInterface.getInterface(243).isValid()) || !(RSInterface.getInterface(211).isValid() || !RSInterface.getInterface(242).isValid()); 	
        }
        
        public boolean notbuyarmour() {
        	if(buytop&&!(topbuy)){
        		return false;
        	}
        	if(buybottom&&!(bottombuy)){
        		return false;
        	}
        	if(buygloves&&!(glovesbuy)){
        		return false;
        	}
        	if(buymace&&!(macebuy)){
        		return false;
        	}
        	return true;
        }
        
        public boolean canaffordanitem() {
        	if(pcpoints>=150){
        		if(buygloves&&!glovesbuy) {
        			return true;
        		}
        	}
        	if(pcpoints==250){
        		if(buybottom&&!bottombuy) {
        			return true;
        		}
        		if(buytop&&!topbuy) {
        			return true;
        		}
        	}
        	return false;
        }
        
        public int gettheskill(String skill) {
        	if(tskill=="Melee"){	
    			if(skill=="Att"){
    				cons = Constants.STAT_ATTACK; 
    			}
    			if(skill=="Str"){
    				cons = Constants.STAT_STRENGTH;
    			}
    			if(skill=="Def"){
    				cons = Constants.STAT_DEFENSE;
    			}
    		} else if(skill=="Mage"){
    			cons = Constants.STAT_MAGIC;
    		} else if(skill=="Range"){
    			cons = Constants.STAT_RANGE;
    		} 
        	return  skills.getCurrentSkillLevel(cons);
        }
        
        public boolean canbuysomething() {
          if(logfullz&&pcpoints>=250-boatp+1){
        	  log("Have full points, ending script");
        	  stopScript(true);
          }
          if(logfullz) {
        	  return false;
          }
          if(pcpoints>=100&&buyskills&&notbuyarmour()){
        	  return true;
          }
          if(!notbuyarmour()) {
        	if(canaffordanitem()){
        		return true;
        	}
          }
          if(!logfullz &&pcpoints>=250-boatp+1 ){
        	  log.warning("Can not buy because your boat points wont add up to desired item");
        	  stopScript(true);
          }
          return false;
        }
        
        public void DoExchange() {
        	RSNPC knight;
        	if(outsideboat()){
        		for (int i = 0; i < topoints.length; i++) {
        			if(getNearestNPCByName("Void Knight").isOnScreen()){
        				break;
        			}
        			wait(random(1000,2500));
        			flags();
        			walkPathMM(topoints);
        		}
        		knight = getNearestNPCByName("Void Knight");
        		if(!(knight==null)){
        			if(!getNearestNPCByName("Void Knight").isOnScreen()){
        				walkTo(knight.getLocation());
        				waitToMove(2000);
            			flags();
        			}
        			atNPC(getNearestNPCByID(3788), "change");
        			wait(random(500,800));
        			flags();
        			wait(random(5000,8000));
        			SpendingPoints();
        		}
        	}    	
        }
        
        public boolean doslider(){
        	if (RSInterface.getInterface(267).isValid()) {	
        		clickMouse(random(473,483),random(180,195),true);
        		wait(random(4000,5000));
        		return true;
        	}
        	return false;
        }
        
        public void confirms() {
        	if (RSInterface.getInterface(267).isValid()) {	
        		atInterface(RSInterface.getInterface(267).getChild(101));
        		wait(random(4000,5000));
        	}
        }
        
        public void SpendingPoints() {
    		if (RSInterface.getInterface(267).isValid()) {				
    			if (skilltobuy == "Attack") { 
    				atInterface(RSInterface.getInterface(267).getChild(56));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Strength") { 
    				atInterface(RSInterface.getInterface(267).getChild(57));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Defence") { 
    				atInterface(RSInterface.getInterface(267).getChild(58));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Ranged") { 
    				atInterface(RSInterface.getInterface(267).getChild(59));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Magic") { 
    				atInterface(RSInterface.getInterface(267).getChild(60));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Hitpoints") { 
    				atInterface(RSInterface.getInterface(267).getChild(61));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Prayer") { 
    				atInterface(RSInterface.getInterface(267).getChild(62));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if(!notbuyarmour()) {
    		    	if(canaffordanitem()){
    		    		if(pcpoints>=150){
    		        		if(buygloves&&!glovesbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(44));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				glovesbuy = true;
    		        		}
    		        	}
    		        	if(pcpoints==250){
    		        		if(buybottom&&!bottombuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(43));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				bottombuy = true;
    		        		}
    		        		if(buytop&&!topbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(42));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				topbuy = true;
    		        		}
    		        		if(buymace&&!(macebuy)){
    		        			atInterface(RSInterface.getInterface(267).getChild(41));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				macebuy = true;
    		            	}
    		        	}
    		    	}
    		      }
    		} else {
    			atNPC(getNearestNPCByID(3788), "change");
    			wait(random(1000, 2000));
    		}
    	}
    
        
        public boolean died() {
        	if(inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getX(),topleftbb.getX(),topleftbb.getY(),bottomrightbb.getX(),bottomrightbb.getY())){
        		walkd = false;
        		return true;
        	}
        	return false;
        }
        
        public boolean byaportal() {
        	if(onisland()){
        		final RSNPC portal = getNearestNPCByName("Portal");
        		if(!(portal==null)){
        			if(distanceTo(portal.getLocation())>5){
        				return false;	
        			}
        			else return true;
        		}
        	}
        	return false;
        }
        
        public boolean shouldattack(){
        	if(walktoaportal(false) && !gotzealforround()) {
        		return true;
        	}
        	if(walktoaportal(false)){
        		return true; 
        	}
        	return walktoaportal(false) && !gotzealforround(); 
        }
        
        public boolean fights() {
        	if(onisland()){
        		RSNPC Me,Portal = null;
        		String[] me;
        		ArrayList<String> attz = new ArrayList<String>();
        		attz.add("Attack");
        		boolean mee = false;
        		int I;
        		if(!defendk){
        			//Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
        			Me = getNearestNPCByName(ta);
        		} else {
        			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
        		}
        		if(attportals){
        			Portal = getNearestNPCToAttackByName("Portal");	
    	    		if(!(Portal==null)){
    	    			me =Portal.getActions(); 
    	    			for(I=0; I < me.length; I++){
    	    				//log(me[I]);
    	    				if(attz.contains(me[I])){
    	    					mee=true;
    	    				}
    	    			}
    	    		}
    	    		if(!mee){
    					Portal = null;
    				}
        		}
        		
        		if(attportals&&(Portal != null)&&Portal.isOnScreen() && shouldattack()){
        			if(getMyPlayer().getInteracting() == null && (Portal != null) && Portal.isOnScreen()) {
        				try {
        					if(atNPC(Portal, "Attack Por")) {
        						wait(random(500,1000));
        						flags();
        						return true;
        					} else {
        						status = "Doing antiban";
        						antiban2();
        					}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		} else {
        			if(getMyPlayer().getInteracting() == null && (Me != null) && Me.isOnScreen() && shouldattack()) {
        				try {
    	    				if(atNPC(Me, "Attack " + Me.getName())) {
    	    					wait(random(500,1000));
    	    					flags();
    	    					return true;
    	    				} else {
    	    					status = "Doing antiban";
    	    					antiban2();
    	    					if(!defendk){
    	    		    			//RSNPC Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
    	    		    			Me = getNearestNPCByName(ta);
    	    		    		} else {
    	    		    			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
    	    		    		}
    	    					if(!(Me==null)&&Me.isOnScreen()) {
    	    						return true;
    	    					}
    	    				}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		}
        	}
        	return false;
        }
         
        public RSInterfaceChild getPrayerInterface() {
    		if (Bot.getClient().getRSInterfaceCache() == null) {
    			return null;
    		}
    		final RSInterface iface = RSInterface.getInterface(749);
    		final RSInterfaceChild child = iface.getChild(4);
    		
    		return child;
    	}
        
        public boolean DoQuickPrayers() {
        	int prayerp;
        	if(onisland()){
        		prayerp = Integer.parseInt(RSInterface.getChildInterface(749,4).getText());
        		if(!prayerenabled()) {
        			if(prayerp>0&&useqp){
        				final RSInterfaceChild cont = getPrayerInterface();
        				return (atInterface(cont));	
        			}
        		}
        	}
    		return false;
        	
        }
        
        public boolean enterboat() {
        	wait(random(2000,4000));
        	final RSInterface IFACE = RSInterface.getInterface(243);
    		final RSInterface IFACE2 = RSInterface.getInterface(211);
    		if (IFACE.isValid()) {
        		zealgained = zealgained + boatp;
    		} else if (IFACE2.isValid()) {
    			loz++;
        	}
        	if(!tileOnScreen(laddertile)) {
    			if(!tileOnMap(laddertile)&& !getMyPlayer().isMoving()){
    				walkPathMM(toboat, 10);
    			} else {
    				if(!getMyPlayer().isMoving()){
    					walkTo(laddertile);
    				}
    			}
    		} else {
    			final RSObject ladderid = getNearestObjectByID(ladderd);
    			if (ladderid != null && !insideboat() && !canbuysomething()) {
    				status = "Entering Boat";
    				wait(random(700,2400));
    				atObject(ladderid, "Cross");
    				wait(random(1000,2000));
    				if(!insideboat()){
    					wait(random(1000,1500));
    					atObject(ladderid, "Cross");
    					wait(random(1000,2000));
    				}
    				if(!insideboat()&& !cangetonboat("novice")){
    					return false;
    				}	
    			} else {
    				if(!insideboat()&& !cangetonboat("novice")){
    					//log("Failed to board boat");
    					return false;
    				}	
    			}
    		}
        	return false;
        }
        
    	@Override
    	public int loop() {
    		if(!firstlogin){
    			wait(random(3000,5000));
    			firstlogin = true;
    		}
    		wait(random(400,600));
    		setCameraAltitude(true);
    		if(startlvl==0){
    			if(tskill=="Mage"){
    				tskilld = tskill;
    			} else if(tskill=="Range"){
    				tskilld = tskill;
    			}
    			startlvl = gettheskill(tskilld);
    			
    		}		
    		if(outsideboat()){
    			if(canbuysomething()&&!insideboat()){
    				DoExchange();
    			}
    			walkd = false;
    			mappedisland = false;
    			setangleisland = false;
    			knighttile = new RSTile (0,0);
    			toplefttile = new RSTile (0,0);
    			bottomrighttile = new RSTile (0,0);
    			newround = true;
    			p4match = false;
    			enterboat();
    		}
    		if(insideboat()){
    			mappedisland = false;
    			walkd= false;
    			newround = true;
    			setangleisland = false;
    			p4match = false;
    			status = "Waiting on boat.";
    			return antiban();
    		}
    		
    		if(onisland()){
    			status = "Fighting!!!";
    			if(!setangleisland){
    				setRun(true);
    				setFightMode(dfightm);
    				wait(random(200,300));
    				setangleisland=true;
    			}
    			if(!mappedisland){
    				mapisland();		
    			}
    			//if(!walkd || died()) {
    				//walktoaportal();
    			//}	
    			
    			DoQuickPrayers();
    			doSpec();
    			if(defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && (getMyPlayer().getInteracting() == null)){
    						if(!byknight()){
    							walktoknight();
    						}
    					  }
    					}
    				} else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}
    			}
    			if(!defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && !byaportal() && (getMyPlayer().getInteracting() == null)){
    						if(!getMyPlayer().isMoving()) {
    							walktoaportal(true); 
    						}
    					}
    				}else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}				
    			}
    
    		return 200;
    	}
    		
    	
    
    
    
    	@Override
    	public boolean onStart(final Map<String, String> args) {
    		wtbs = args.get("wtbs");
    		knighttile = new RSTile (0,0);
    		toplefttile = new RSTile (0,0);
    		bottomrighttile = new RSTile (0,0);
    		final gui gui = new gui();
    		gui.setVisible(true);
    		try {
    			log("Checking for updates");
    			// Open the version text file
    			URLConnection url = new URL("http://www.zaszmedia.com/scripts/zpc/version.txt").openConnection();
    			// Create an input stream for it
    			BufferedReader reader = new BufferedReader(new InputStreamReader(url.getInputStream()));
    			// Check if the current version is out dated
    			if (Double.parseDouble(reader.readLine()) > version){
    				outdated = true;
    				log("You have an old version of the script!");
    				log("You can update by visiting http://www.rsbot.org/vb/showthread.php?t=177106");
    			} else {
    				outdated = false;
    				log("You have the latest version of the script!");
    			}
    			if (reader != null)
    				reader.close();
    		} catch (IOException e) {
    			Bot.getEventManager().removeListener(PaintListener.class, this);
    			log("Problem getting version.");
    			stopScript();
    		}
    
    		while (!startScript) {
    			wait(20);
    		}
    		return true;
    	}
    
    	
    	public boolean inAreza(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
    
    	
    	public int optionpaint() {
    		Mouse m = Bot.getClient().getMouse();
    		//bottom left then top right
    		if (inArea(m.x,m.y,560+50,226-60,560,226-10)) {
                return  1;
            }
            if (inArea(m.x,m.y,560+110,226-60,560+51,226-10)) {
            	return  2;
            }
            if (inArea(m.x,m.y,560+170,226-60,560+111,226-10)) {
            	return  3;
            }
    		return 0;
    	}
    	
    	// final int x = 300-50; orig
    	//int y = 16+75; orig
    	//g.fill3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.draw3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.setColor(new Color(60, 140, 200, 50)); orig
    	
    	public void onRepaint(Graphics g) {
            if (isLoggedIn()) {	
                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;
                
                final int x = 560;
    			int y = 226;
    			
    			if(newround && onisland()){
    				gamesplayed = gamesplayed + 1;
    				newround = false;
    			}
    			if(!(startlvl==0)){
    				gettheskill(tskilld);
    				startEXP = skills.getCurrentSkillExp(cons);
    			}
    			if(optionpaint()==0){
    				g.setColor(new Color(0, 0, 0, 175));	//new
    				g.fillRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				
    			}
    			if(optionpaint()==1){	
    				
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				if(onisland()){
    					g.drawString("Games played:"+ (gamesplayed-1), x, y);
    				} else {
    					g.drawString("Games played:"+gamesplayed, x, y);
    				}
    				if(pcpoints>0){
    					y = y + 16;
    					g.drawString("PCP Gained: "+zealgained+" Total PCP: "+pcpoints, x, y);	
    				} else {
    					y = y + 16;
    					g.drawString("PC Points Gained: "+zealgained, x, y);
    				}
    				y = y + 16;
    				if(onisland()&&gamesplayed>0){
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+ ((gamesplayed-1) - (zealgained/2)+ " Lack of Z: " + loz), x, y);
    				} else {
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+(gamesplayed - (zealgained/2) + " Lack of Z: " + loz), x, y);
    				}
    			}
    			if(optionpaint()==2){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y +16;
    				g.drawString("Using: "+tskill+" Skill: "+tskilld, x, y);
    				y = y + 16;
    				g.drawString("Start "+tskilld+" lvl: "+startlvl+" Current lvl: "+gettheskill(tskilld), x, y);
    			}
    				//if(!(knighttile.getX()==0)){
    					//y = y + 16;
    					//g.drawString("Knight tile: " + knighttile.getX()+","+knighttile.getY(), x, y);
    				//}
    			if(optionpaint()==3){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				g.drawString("Boat Kind:"+ boattb , x, y);
    				if(!(amode=="Mage")){
    					if(usespec){
    						y = y + 16;
    						g.drawString("Set to use spec when able", x, y);
    					}
    				}
    				if(!(knighttile.getX()==0)){
    					y = y + 16;
    					g.drawString("Earned Zeal for round "+gotzealforround(), x, y);
    					
    				}
    				if(onisland()){
    					y = y + 16;
    					g.drawString("By a portal: "+ byaportal(), x, y);
    					y = y + 16;
    					y = y + 16;
    					g.drawString("Island Tile: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()), x, y);
    				}
    			}
            } 
        }
    }
    
    Zasz's PC script, made by a very good script writer.
    He has the best auto enchanter out there and Out of 600 games of PC, I've gotten no points 7 times.
     
  15. Unread #8 - Mar 6, 2010 at 9:32 PM
  16. Tigerz
    Joined:
    Dec 24, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Tigerz Member

    Whats the best FREE pest control bot?

    Code:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Map;
    
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.SwingConstants;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    
    import org.rsbot.bot.Bot;
    import org.rsbot.bot.input.Mouse;
    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.RSInterfaceChild;
    import org.rsbot.script.wrappers.RSNPC;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    
    
    
    
    
    @ScriptManifest(authors = { "Zasz" }, category = "Combat", name = "Zasz's Pest Control", version = 1.00, description = "<html><head>"
    	+ "</head><body>"
    	+ "<center><strong><h2>Zasz's Pest Control!</h2></strong></center>"
    	+ "<center></center><br />"
    	+ "<br>"
    	+ " <center><B>Click start for the GUI!.</b>"
    	+ "<strong></strong>" 
    	+ "</center><br>"
    	+ "</body></html>")
    
    public class ZaSzPC extends Script implements PaintListener {
    	public long startTime = System.currentTimeMillis();
    	public long tsa,tsw;
        boolean hasset, buys,buymace,buytop,buybottom,buygloves,buyskills,mappedisland,firstlogin,setangleisland;
        boolean macebuy,topbuy,bottombuy,glovesbuy;
        boolean newround,usespec, logfullz, outdated, walkd, attportals, useqp, defendk, p4match;
        boolean makep =  true;
        public boolean startScript = false;
        private String status = "";
        String wtbs,portalname;
        String tskill, amode,tskilld, skilltobuy, helmtobuy, boattb;
        int dfightm, startlvl,gamesplayed, pcpoints, cons, startEXP, Location,ladderd,boatp,loz;
    	long eph;
    	int lastportalopend,portalid;
        int zealgained = 0;
        int westp,eastp,sep,swp;
        int[] monsters = {3734,3735,3733};
        String[] wtb, ta;
        RSTile knighttile, boattilen, boattiles;
        RSTile rocktile,bottomrighttile,toplefttile,battlefield;
        RSTile bottomrightk,topleftk, bottomrightbb, topleftbb;
        RSTile laddertile;
        RSTile portaltw;
        String cp = "";
        public double version = 1.5;
    	private RSTile[] path,toboat,topoints;
    
        public class gui extends JFrame 
        { 
        	/**
    		 * 
    		 */
    		private static final long serialVersionUID = 1337L;
    		// Variables declaration 
        	private JTabbedPane jTabbedPane1; 
        	private JButton jButton1; 
        	private JPanel contentPane; 
        	//----- 
        	private JLabel jLabel2; 
        	private JLabel jLabel5; 
        	private JLabel jLabel6; 
        	private JPanel jPanel1; 
        	//----- 
        	private JLabel jLabel7; 
        	private JLabel jLabel8; 
        	private JLabel jLabel9; 
        	private JLabel jLabel10; 
        	private JLabel jLabel12; 
        	private JComboBox jComboBox1; 
        	private JComboBox jComboBox2; 
        	private JComboBox jComboBox3;
        	private JComboBox jComboBox4;
        	private JComboBox jComboBox5; // Boat
        	private JCheckBox jCheckBox3;  
        	private JCheckBox jCheckBox4; 
         	private JCheckBox jCheckBox5; 
         	private JCheckBox jCheckBox6;// Att portal 
         	private JCheckBox jCheckBox7; // Use quick Prayer
         	private JCheckBox jCheckBox8; // Defend Knight
        	private JPanel jPanel2; 
        	//----- 
        	private JPanel jPanel3; 
        	//----- 
        	private JPanel jPanel4; 
        	
        	private JRadioButton jRadioButton1; 
         	private JRadioButton jRadioButton2; 
         	private JRadioButton jRadioButton3; 
         	private JRadioButton jRadioButton4; 
         	private JRadioButton jRadioButton5; 
         	private JRadioButton jRadioButton6; 
         	private JRadioButton jRadioButton7; 
         	private JRadioButton jRadioButton8; 
         	private JRadioButton jRadioButton9; 
         	private JRadioButton jRadioButton10; 
         	private JRadioButton jRadioButton11; 
        	// End of variables declaration 
         
         
        	public gui() 
        	{ 
        		super(); 
        		initializeComponent(); 
        		
         
        		this.setVisible(true); 
        	} 
         
        	/** 
        	 * This method is called from within the constructor to initialize the form. 
        	 * WARNING: Do NOT modify this code. The content of this method is always regenerated 
        	 * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
        	 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
        	 * to retrieve your design properly in future, before revising this method. 
        	 */ 
        	private void initializeComponent() 
        	{ 
        		jTabbedPane1 = new JTabbedPane(); 
        		jButton1 = new JButton(); 
        		contentPane = (JPanel)this.getContentPane(); 
        		//----- 
        		jLabel2 = new JLabel(); 
        		jLabel5 = new JLabel(); 
        		jLabel6 = new JLabel(); 
        		jPanel1 = new JPanel(); 
        		jCheckBox3 = new JCheckBox(); 
        		//----- 
        		jLabel7 = new JLabel(); 
        		jLabel8 = new JLabel(); 
        		jLabel9 = new JLabel();
        		jLabel10 = new JLabel();
        		jLabel12 = new JLabel();
        		jComboBox1 = new JComboBox(); 
        		jComboBox2 = new JComboBox(); 
        		jComboBox3 = new JComboBox(); 
        		jComboBox4 = new JComboBox();
        		jComboBox5 = new JComboBox();
        		jPanel2 = new JPanel();
        		jCheckBox4 = new JCheckBox(); 
         		jCheckBox5 = new JCheckBox(); 
         		jCheckBox6 = new JCheckBox();
         		jCheckBox7 = new JCheckBox();
         		jCheckBox8 = new JCheckBox();
        		jRadioButton1 = new JRadioButton(); 
         		jRadioButton2 = new JRadioButton(); 
         		jRadioButton3 = new JRadioButton();
         		jRadioButton4 = new JRadioButton(); 
        		jRadioButton5 = new JRadioButton();
        		jRadioButton6 = new JRadioButton();
        		jRadioButton7 = new JRadioButton();
        		jRadioButton8 = new JRadioButton();
        		jRadioButton9 = new JRadioButton();
        		jRadioButton10 = new JRadioButton();
        		jRadioButton11 = new JRadioButton();
        		//----- 
        		jPanel3 = new JPanel(); 
        		//----- 
        		jPanel4 = new JPanel();
        		// 
        		// jTabbedPane1 
        		// 
        		jTabbedPane1.addTab("Description", jPanel1); 
        		jTabbedPane1.addTab("Combat Options", jPanel2); 
        		jTabbedPane1.addTab("Island Options", jPanel4); 
        		jTabbedPane1.addTab("Zeal Options", jPanel3); 
        		jTabbedPane1.addChangeListener(new ChangeListener() { 
        			public void stateChanged(ChangeEvent e) 
        			{ 
        				jTabbedPane1_stateChanged(e); 
        			} 
         
        		}); 
        		// 
        		// jButton1 
        		// 
        		jButton1.setText("Start Script!"); 
        		jButton1.addActionListener(new ActionListener() { 
        			public void actionPerformed(ActionEvent e) 
        			{ 
        				jButton1_actionPerformed(e); 
        			} 
         
        		}); 
        		// 
        		// contentPane 
        		// 
        		contentPane.setLayout(null); 
        		addComponent(contentPane, jTabbedPane1, 0,0,373,221); 
        		addComponent(contentPane, jButton1, 124,240,106,28); 
        		// 
        		// jLabel2 
        		// 
        		jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); 
        		jLabel2.setHorizontalTextPosition(SwingConstants.LEADING); 
        		jLabel2.setText("ZaSz\'s Pest Control: By ZaSz"); 
        		// 
        		// jLabel5 
        		// 
        		jLabel5.setText("Start this script either at Pest Control bank. Or near the landers!"); 
        		// 
        		// jLabel6 
        		// 
        		jLabel6.setText("Make sure to fill out all the options! Or this script won\'t work for you!"); 
        		// 
        		// jPanel1 
        		// 
        		jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel1.add(jLabel2, 0); 
        		jPanel1.add(jLabel5, 1); 
        		jPanel1.add(jLabel6, 2); 
        		jPanel1.setOpaque(true); 
        		// 
        		// jLabel7 
        		// 
        		jLabel7.setText("Combat Style"); 
        		// 
         		// jLabel8 
         		// 
         		jLabel8.setText("Attack style "); 
         		// 
         		// jLabel9 
         		// 
         		jLabel9.setText("Skill to buy");
         		// 
         		// jLabel10 
         		// 
         		jLabel10.setText("Boat to use:    ");
         		// 
         		// jCheckBox3 
         		// 
         		jCheckBox3.setText("Use special Attacks when applicable? (Range/Melee only)"); 
         		// jCheckBox4 
         		// 
         		jCheckBox4.setText("logout at full zeal (Can't buy anything else if you pick)"); 
         		// 
         		// jCheckBox5 
         		// 
         		jCheckBox5.setText("Use Zeal to buy skills.    ");
         		// 
         		// jCheckBox6 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox7
         		// 
         		jCheckBox7.setText("Use Quick Prayer.       "); 
         		// 
         		// jCheckBox8
         		// 
         		jCheckBox8.setText("Defend the knight instead of portals.  "); 
         		// 
         		// jRadioButton1 
         		// 
         		//(Use dropdown box to select)
         		jRadioButton1.setText("Buy a helm  (Helms/Void armour not able this version)"); 
         		// 
         		// jRadioButton2 
         		// 
         		jRadioButton2.setText("Buy Void Top"); 
         		// 
         		// jRadioButton3 
         		// 
         		jRadioButton3.setText("Buy Void Bottom"); 
         		// 
         		// jRadioButton4 
         		// 
         		jRadioButton4.setText("Buy Void Gloves"); 
         		// 
         		// jRadioButton5 
         		// 
         		jRadioButton5.setText("Buy Void Mace         "); 
        		// 
        		// jComboBox1 
        		// 
        		jComboBox1.addItem("Melee"); 
        		jComboBox1.addItem("Range"); 
        		jComboBox1.addItem("Mage"); 
        		// 
         		// jComboBox2 
         		// 
         		jComboBox2.addItem("Accurate (Att/Range/Mage)"); 
         		jComboBox2.addItem("Strength/Rapid (Str/Range/Mage)"); 
         		jComboBox2.addItem("Defensive (Def/Def+range/Def+Mage"); 
         		// 
         		// jComboBox3 
         		// 
         		jComboBox3.addItem("Attack"); 
         		jComboBox3.addItem("Strength"); 
         		jComboBox3.addItem("Defence"); 
         		jComboBox3.addItem("Ranged"); 
         		jComboBox3.addItem("Magic"); 
         		jComboBox3.addItem("Hitpoints"); 
         		jComboBox3.addItem("Prayer"); 
         		
         		//
         		// jComboBox4
         		//
         		jComboBox4.addItem("Mage helm");
         		jComboBox4.addItem("Melee helm");
         		jComboBox4.addItem("Range helm");	
         		//
         		// jComboBox5
         		//
         		jComboBox5.addItem("Novice Boat");
         		jComboBox5.addItem("Intermediate Boat");
         		jComboBox5.addItem("Expert Boat");
        		// 
        		// jPanel2 
        		// 
         		jPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel2.add(jLabel7, 0); 
         		jPanel2.add(jComboBox1, 1); 
         		jPanel2.add(jCheckBox7,2);
         		jPanel2.add(jCheckBox3, 3); 
         		jPanel2.add(jLabel8, 4); 
         		jPanel2.add(jComboBox2, 5);
        		// 
        		// jPanel3 
        		// 
        		jPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel3.add(jCheckBox4, 0); 
         		jPanel3.add(jCheckBox5, 1); 
         		//jPanel3.add(jRadioButton1, 2); 
         		jPanel3.add(jRadioButton2, 2); 
         		jPanel3.add(jRadioButton3, 3); 
         		jPanel3.add(jRadioButton4, 4); 
         		jPanel3.add(jRadioButton5, 5); 
         		jPanel3.add(jLabel9, 6); 
         		jPanel3.add(jComboBox3, 7); 
         		//jPanel3.add(jComboBox4,9);
         		
         		/////////////////////////////////////////////////////////////////
         	// 
         		// jLabel1 
         		// 
         		jLabel10.setText("Boat To Use"); 
         		// 
         		// jLabel2 
         		// 
         		jLabel12.setText(" Monsters to Attack:  MUST HAVE SHIFTER IF DEFENDING KNIGHT!!!!          "); 
         		// 
         		// jCheckBox1 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox2 
         		// 
         		jCheckBox8.setText("Defend Knight instead of portals"); 
         		// 
         		// jRadioButton1 "Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter"
         		// 
         		jRadioButton6.setText("  Spinner"); 
         		jRadioButton6.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton7.setText("Shifter"); 
         		jRadioButton7.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton8.setText("Torcher"); 
         		jRadioButton8.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton9.setText("Defiler"); 
         		jRadioButton9.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton10.setText("Brawler");
         		jRadioButton10.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton11.setText("Splatter"); 
         		jRadioButton11.setSelected(true);
         		////////////////////////////////////////////////////////////////////////
         		// 
        		// jPanel4  (ISLAND OPTIONS)
        		// 
         		jPanel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel4.add(jLabel10,0);
         		jPanel4.add(jComboBox5, 1); 
         		jPanel4.add(jCheckBox6, 2); 
         		jPanel4.add(jCheckBox8, 3); 
         		jPanel4.add(jLabel12, 4); 
         		jPanel4.add(jRadioButton6, 5); 
         		jPanel4.add(jRadioButton7, 6); 
         		jPanel4.add(jRadioButton8, 7); 
         		jPanel4.add(jRadioButton9, 8); 
         		jPanel4.add(jRadioButton10, 9); 
         		jPanel4.add(jRadioButton11, 10); 
         		
         		//jPanel4.add(, 4); 
         		//jPanel4.add();
        		// 
        		// gui 
        		// 
        		this.setTitle("Zasz\'s Pest Control!"); 
        		this.setLocation(new Point(168, 107)); 
        		this.setSize(new Dimension(395, 311)); 
        	} 
         
        	/** Add Component Without a Layout Manager (Absolute Positioning) */ 
        	private void addComponent(Container container,Component c,int x,int y,int width,int height) 
        	{ 
        		c.setBounds(x,y,width,height); 
        		container.add(c); 
        	} 
         
        	
        	private void jTabbedPane1_stateChanged(ChangeEvent e) 
        	{ 
        		System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called."); 
      
        	} 
      
        	
        	private void jButton1_actionPerformed(ActionEvent e) 
        	{ 
        		System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); 
         
        		amode = jComboBox2.getSelectedItem().toString(); 
        		tskill = jComboBox1.getSelectedItem().toString();
        		Location = jComboBox1.getSelectedIndex();
        		usespec = jCheckBox3.isSelected();
        		buyskills = jCheckBox5.isSelected();
        		logfullz = jCheckBox4.isSelected();
        		//logfullz = true;
             	//int leng = 0;	
             	//if(jRadioButton6.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton7.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton8.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton9.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton10.isSelected()){
             ///		leng++;
        		//}
        		//if(jRadioButton11.isSelected()){
        		//	leng++;
        		//}
        		ArrayList<String> monsterztoatt = new ArrayList<String>();
    
        		if(jRadioButton6.isSelected()){
        			monsterztoatt.add("Spinner");
        		}
        		if(jRadioButton7.isSelected()){
        			monsterztoatt.add("Shifter");
        		}
        		if(jRadioButton8.isSelected()){
        				monsterztoatt.add("Torcher");
        			}
        		if(jRadioButton9.isSelected()){
        			monsterztoatt.add("Defiler");
        		}
        		if(jRadioButton10.isSelected()){
        			monsterztoatt.add("Brawler");
        		 }
        		if(jRadioButton11.isSelected()){
        			monsterztoatt.add("Splatter");
        		}
        		ta = monsterztoatt.toArray( new String[ monsterztoatt.size() ] );
        		if(!buyskills){
        			logfullz = true;
        		}
        		defendk = jCheckBox8.isSelected();
        		attportals = jCheckBox6.isSelected();
        		useqp = jCheckBox7.isSelected();
        		boattb = jComboBox5.getSelectedItem().toString();
        		if(boattb=="Novice Boat"){
        			ladderd = 14315;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2657, 2640)} ;
        			boattiles = new RSTile (2663, 2638); //SE
        			boattilen = new RSTile (2660, 2643); //NW
        			laddertile = new RSTile (2657,2639);
        			boatp = 2;
        		}
        		if(boattb=="Intermediate Boat"){
        			ladderd = 25631;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2644, 2644)} ;
        			boattiles = new RSTile (2641, 2642); //SE
        			boattilen = new RSTile (2638, 2647); //NW
        			laddertile = new RSTile (2644,2644);
        			boatp = 3;
        		}
        		if(boattb=="Expert Boat"){
        			ladderd = 25632;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2638, 2653)} ;
        			boattiles = new RSTile (2635, 2649); //SE
        			boattilen = new RSTile (2632, 2654); //NW
        			laddertile = new RSTile (2638,2653);
        			boatp = 4;
        		}
        		topoints = reversePath(toboat);
        		if(amode=="Accurate (Att/Range/Mage)"){
        			dfightm = 0;
        			tskilld = "Att";
        		} else
        		
        		if(amode=="Strength/Rapid (Str/Range/Mage)"){
        			dfightm = 1;
        			tskilld = "Str";
        		} else
        		if(amode=="Defensive (Def/Def+range/Def+Mage"){
        			if(!(tskill=="Range") || !(tskill=="Mage")){
        				dfightm = 3;
        			} else
        				dfightm = 2;
        			tskilld = "Def";
        		} else {		
        			tskilld=amode;			
        		}
        		
        		if(buyskills){
        			  skilltobuy = jComboBox3.getSelectedItem().toString();
        			  log("Buying: "+skilltobuy);
        		}
        		;
        		if(jRadioButton1.isSelected()){
        			helmtobuy = jComboBox4.getSelectedItem().toString();
        			//buyhelm = false; //delete when implemented TODO
        			//log("Buying: "+helmtobuy);
        		}
        		if(jRadioButton2.isSelected()){
        			buytop = true;
        			log("Buying: top");
        		}
        		if(jRadioButton3.isSelected()){
        			buybottom = true;
        			log("Buying: bottom");
        		}
        		if(jRadioButton4.isSelected()){
        			buygloves = true;
        			log("Buying: gloves");
        		}
        		if(jRadioButton5.isSelected()){
        			buymace = true;
        			buymace = false; //delete when implemented TODO
        			log("Buying: mace");
        			
        		}
        		
        		
    		
        		
        		
        		
        		
        		
        		
        		
    
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		//if(leng==0){
        		// log("Must select a monster to attack!");	
        		//} else {
        			setVisible(false);
        			startScript = true;
        			//}
        	} 
       
        }
        
        public boolean outsideboat() {
        	return distanceTo(laddertile)<40;
        }
        
        public boolean insideboat() {
        	final RSInterface IFACE = RSInterface.getInterface(407);
        	//if (pcpoints==0){
        	
        		if (IFACE.isValid()) {
        			String interfacet;
        			interfacet = RSInterface.getChildInterface(407,16).getText();
        			int interfacel,source,tempzeal;
        			interfacel = interfacet.length();
        			source = interfacet.indexOf(":");
        			String pointtext;
        			pointtext = interfacet.substring(source+2, interfacel);
        			tempzeal = Integer.parseInt(pointtext);
        			if(!(tempzeal==pcpoints)){
        				pcpoints = tempzeal;
        			}
        		}
        	//}
        	return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),boattiles.getX(),boattiles.getY(), boattilen.getX(), boattilen.getY());
        }
        
        public boolean onisland() {
        	if(!mappedisland){
        		final RSObject rock = getNearestObjectByID(5605);
        		if (rock != null) {
        			//log(""+rock.getLocation().getX()+","+rock.getLocation().getY()+" Distance:"+distanceTo(rock.getLocation()));
        			return distanceTo(rock.getLocation())<10;	
        		} else {
        			return false;
        		}
        	} else {
        		return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),toplefttile.getX(),toplefttile.getY(),bottomrighttile.getX(),bottomrighttile.getY());
        	}
        }
        
        public boolean inArea(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
        
        public String between(String main,String s1, String s2) {
        	  
        	  int length=s1.length();
    
        	  return main.substring(length,main.indexOf(s2,length));
    
        }
        
        public boolean gotzealforround() {
        	final RSInterface IFACE = RSInterface.getInterface(408);
        	if (IFACE.isValid()) {
        		return Integer.parseInt(RSInterface.getChildInterface(408,11).getText())>49;
        	} else
        		return false;
        }
        
        
        public void onFinish() {
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    	}
    
        
        public boolean flags() {
        	if(getMyPlayer().isMoving()){
        		long st = System.currentTimeMillis();
        		RSTile tile = getMyPlayer().getLocation();
        		while(System.currentTimeMillis() - st < 2000){
        			if(!tile.equals(getMyPlayer().getLocation())){
        				st = System.currentTimeMillis();
        	                        tile = getMyPlayer().getLocation();
        			}
        		}
        	} else {
        		return false;
        	}
        	return true;
        }
        
        public int antiban() {
        	final int randomNum = random(1, 18);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(4, 750);
    			final int y = random(4, 500);
    			moveMouse(x, y);
    			return random(1000, 1500);
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return random(500, 750);
    			} else {
    				return random(500, 750);
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return random(750, 1000);
    			}
    			if (getCurrentTab() != Constants.TAB_STATS) {
    				openTab(Constants.TAB_STATS);
    			}
    			moveMouse(560, 230, 40, 180);
    			wait(random(1000, 2000));
    			return random(500, 1500);
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return random(500, 750);
    			}
    		}	
    		return random(200,2000);
        }
        
        public void antiban2() {
        	if(!shouldattack()){
        		status = "Waiting Till end of round!";
        	}
        	final int randomNum = random(1, 14);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(7, 750);
    			final int y = random(9, 500);
    			moveMouse(x, y);
    			return;
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return;
    			} else {
    				return;
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return;
    			}
    			
    			moveMouse(0, 0, 580, 480);
    			wait(random(1000, 2000));
    			return;
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return;
    			}	
    		
    		case 6:
    			if(random(1,2)==1) {
    				setCameraAltitude(random(50,100));
    				return;
    			}
    		case 7: if(random(1,2)==1) {
    			setCameraAltitude(true);
    		}
    		case 8: if (random(1, 2) == 1){
    		    moveMouseSlightly();
    		    break;
    		}
    		}
    		return;
        }
        
        public void mapisland() {    	
        	final RSObject rock = getNearestObjectByID(5605);
        	if (rock != null) {
        		rocktile = rock.getLocation();
        		mappedisland = true;
        		status = "Mapping Out Island";
    			
        		bottomrightk = new RSTile (rocktile.getX()-8,rocktile.getY()-15);
    			topleftk = new RSTile (rocktile.getX()-3,rocktile.getY()-20);
        		knighttile = new RSTile (rocktile.getX()-6,rocktile.getY()-17);     		
        		toplefttile = new RSTile (rocktile.getX()+35,rocktile.getY()-55);  
        		bottomrighttile = new RSTile (rocktile.getX()-35,rocktile.getY()+20);  
        		bottomrightbb = new RSTile (rocktile.getX()-6,rocktile.getY()+4); // Boat on island
        		topleftbb = new RSTile (rocktile.getX()-3,rocktile.getY()-2); // Boat on island
        		battlefield = new RSTile (rocktile.getX()-5,rocktile.getY()-28);
        		//log("Rock Tile:"+rocktile.getX()+","+rocktile.getY());
        		//log("Knight Tile:"+knighttile.getX()+","+knighttile.getY());
        	} else {
        	}
        }
       
        public String side() {
        	if(getLocation().getX()-(rocktile.getX()-6)>=0){
        		return "Left";
        	} else 
        		return "Right";
        }
        
        public boolean byknight() {
        	return distanceTo(knighttile)<8;
        }
        
        public void walktoknight() {
        	RSTile TempTile = new RSTile (rocktile.getX()-random(((rocktile.getX()-knighttile.getX())/2),((rocktile.getX()-knighttile.getX())/2)+2),rocktile.getY()-random(((rocktile.getY()-knighttile.getY())/2),((rocktile.getY()-knighttile.getY())/2)+2));
        	walkTo(TempTile); 	
        	wait(random(1200,1700)+random(1000,1800));
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				//walkPathMM(temp);
    			}
    		}
        	RSTile TempTile2 = new RSTile (knighttile.getX()+random(-2,2),knighttile.getY()+random(-2,2));
        	walkTo(TempTile2); 	
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				fights();
    			}
    		}
        }    
        
        //private void openGate() {
    		
    	//}
    
        
        public RSTile getNearest(final ArrayList<RSTile> tiles, final RSTile t) {
    		RSTile nearest = tiles.get(0);
    		for (int i = 0; i < tiles.size(); i++) {
    			if (distanceBetween(tiles.get(i), t) < distanceBetween(nearest, t)) {
    				nearest = tiles.get(i);
    			}
    		}
    		return nearest;
    	}
    
        
        public RSTile[] genPath(final RSTile t) {
    		RSTile current = getMyPlayer().getLocation();
    		final ArrayList<RSTile> tiles = new ArrayList<RSTile>();
    		final ArrayList<RSTile> path = new ArrayList<RSTile>();
    
    		while (distanceBetween(t, current) > 2) {
    			final int x = current.getX();
    			final int y = current.getY();
    			tiles.add(new RSTile(x, y - 1));
    			tiles.add(new RSTile(x - 1, y));
    			tiles.add(new RSTile(x + 1, y));
    			tiles.add(new RSTile(x, y + 1));
    			tiles.add(new RSTile(x - 1, y - 1));
    			tiles.add(new RSTile(x + 1, y - 1));
    			tiles.add(new RSTile(x + 1, y + 1));
    			tiles.add(new RSTile(x - 1, y + 1));
    			final RSTile tile = getNearest(tiles, t);
    			path.add(tile);
    			this.path = path.toArray(new RSTile[path.size()]);
    			current = tile;
    			tiles.clear();
    		}
    		this.path = path.toArray(new RSTile[path.size()]);
    		return this.path;
    	}
    
        public boolean WalkCorrectPath(String SideLoc, String portal, RSTile[] Paths){
        	if(SideLoc=="Left"){
        		if(portal=="West" || portal=="South West"){
        			Paths = reversePath(Paths);
        		}
        	}
        	if(!(SideLoc=="Left")){
        		if(portal=="West" || portal=="South West"){
        			if(getLocation().getX()>portaltw.getX()){
        				if(getLocation().getY()>rocktile.getY()+20)
        					Paths = reversePath(Paths);
        			}
        		}
        	}
        	if(!(walkPathMM(Paths))){
    			if(onisland()){
    				//if(!(walkPathMM(randomizePath(genPath(path.get(path.size()-1)), 2, 2), 10))){
    				if(!(walkPathMM(randomizePath(genPath(Paths[Paths.length-1]), 2, 2), 10))){
    					if(onisland()){
    						if(!walkPathMM(randomizePath(genPath(portaltw), 2, 2), 12)) {
    							log("Please post about a walk SUGGESTION (Not error)");
    							log("Suggestion to post: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()+ " P:"+portal));
    						}
    					}
    				}
    			}
    		}
        	return true;
        }
        
        public void walktoportal(String portal) {
        	 ArrayList<RSTile> path = new ArrayList<RSTile>();
        	 if(path.size()>1){
        		 path.clear();
        	 }
        	if(onisland()){
        		if(portal=="West") {
        			portaltw = new RSTile (rocktile.getX()-31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-random(10,12),rocktile.getY()-random(9,11)));
        			path.add(new RSTile (rocktile.getX()-random(17,19),rocktile.getY()-random(13,15))); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-18));//Right before portal
        			path.add(new RSTile (rocktile.getX()-28,rocktile.getY()-17)); 
        		}
        		if(portal=="East"){
        			portaltw = new RSTile (rocktile.getX()+31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+random(7,9),rocktile.getY()-28));
        			path.add(new RSTile (rocktile.getX()+random(16,18),rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()+random(26,31),rocktile.getY()-random(18,21)));
        		}
        		if(portal=="South East"){
        			portaltw = new RSTile (rocktile.getX()+7,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate		
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+8,rocktile.getY()-36)); //Right before portal
        		}
        		if(portal=="South West"){
        			portaltw = new RSTile (rocktile.getX()-16,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()-14,rocktile.getY()-33));
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-38)); //Right before portal
        		}
        		//if(gateclosed){
        			//opengate();
        		//}
        		WalkCorrectPath(side(), portal,path.toArray( new RSTile[ path.size() ] ));
        		//walkPathMM(randomizePath(genPath(portaltw), 2, 2), 10);
        	}
        }
        
        public boolean closeportal(String Portalz){
        	int westpi, eastpi, sepi,swpi;
        	westpi = distanceTo(new RSTile (rocktile.getX()-31,rocktile.getY()-20));
        	eastpi = distanceTo(new RSTile (rocktile.getX()+31,rocktile.getY()-20));
        	sepi = distanceTo(new RSTile (rocktile.getX()+7,rocktile.getY()-40));
        	swpi = distanceTo(new RSTile (rocktile.getX()-16,rocktile.getY()-40));
    	    if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    	 log("Close west");
    	    }
    		if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    			log("Close east");
    		}
    		if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    			log("Close sep");
    		}
    		if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    			log("Close swp");
    		}
        	
        	if(Portalz=="westp"){
    	    	if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    		return true;
    	    	}
        	}
        	if(Portalz=="eastp"){
    			if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    				return true;
    			}
        	}
    		if(Portalz=="sep"){
    			if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    				return true;
    			}
    		}
    		if(Portalz=="swp"){
    			if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    				return true;
    			}
    		}
        	return false;
        }
        
        public boolean walktoaportal(boolean realwalk) {
        	if(onisland()){
        		final RSInterface portalface = RSInterface.getInterface(408);
        		if (portalface.isValid()) {
        			westp = Integer.parseInt(RSInterface.getChildInterface(408,13).getText());
        			eastp = Integer.parseInt(RSInterface.getChildInterface(408,14).getText());
        			sep = Integer.parseInt(RSInterface.getChildInterface(408,15).getText());
        			swp = Integer.parseInt(RSInterface.getChildInterface(408,16).getText());
        			
        		}
        		portalname = "null!";
        		//boolean skip = false;
        		//int myrand;
        		if(p4match){
        			//myrand=10;
        		} else {
        			//myrand = random(1,4);
        		}
        		//log("Random portal = "+ myrand);
        		if(eastp>=40){//&& closeportal("eastp")){
        			portalname = "East";
        			//if(myrand==1){
        				//skip = true;
        				//p4match = true;
        				
        			//}
        		}
        		if(sep>=40){ //&& !(skip) && closeportal("sep")){
        			portalname = "South East";
        			//if(myrand==2){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(swp>=40){ //&& !(skip) && closeportal("swp")){
        			portalname = "South West";
        			//if(myrand==3){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(westp>=40){ // && !(skip) && closeportal("westp")){
        			//if(myrand==4){
        				//skip = true;
        				//p4match = true;
        			//}
        			portalname = "West";
        		}
        		if(!(portalname=="null!")&&realwalk){
        			walktoportal(portalname);
        		} else if(!(portalname=="null!")){
        			return true;
        		}
        		else return false;
        	}
        	return true;
        }
    
    	public boolean abletoattack() {
          return(getMyPlayer().getInteracting() == null);	
        }
        
        public int getSpec() {
    		return getSetting(300)/10;
    	}
        
        public boolean prayerenabled() {
    		return getSetting(1396)>0;
    	}
    
    	boolean specEnabled() {
    		return (getSetting(301)) == 1;
    	}
    
    	void doSpec() {
    		if(onisland()){
    			if (getSpec() == 100 && !specEnabled() && usespec) {
    				openTab(Constants.TAB_ATTACK);
    				clickMouse(645 + random(0, 4), 425 + random(0, 4), true);
    				wait(random(500, 1000));
    			} else {
    				wait(random(10, 50));
    			}
    		}
    	}
    
        
        public boolean cangetonboat(String boat) {
        	return !(RSInterface.getInterface(243).isValid()) || !(RSInterface.getInterface(211).isValid() || !RSInterface.getInterface(242).isValid()); 	
        }
        
        public boolean notbuyarmour() {
        	if(buytop&&!(topbuy)){
        		return false;
        	}
        	if(buybottom&&!(bottombuy)){
        		return false;
        	}
        	if(buygloves&&!(glovesbuy)){
        		return false;
        	}
        	if(buymace&&!(macebuy)){
        		return false;
        	}
        	return true;
        }
        
        public boolean canaffordanitem() {
        	if(pcpoints>=150){
        		if(buygloves&&!glovesbuy) {
        			return true;
        		}
        	}
        	if(pcpoints==250){
        		if(buybottom&&!bottombuy) {
        			return true;
        		}
        		if(buytop&&!topbuy) {
        			return true;
        		}
        	}
        	return false;
        }
        
        public int gettheskill(String skill) {
        	if(tskill=="Melee"){	
    			if(skill=="Att"){
    				cons = Constants.STAT_ATTACK; 
    			}
    			if(skill=="Str"){
    				cons = Constants.STAT_STRENGTH;
    			}
    			if(skill=="Def"){
    				cons = Constants.STAT_DEFENSE;
    			}
    		} else if(skill=="Mage"){
    			cons = Constants.STAT_MAGIC;
    		} else if(skill=="Range"){
    			cons = Constants.STAT_RANGE;
    		} 
        	return  skills.getCurrentSkillLevel(cons);
        }
        
        public boolean canbuysomething() {
          if(logfullz&&pcpoints>=250-boatp+1){
        	  log("Have full points, ending script");
        	  stopScript(true);
          }
          if(logfullz) {
        	  return false;
          }
          if(pcpoints>=100&&buyskills&&notbuyarmour()){
        	  return true;
          }
          if(!notbuyarmour()) {
        	if(canaffordanitem()){
        		return true;
        	}
          }
          if(!logfullz &&pcpoints>=250-boatp+1 ){
        	  log.warning("Can not buy because your boat points wont add up to desired item");
        	  stopScript(true);
          }
          return false;
        }
        
        public void DoExchange() {
        	RSNPC knight;
        	if(outsideboat()){
        		for (int i = 0; i < topoints.length; i++) {
        			if(getNearestNPCByName("Void Knight").isOnScreen()){
        				break;
        			}
        			wait(random(1000,2500));
        			flags();
        			walkPathMM(topoints);
        		}
        		knight = getNearestNPCByName("Void Knight");
        		if(!(knight==null)){
        			if(!getNearestNPCByName("Void Knight").isOnScreen()){
        				walkTo(knight.getLocation());
        				waitToMove(2000);
            			flags();
        			}
        			atNPC(getNearestNPCByID(3788), "change");
        			wait(random(500,800));
        			flags();
        			wait(random(5000,8000));
        			SpendingPoints();
        		}
        	}    	
        }
        
        public boolean doslider(){
        	if (RSInterface.getInterface(267).isValid()) {	
        		clickMouse(random(473,483),random(180,195),true);
        		wait(random(4000,5000));
        		return true;
        	}
        	return false;
        }
        
        public void confirms() {
        	if (RSInterface.getInterface(267).isValid()) {	
        		atInterface(RSInterface.getInterface(267).getChild(101));
        		wait(random(4000,5000));
        	}
        }
        
        public void SpendingPoints() {
    		if (RSInterface.getInterface(267).isValid()) {				
    			if (skilltobuy == "Attack") { 
    				atInterface(RSInterface.getInterface(267).getChild(56));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Strength") { 
    				atInterface(RSInterface.getInterface(267).getChild(57));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Defence") { 
    				atInterface(RSInterface.getInterface(267).getChild(58));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Ranged") { 
    				atInterface(RSInterface.getInterface(267).getChild(59));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Magic") { 
    				atInterface(RSInterface.getInterface(267).getChild(60));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Hitpoints") { 
    				atInterface(RSInterface.getInterface(267).getChild(61));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Prayer") { 
    				atInterface(RSInterface.getInterface(267).getChild(62));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if(!notbuyarmour()) {
    		    	if(canaffordanitem()){
    		    		if(pcpoints>=150){
    		        		if(buygloves&&!glovesbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(44));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				glovesbuy = true;
    		        		}
    		        	}
    		        	if(pcpoints==250){
    		        		if(buybottom&&!bottombuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(43));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				bottombuy = true;
    		        		}
    		        		if(buytop&&!topbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(42));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				topbuy = true;
    		        		}
    		        		if(buymace&&!(macebuy)){
    		        			atInterface(RSInterface.getInterface(267).getChild(41));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				macebuy = true;
    		            	}
    		        	}
    		    	}
    		      }
    		} else {
    			atNPC(getNearestNPCByID(3788), "change");
    			wait(random(1000, 2000));
    		}
    	}
    
        
        public boolean died() {
        	if(inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getX(),topleftbb.getX(),topleftbb.getY(),bottomrightbb.getX(),bottomrightbb.getY())){
        		walkd = false;
        		return true;
        	}
        	return false;
        }
        
        public boolean byaportal() {
        	if(onisland()){
        		final RSNPC portal = getNearestNPCByName("Portal");
        		if(!(portal==null)){
        			if(distanceTo(portal.getLocation())>5){
        				return false;	
        			}
        			else return true;
        		}
        	}
        	return false;
        }
        
        public boolean shouldattack(){
        	if(walktoaportal(false) && !gotzealforround()) {
        		return true;
        	}
        	if(walktoaportal(false)){
        		return true; 
        	}
        	return walktoaportal(false) && !gotzealforround(); 
        }
        
        public boolean fights() {
        	if(onisland()){
        		RSNPC Me,Portal = null;
        		String[] me;
        		ArrayList<String> attz = new ArrayList<String>();
        		attz.add("Attack");
        		boolean mee = false;
        		int I;
        		if(!defendk){
        			//Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
        			Me = getNearestNPCByName(ta);
        		} else {
        			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
        		}
        		if(attportals){
        			Portal = getNearestNPCToAttackByName("Portal");	
    	    		if(!(Portal==null)){
    	    			me =Portal.getActions(); 
    	    			for(I=0; I < me.length; I++){
    	    				//log(me[I]);
    	    				if(attz.contains(me[I])){
    	    					mee=true;
    	    				}
    	    			}
    	    		}
    	    		if(!mee){
    					Portal = null;
    				}
        		}
        		
        		if(attportals&&(Portal != null)&&Portal.isOnScreen() && shouldattack()){
        			if(getMyPlayer().getInteracting() == null && (Portal != null) && Portal.isOnScreen()) {
        				try {
        					if(atNPC(Portal, "Attack Por")) {
        						wait(random(500,1000));
        						flags();
        						return true;
        					} else {
        						status = "Doing antiban";
        						antiban2();
        					}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		} else {
        			if(getMyPlayer().getInteracting() == null && (Me != null) && Me.isOnScreen() && shouldattack()) {
        				try {
    	    				if(atNPC(Me, "Attack " + Me.getName())) {
    	    					wait(random(500,1000));
    	    					flags();
    	    					return true;
    	    				} else {
    	    					status = "Doing antiban";
    	    					antiban2();
    	    					if(!defendk){
    	    		    			//RSNPC Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
    	    		    			Me = getNearestNPCByName(ta);
    	    		    		} else {
    	    		    			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
    	    		    		}
    	    					if(!(Me==null)&&Me.isOnScreen()) {
    	    						return true;
    	    					}
    	    				}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		}
        	}
        	return false;
        }
         
        public RSInterfaceChild getPrayerInterface() {
    		if (Bot.getClient().getRSInterfaceCache() == null) {
    			return null;
    		}
    		final RSInterface iface = RSInterface.getInterface(749);
    		final RSInterfaceChild child = iface.getChild(4);
    		
    		return child;
    	}
        
        public boolean DoQuickPrayers() {
        	int prayerp;
        	if(onisland()){
        		prayerp = Integer.parseInt(RSInterface.getChildInterface(749,4).getText());
        		if(!prayerenabled()) {
        			if(prayerp>0&&useqp){
        				final RSInterfaceChild cont = getPrayerInterface();
        				return (atInterface(cont));	
        			}
        		}
        	}
    		return false;
        	
        }
        
        public boolean enterboat() {
        	wait(random(2000,4000));
        	final RSInterface IFACE = RSInterface.getInterface(243);
    		final RSInterface IFACE2 = RSInterface.getInterface(211);
    		if (IFACE.isValid()) {
        		zealgained = zealgained + boatp;
    		} else if (IFACE2.isValid()) {
    			loz++;
        	}
        	if(!tileOnScreen(laddertile)) {
    			if(!tileOnMap(laddertile)&& !getMyPlayer().isMoving()){
    				walkPathMM(toboat, 10);
    			} else {
    				if(!getMyPlayer().isMoving()){
    					walkTo(laddertile);
    				}
    			}
    		} else {
    			final RSObject ladderid = getNearestObjectByID(ladderd);
    			if (ladderid != null && !insideboat() && !canbuysomething()) {
    				status = "Entering Boat";
    				wait(random(700,2400));
    				atObject(ladderid, "Cross");
    				wait(random(1000,2000));
    				if(!insideboat()){
    					wait(random(1000,1500));
    					atObject(ladderid, "Cross");
    					wait(random(1000,2000));
    				}
    				if(!insideboat()&& !cangetonboat("novice")){
    					return false;
    				}	
    			} else {
    				if(!insideboat()&& !cangetonboat("novice")){
    					//log("Failed to board boat");
    					return false;
    				}	
    			}
    		}
        	return false;
        }
        
    	@Override
    	public int loop() {
    		if(!firstlogin){
    			wait(random(3000,5000));
    			firstlogin = true;
    		}
    		wait(random(400,600));
    		setCameraAltitude(true);
    		if(startlvl==0){
    			if(tskill=="Mage"){
    				tskilld = tskill;
    			} else if(tskill=="Range"){
    				tskilld = tskill;
    			}
    			startlvl = gettheskill(tskilld);
    			
    		}		
    		if(outsideboat()){
    			if(canbuysomething()&&!insideboat()){
    				DoExchange();
    			}
    			walkd = false;
    			mappedisland = false;
    			setangleisland = false;
    			knighttile = new RSTile (0,0);
    			toplefttile = new RSTile (0,0);
    			bottomrighttile = new RSTile (0,0);
    			newround = true;
    			p4match = false;
    			enterboat();
    		}
    		if(insideboat()){
    			mappedisland = false;
    			walkd= false;
    			newround = true;
    			setangleisland = false;
    			p4match = false;
    			status = "Waiting on boat.";
    			return antiban();
    		}
    		
    		if(onisland()){
    			status = "Fighting!!!";
    			if(!setangleisland){
    				setRun(true);
    				setFightMode(dfightm);
    				wait(random(200,300));
    				setangleisland=true;
    			}
    			if(!mappedisland){
    				mapisland();		
    			}
    			//if(!walkd || died()) {
    				//walktoaportal();
    			//}	
    			
    			DoQuickPrayers();
    			doSpec();
    			if(defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && (getMyPlayer().getInteracting() == null)){
    						if(!byknight()){
    							walktoknight();
    						}
    					  }
    					}
    				} else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}
    			}
    			if(!defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && !byaportal() && (getMyPlayer().getInteracting() == null)){
    						if(!getMyPlayer().isMoving()) {
    							walktoaportal(true); 
    						}
    					}
    				}else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}				
    			}
    
    		return 200;
    	}
    		
    	
    
    
    
    	@Override
    	public boolean onStart(final Map<String, String> args) {
    		wtbs = args.get("wtbs");
    		knighttile = new RSTile (0,0);
    		toplefttile = new RSTile (0,0);
    		bottomrighttile = new RSTile (0,0);
    		final gui gui = new gui();
    		gui.setVisible(true);
    		try {
    			log("Checking for updates");
    			// Open the version text file
    			URLConnection url = new URL("http://www.zaszmedia.com/scripts/zpc/version.txt").openConnection();
    			// Create an input stream for it
    			BufferedReader reader = new BufferedReader(new InputStreamReader(url.getInputStream()));
    			// Check if the current version is out dated
    			if (Double.parseDouble(reader.readLine()) > version){
    				outdated = true;
    				log("You have an old version of the script!");
    				log("You can update by visiting http://www.rsbot.org/vb/showthread.php?t=177106");
    			} else {
    				outdated = false;
    				log("You have the latest version of the script!");
    			}
    			if (reader != null)
    				reader.close();
    		} catch (IOException e) {
    			Bot.getEventManager().removeListener(PaintListener.class, this);
    			log("Problem getting version.");
    			stopScript();
    		}
    
    		while (!startScript) {
    			wait(20);
    		}
    		return true;
    	}
    
    	
    	public boolean inAreza(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
    
    	
    	public int optionpaint() {
    		Mouse m = Bot.getClient().getMouse();
    		//bottom left then top right
    		if (inArea(m.x,m.y,560+50,226-60,560,226-10)) {
                return  1;
            }
            if (inArea(m.x,m.y,560+110,226-60,560+51,226-10)) {
            	return  2;
            }
            if (inArea(m.x,m.y,560+170,226-60,560+111,226-10)) {
            	return  3;
            }
    		return 0;
    	}
    	
    	// final int x = 300-50; orig
    	//int y = 16+75; orig
    	//g.fill3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.draw3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.setColor(new Color(60, 140, 200, 50)); orig
    	
    	public void onRepaint(Graphics g) {
            if (isLoggedIn()) {	
                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;
                
                final int x = 560;
    			int y = 226;
    			
    			if(newround && onisland()){
    				gamesplayed = gamesplayed + 1;
    				newround = false;
    			}
    			if(!(startlvl==0)){
    				gettheskill(tskilld);
    				startEXP = skills.getCurrentSkillExp(cons);
    			}
    			if(optionpaint()==0){
    				g.setColor(new Color(0, 0, 0, 175));	//new
    				g.fillRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				
    			}
    			if(optionpaint()==1){	
    				
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				if(onisland()){
    					g.drawString("Games played:"+ (gamesplayed-1), x, y);
    				} else {
    					g.drawString("Games played:"+gamesplayed, x, y);
    				}
    				if(pcpoints>0){
    					y = y + 16;
    					g.drawString("PCP Gained: "+zealgained+" Total PCP: "+pcpoints, x, y);	
    				} else {
    					y = y + 16;
    					g.drawString("PC Points Gained: "+zealgained, x, y);
    				}
    				y = y + 16;
    				if(onisland()&&gamesplayed>0){
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+ ((gamesplayed-1) - (zealgained/2)+ " Lack of Z: " + loz), x, y);
    				} else {
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+(gamesplayed - (zealgained/2) + " Lack of Z: " + loz), x, y);
    				}
    			}
    			if(optionpaint()==2){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y +16;
    				g.drawString("Using: "+tskill+" Skill: "+tskilld, x, y);
    				y = y + 16;
    				g.drawString("Start "+tskilld+" lvl: "+startlvl+" Current lvl: "+gettheskill(tskilld), x, y);
    			}
    				//if(!(knighttile.getX()==0)){
    					//y = y + 16;
    					//g.drawString("Knight tile: " + knighttile.getX()+","+knighttile.getY(), x, y);
    				//}
    			if(optionpaint()==3){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				g.drawString("Boat Kind:"+ boattb , x, y);
    				if(!(amode=="Mage")){
    					if(usespec){
    						y = y + 16;
    						g.drawString("Set to use spec when able", x, y);
    					}
    				}
    				if(!(knighttile.getX()==0)){
    					y = y + 16;
    					g.drawString("Earned Zeal for round "+gotzealforround(), x, y);
    					
    				}
    				if(onisland()){
    					y = y + 16;
    					g.drawString("By a portal: "+ byaportal(), x, y);
    					y = y + 16;
    					y = y + 16;
    					g.drawString("Island Tile: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()), x, y);
    				}
    			}
            } 
        }
    }
    
    Zasz's PC script, made by a very good script writer.
    He has the best auto enchanter out there and Out of 600 games of PC, I've gotten no points 7 times.
     
  17. Unread #9 - Mar 6, 2010 at 9:33 PM
  18. Tigerz
    Joined:
    Dec 24, 2008
    Posts:
    38
    Referrals:
    0
    Sythe Gold:
    0

    Tigerz Member

    Whats the best FREE pest control bot?

    Code:
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Map;
    
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JTabbedPane;
    import javax.swing.SwingConstants;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    
    import org.rsbot.bot.Bot;
    import org.rsbot.bot.input.Mouse;
    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.RSInterfaceChild;
    import org.rsbot.script.wrappers.RSNPC;
    import org.rsbot.script.wrappers.RSObject;
    import org.rsbot.script.wrappers.RSTile;
    
    
    
    
    
    
    @ScriptManifest(authors = { "Zasz" }, category = "Combat", name = "Zasz's Pest Control", version = 1.00, description = "<html><head>"
    	+ "</head><body>"
    	+ "<center><strong><h2>Zasz's Pest Control!</h2></strong></center>"
    	+ "<center></center><br />"
    	+ "<br>"
    	+ " <center><B>Click start for the GUI!.</b>"
    	+ "<strong></strong>" 
    	+ "</center><br>"
    	+ "</body></html>")
    
    public class ZaSzPC extends Script implements PaintListener {
    	public long startTime = System.currentTimeMillis();
    	public long tsa,tsw;
        boolean hasset, buys,buymace,buytop,buybottom,buygloves,buyskills,mappedisland,firstlogin,setangleisland;
        boolean macebuy,topbuy,bottombuy,glovesbuy;
        boolean newround,usespec, logfullz, outdated, walkd, attportals, useqp, defendk, p4match;
        boolean makep =  true;
        public boolean startScript = false;
        private String status = "";
        String wtbs,portalname;
        String tskill, amode,tskilld, skilltobuy, helmtobuy, boattb;
        int dfightm, startlvl,gamesplayed, pcpoints, cons, startEXP, Location,ladderd,boatp,loz;
    	long eph;
    	int lastportalopend,portalid;
        int zealgained = 0;
        int westp,eastp,sep,swp;
        int[] monsters = {3734,3735,3733};
        String[] wtb, ta;
        RSTile knighttile, boattilen, boattiles;
        RSTile rocktile,bottomrighttile,toplefttile,battlefield;
        RSTile bottomrightk,topleftk, bottomrightbb, topleftbb;
        RSTile laddertile;
        RSTile portaltw;
        String cp = "";
        public double version = 1.5;
    	private RSTile[] path,toboat,topoints;
    
        public class gui extends JFrame 
        { 
        	/**
    		 * 
    		 */
    		private static final long serialVersionUID = 1337L;
    		// Variables declaration 
        	private JTabbedPane jTabbedPane1; 
        	private JButton jButton1; 
        	private JPanel contentPane; 
        	//----- 
        	private JLabel jLabel2; 
        	private JLabel jLabel5; 
        	private JLabel jLabel6; 
        	private JPanel jPanel1; 
        	//----- 
        	private JLabel jLabel7; 
        	private JLabel jLabel8; 
        	private JLabel jLabel9; 
        	private JLabel jLabel10; 
        	private JLabel jLabel12; 
        	private JComboBox jComboBox1; 
        	private JComboBox jComboBox2; 
        	private JComboBox jComboBox3;
        	private JComboBox jComboBox4;
        	private JComboBox jComboBox5; // Boat
        	private JCheckBox jCheckBox3;  
        	private JCheckBox jCheckBox4; 
         	private JCheckBox jCheckBox5; 
         	private JCheckBox jCheckBox6;// Att portal 
         	private JCheckBox jCheckBox7; // Use quick Prayer
         	private JCheckBox jCheckBox8; // Defend Knight
        	private JPanel jPanel2; 
        	//----- 
        	private JPanel jPanel3; 
        	//----- 
        	private JPanel jPanel4; 
        	
        	private JRadioButton jRadioButton1; 
         	private JRadioButton jRadioButton2; 
         	private JRadioButton jRadioButton3; 
         	private JRadioButton jRadioButton4; 
         	private JRadioButton jRadioButton5; 
         	private JRadioButton jRadioButton6; 
         	private JRadioButton jRadioButton7; 
         	private JRadioButton jRadioButton8; 
         	private JRadioButton jRadioButton9; 
         	private JRadioButton jRadioButton10; 
         	private JRadioButton jRadioButton11; 
        	// End of variables declaration 
         
         
        	public gui() 
        	{ 
        		super(); 
        		initializeComponent(); 
        		
         
        		this.setVisible(true); 
        	} 
         
        	/** 
        	 * This method is called from within the constructor to initialize the form. 
        	 * WARNING: Do NOT modify this code. The content of this method is always regenerated 
        	 * by the Windows Form Designer. Otherwise, retrieving design might not work properly. 
        	 * Tip: If you must revise this method, please backup this GUI file for JFrameBuilder 
        	 * to retrieve your design properly in future, before revising this method. 
        	 */ 
        	private void initializeComponent() 
        	{ 
        		jTabbedPane1 = new JTabbedPane(); 
        		jButton1 = new JButton(); 
        		contentPane = (JPanel)this.getContentPane(); 
        		//----- 
        		jLabel2 = new JLabel(); 
        		jLabel5 = new JLabel(); 
        		jLabel6 = new JLabel(); 
        		jPanel1 = new JPanel(); 
        		jCheckBox3 = new JCheckBox(); 
        		//----- 
        		jLabel7 = new JLabel(); 
        		jLabel8 = new JLabel(); 
        		jLabel9 = new JLabel();
        		jLabel10 = new JLabel();
        		jLabel12 = new JLabel();
        		jComboBox1 = new JComboBox(); 
        		jComboBox2 = new JComboBox(); 
        		jComboBox3 = new JComboBox(); 
        		jComboBox4 = new JComboBox();
        		jComboBox5 = new JComboBox();
        		jPanel2 = new JPanel();
        		jCheckBox4 = new JCheckBox(); 
         		jCheckBox5 = new JCheckBox(); 
         		jCheckBox6 = new JCheckBox();
         		jCheckBox7 = new JCheckBox();
         		jCheckBox8 = new JCheckBox();
        		jRadioButton1 = new JRadioButton(); 
         		jRadioButton2 = new JRadioButton(); 
         		jRadioButton3 = new JRadioButton();
         		jRadioButton4 = new JRadioButton(); 
        		jRadioButton5 = new JRadioButton();
        		jRadioButton6 = new JRadioButton();
        		jRadioButton7 = new JRadioButton();
        		jRadioButton8 = new JRadioButton();
        		jRadioButton9 = new JRadioButton();
        		jRadioButton10 = new JRadioButton();
        		jRadioButton11 = new JRadioButton();
        		//----- 
        		jPanel3 = new JPanel(); 
        		//----- 
        		jPanel4 = new JPanel();
        		// 
        		// jTabbedPane1 
        		// 
        		jTabbedPane1.addTab("Description", jPanel1); 
        		jTabbedPane1.addTab("Combat Options", jPanel2); 
        		jTabbedPane1.addTab("Island Options", jPanel4); 
        		jTabbedPane1.addTab("Zeal Options", jPanel3); 
        		jTabbedPane1.addChangeListener(new ChangeListener() { 
        			public void stateChanged(ChangeEvent e) 
        			{ 
        				jTabbedPane1_stateChanged(e); 
        			} 
         
        		}); 
        		// 
        		// jButton1 
        		// 
        		jButton1.setText("Start Script!"); 
        		jButton1.addActionListener(new ActionListener() { 
        			public void actionPerformed(ActionEvent e) 
        			{ 
        				jButton1_actionPerformed(e); 
        			} 
         
        		}); 
        		// 
        		// contentPane 
        		// 
        		contentPane.setLayout(null); 
        		addComponent(contentPane, jTabbedPane1, 0,0,373,221); 
        		addComponent(contentPane, jButton1, 124,240,106,28); 
        		// 
        		// jLabel2 
        		// 
        		jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); 
        		jLabel2.setHorizontalTextPosition(SwingConstants.LEADING); 
        		jLabel2.setText("ZaSz\'s Pest Control: By ZaSz"); 
        		// 
        		// jLabel5 
        		// 
        		jLabel5.setText("Start this script either at Pest Control bank. Or near the landers!"); 
        		// 
        		// jLabel6 
        		// 
        		jLabel6.setText("Make sure to fill out all the options! Or this script won\'t work for you!"); 
        		// 
        		// jPanel1 
        		// 
        		jPanel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel1.add(jLabel2, 0); 
        		jPanel1.add(jLabel5, 1); 
        		jPanel1.add(jLabel6, 2); 
        		jPanel1.setOpaque(true); 
        		// 
        		// jLabel7 
        		// 
        		jLabel7.setText("Combat Style"); 
        		// 
         		// jLabel8 
         		// 
         		jLabel8.setText("Attack style "); 
         		// 
         		// jLabel9 
         		// 
         		jLabel9.setText("Skill to buy");
         		// 
         		// jLabel10 
         		// 
         		jLabel10.setText("Boat to use:    ");
         		// 
         		// jCheckBox3 
         		// 
         		jCheckBox3.setText("Use special Attacks when applicable? (Range/Melee only)"); 
         		// jCheckBox4 
         		// 
         		jCheckBox4.setText("logout at full zeal (Can't buy anything else if you pick)"); 
         		// 
         		// jCheckBox5 
         		// 
         		jCheckBox5.setText("Use Zeal to buy skills.    ");
         		// 
         		// jCheckBox6 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox7
         		// 
         		jCheckBox7.setText("Use Quick Prayer.       "); 
         		// 
         		// jCheckBox8
         		// 
         		jCheckBox8.setText("Defend the knight instead of portals.  "); 
         		// 
         		// jRadioButton1 
         		// 
         		//(Use dropdown box to select)
         		jRadioButton1.setText("Buy a helm  (Helms/Void armour not able this version)"); 
         		// 
         		// jRadioButton2 
         		// 
         		jRadioButton2.setText("Buy Void Top"); 
         		// 
         		// jRadioButton3 
         		// 
         		jRadioButton3.setText("Buy Void Bottom"); 
         		// 
         		// jRadioButton4 
         		// 
         		jRadioButton4.setText("Buy Void Gloves"); 
         		// 
         		// jRadioButton5 
         		// 
         		jRadioButton5.setText("Buy Void Mace         "); 
        		// 
        		// jComboBox1 
        		// 
        		jComboBox1.addItem("Melee"); 
        		jComboBox1.addItem("Range"); 
        		jComboBox1.addItem("Mage"); 
        		// 
         		// jComboBox2 
         		// 
         		jComboBox2.addItem("Accurate (Att/Range/Mage)"); 
         		jComboBox2.addItem("Strength/Rapid (Str/Range/Mage)"); 
         		jComboBox2.addItem("Defensive (Def/Def+range/Def+Mage"); 
         		// 
         		// jComboBox3 
         		// 
         		jComboBox3.addItem("Attack"); 
         		jComboBox3.addItem("Strength"); 
         		jComboBox3.addItem("Defence"); 
         		jComboBox3.addItem("Ranged"); 
         		jComboBox3.addItem("Magic"); 
         		jComboBox3.addItem("Hitpoints"); 
         		jComboBox3.addItem("Prayer"); 
         		
         		//
         		// jComboBox4
         		//
         		jComboBox4.addItem("Mage helm");
         		jComboBox4.addItem("Melee helm");
         		jComboBox4.addItem("Range helm");	
         		//
         		// jComboBox5
         		//
         		jComboBox5.addItem("Novice Boat");
         		jComboBox5.addItem("Intermediate Boat");
         		jComboBox5.addItem("Expert Boat");
        		// 
        		// jPanel2 
        		// 
         		jPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel2.add(jLabel7, 0); 
         		jPanel2.add(jComboBox1, 1); 
         		jPanel2.add(jCheckBox7,2);
         		jPanel2.add(jCheckBox3, 3); 
         		jPanel2.add(jLabel8, 4); 
         		jPanel2.add(jComboBox2, 5);
        		// 
        		// jPanel3 
        		// 
        		jPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
        		jPanel3.add(jCheckBox4, 0); 
         		jPanel3.add(jCheckBox5, 1); 
         		//jPanel3.add(jRadioButton1, 2); 
         		jPanel3.add(jRadioButton2, 2); 
         		jPanel3.add(jRadioButton3, 3); 
         		jPanel3.add(jRadioButton4, 4); 
         		jPanel3.add(jRadioButton5, 5); 
         		jPanel3.add(jLabel9, 6); 
         		jPanel3.add(jComboBox3, 7); 
         		//jPanel3.add(jComboBox4,9);
         		
         		/////////////////////////////////////////////////////////////////
         	// 
         		// jLabel1 
         		// 
         		jLabel10.setText("Boat To Use"); 
         		// 
         		// jLabel2 
         		// 
         		jLabel12.setText(" Monsters to Attack:  MUST HAVE SHIFTER IF DEFENDING KNIGHT!!!!          "); 
         		// 
         		// jCheckBox1 
         		// 
         		jCheckBox6.setText("Attack portals. (THIS IS NOT NEEDED TO WALK NEAR PORTALS!)"); 
         		// 
         		// jCheckBox2 
         		// 
         		jCheckBox8.setText("Defend Knight instead of portals"); 
         		// 
         		// jRadioButton1 "Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter"
         		// 
         		jRadioButton6.setText("  Spinner"); 
         		jRadioButton6.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton7.setText("Shifter"); 
         		jRadioButton7.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton8.setText("Torcher"); 
         		jRadioButton8.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton9.setText("Defiler"); 
         		jRadioButton9.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton10.setText("Brawler");
         		jRadioButton10.setSelected(true);
         	// 
         		// jRadioButton1 
         		// 
         		jRadioButton11.setText("Splatter"); 
         		jRadioButton11.setSelected(true);
         		////////////////////////////////////////////////////////////////////////
         		// 
        		// jPanel4  (ISLAND OPTIONS)
        		// 
         		jPanel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5)); 
         		jPanel4.add(jLabel10,0);
         		jPanel4.add(jComboBox5, 1); 
         		jPanel4.add(jCheckBox6, 2); 
         		jPanel4.add(jCheckBox8, 3); 
         		jPanel4.add(jLabel12, 4); 
         		jPanel4.add(jRadioButton6, 5); 
         		jPanel4.add(jRadioButton7, 6); 
         		jPanel4.add(jRadioButton8, 7); 
         		jPanel4.add(jRadioButton9, 8); 
         		jPanel4.add(jRadioButton10, 9); 
         		jPanel4.add(jRadioButton11, 10); 
         		
         		//jPanel4.add(, 4); 
         		//jPanel4.add();
        		// 
        		// gui 
        		// 
        		this.setTitle("Zasz\'s Pest Control!"); 
        		this.setLocation(new Point(168, 107)); 
        		this.setSize(new Dimension(395, 311)); 
        	} 
         
        	/** Add Component Without a Layout Manager (Absolute Positioning) */ 
        	private void addComponent(Container container,Component c,int x,int y,int width,int height) 
        	{ 
        		c.setBounds(x,y,width,height); 
        		container.add(c); 
        	} 
         
        	
        	private void jTabbedPane1_stateChanged(ChangeEvent e) 
        	{ 
        		System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called."); 
      
        	} 
      
        	
        	private void jButton1_actionPerformed(ActionEvent e) 
        	{ 
        		System.out.println("\njButton1_actionPerformed(ActionEvent e) called."); 
         
        		amode = jComboBox2.getSelectedItem().toString(); 
        		tskill = jComboBox1.getSelectedItem().toString();
        		Location = jComboBox1.getSelectedIndex();
        		usespec = jCheckBox3.isSelected();
        		buyskills = jCheckBox5.isSelected();
        		logfullz = jCheckBox4.isSelected();
        		//logfullz = true;
             	//int leng = 0;	
             	//if(jRadioButton6.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton7.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton8.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton9.isSelected()){
             	//	leng++;
             	//}
             	//if(jRadioButton10.isSelected()){
             ///		leng++;
        		//}
        		//if(jRadioButton11.isSelected()){
        		//	leng++;
        		//}
        		ArrayList<String> monsterztoatt = new ArrayList<String>();
    
        		if(jRadioButton6.isSelected()){
        			monsterztoatt.add("Spinner");
        		}
        		if(jRadioButton7.isSelected()){
        			monsterztoatt.add("Shifter");
        		}
        		if(jRadioButton8.isSelected()){
        				monsterztoatt.add("Torcher");
        			}
        		if(jRadioButton9.isSelected()){
        			monsterztoatt.add("Defiler");
        		}
        		if(jRadioButton10.isSelected()){
        			monsterztoatt.add("Brawler");
        		 }
        		if(jRadioButton11.isSelected()){
        			monsterztoatt.add("Splatter");
        		}
        		ta = monsterztoatt.toArray( new String[ monsterztoatt.size() ] );
        		if(!buyskills){
        			logfullz = true;
        		}
        		defendk = jCheckBox8.isSelected();
        		attportals = jCheckBox6.isSelected();
        		useqp = jCheckBox7.isSelected();
        		boattb = jComboBox5.getSelectedItem().toString();
        		if(boattb=="Novice Boat"){
        			ladderd = 14315;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2657, 2640)} ;
        			boattiles = new RSTile (2663, 2638); //SE
        			boattilen = new RSTile (2660, 2643); //NW
        			laddertile = new RSTile (2657,2639);
        			boatp = 2;
        		}
        		if(boattb=="Intermediate Boat"){
        			ladderd = 25631;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2644, 2644)} ;
        			boattiles = new RSTile (2641, 2642); //SE
        			boattilen = new RSTile (2638, 2647); //NW
        			laddertile = new RSTile (2644,2644);
        			boatp = 3;
        		}
        		if(boattb=="Expert Boat"){
        			ladderd = 25632;
        			toboat =  new RSTile[]{ new RSTile(2661, 2649),new RSTile(2649, 2647), new RSTile(2638, 2653)} ;
        			boattiles = new RSTile (2635, 2649); //SE
        			boattilen = new RSTile (2632, 2654); //NW
        			laddertile = new RSTile (2638,2653);
        			boatp = 4;
        		}
        		topoints = reversePath(toboat);
        		if(amode=="Accurate (Att/Range/Mage)"){
        			dfightm = 0;
        			tskilld = "Att";
        		} else
        		
        		if(amode=="Strength/Rapid (Str/Range/Mage)"){
        			dfightm = 1;
        			tskilld = "Str";
        		} else
        		if(amode=="Defensive (Def/Def+range/Def+Mage"){
        			if(!(tskill=="Range") || !(tskill=="Mage")){
        				dfightm = 3;
        			} else
        				dfightm = 2;
        			tskilld = "Def";
        		} else {		
        			tskilld=amode;			
        		}
        		
        		if(buyskills){
        			  skilltobuy = jComboBox3.getSelectedItem().toString();
        			  log("Buying: "+skilltobuy);
        		}
        		;
        		if(jRadioButton1.isSelected()){
        			helmtobuy = jComboBox4.getSelectedItem().toString();
        			//buyhelm = false; //delete when implemented TODO
        			//log("Buying: "+helmtobuy);
        		}
        		if(jRadioButton2.isSelected()){
        			buytop = true;
        			log("Buying: top");
        		}
        		if(jRadioButton3.isSelected()){
        			buybottom = true;
        			log("Buying: bottom");
        		}
        		if(jRadioButton4.isSelected()){
        			buygloves = true;
        			log("Buying: gloves");
        		}
        		if(jRadioButton5.isSelected()){
        			buymace = true;
        			buymace = false; //delete when implemented TODO
        			log("Buying: mace");
        			
        		}
        		
        		
    		
        		
        		
        		
        		
        		
        		
        		
    
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		
        		//if(leng==0){
        		// log("Must select a monster to attack!");	
        		//} else {
        			setVisible(false);
        			startScript = true;
        			//}
        	} 
       
        }
        
        public boolean outsideboat() {
        	return distanceTo(laddertile)<40;
        }
        
        public boolean insideboat() {
        	final RSInterface IFACE = RSInterface.getInterface(407);
        	//if (pcpoints==0){
        	
        		if (IFACE.isValid()) {
        			String interfacet;
        			interfacet = RSInterface.getChildInterface(407,16).getText();
        			int interfacel,source,tempzeal;
        			interfacel = interfacet.length();
        			source = interfacet.indexOf(":");
        			String pointtext;
        			pointtext = interfacet.substring(source+2, interfacel);
        			tempzeal = Integer.parseInt(pointtext);
        			if(!(tempzeal==pcpoints)){
        				pcpoints = tempzeal;
        			}
        		}
        	//}
        	return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),boattiles.getX(),boattiles.getY(), boattilen.getX(), boattilen.getY());
        }
        
        public boolean onisland() {
        	if(!mappedisland){
        		final RSObject rock = getNearestObjectByID(5605);
        		if (rock != null) {
        			//log(""+rock.getLocation().getX()+","+rock.getLocation().getY()+" Distance:"+distanceTo(rock.getLocation()));
        			return distanceTo(rock.getLocation())<10;	
        		} else {
        			return false;
        		}
        	} else {
        		return inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getY(),toplefttile.getX(),toplefttile.getY(),bottomrighttile.getX(),bottomrighttile.getY());
        	}
        }
        
        public boolean inArea(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
        
        public String between(String main,String s1, String s2) {
        	  
        	  int length=s1.length();
    
        	  return main.substring(length,main.indexOf(s2,length));
    
        }
        
        public boolean gotzealforround() {
        	final RSInterface IFACE = RSInterface.getInterface(408);
        	if (IFACE.isValid()) {
        		return Integer.parseInt(RSInterface.getChildInterface(408,11).getText())>49;
        	} else
        		return false;
        }
        
        
        public void onFinish() {
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    	}
    
        
        public boolean flags() {
        	if(getMyPlayer().isMoving()){
        		long st = System.currentTimeMillis();
        		RSTile tile = getMyPlayer().getLocation();
        		while(System.currentTimeMillis() - st < 2000){
        			if(!tile.equals(getMyPlayer().getLocation())){
        				st = System.currentTimeMillis();
        	                        tile = getMyPlayer().getLocation();
        			}
        		}
        	} else {
        		return false;
        	}
        	return true;
        }
        
        public int antiban() {
        	final int randomNum = random(1, 18);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(4, 750);
    			final int y = random(4, 500);
    			moveMouse(x, y);
    			return random(1000, 1500);
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return random(500, 750);
    			} else {
    				return random(500, 750);
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return random(750, 1000);
    			}
    			if (getCurrentTab() != Constants.TAB_STATS) {
    				openTab(Constants.TAB_STATS);
    			}
    			moveMouse(560, 230, 40, 180);
    			wait(random(1000, 2000));
    			return random(500, 1500);
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return random(500, 750);
    			}
    		}	
    		return random(200,2000);
        }
        
        public void antiban2() {
        	if(!shouldattack()){
        		status = "Waiting Till end of round!";
        	}
        	final int randomNum = random(1, 14);
    
    		switch (randomNum) {
    		case 1:
    			wait(random(1000, 1500));
    			break;
    
    		case 2:
    			final int x = random(7, 750);
    			final int y = random(9, 500);
    			moveMouse(x, y);
    			return;
    
    		case 3:
    			if (getCurrentTab() != Constants.TAB_INVENTORY) {
    				openTab(Constants.TAB_INVENTORY);
    				return;
    			} else {
    				return;
    			}
    
    		case 4:
    			if (getMyPlayer().isMoving()) {
    				return;
    			}
    			
    			moveMouse(0, 0, 580, 480);
    			wait(random(1000, 2000));
    			return;
    
    		case 5:
    			if (random(1, 3) == 2) {
    				int angle = getCameraAngle() + random(-90, 90);
    				if (angle < 0) {
    					angle = 0;
    				}
    				if (angle > 359) {
    					angle = 0;
    				}
    
    				setCameraRotation(angle);
    				return;
    			}	
    		
    		case 6:
    			if(random(1,2)==1) {
    				setCameraAltitude(random(50,100));
    				return;
    			}
    		case 7: if(random(1,2)==1) {
    			setCameraAltitude(true);
    		}
    		case 8: if (random(1, 2) == 1){
    		    moveMouseSlightly();
    		    break;
    		}
    		}
    		return;
        }
        
        public void mapisland() {    	
        	final RSObject rock = getNearestObjectByID(5605);
        	if (rock != null) {
        		rocktile = rock.getLocation();
        		mappedisland = true;
        		status = "Mapping Out Island";
    			
        		bottomrightk = new RSTile (rocktile.getX()-8,rocktile.getY()-15);
    			topleftk = new RSTile (rocktile.getX()-3,rocktile.getY()-20);
        		knighttile = new RSTile (rocktile.getX()-6,rocktile.getY()-17);     		
        		toplefttile = new RSTile (rocktile.getX()+35,rocktile.getY()-55);  
        		bottomrighttile = new RSTile (rocktile.getX()-35,rocktile.getY()+20);  
        		bottomrightbb = new RSTile (rocktile.getX()-6,rocktile.getY()+4); // Boat on island
        		topleftbb = new RSTile (rocktile.getX()-3,rocktile.getY()-2); // Boat on island
        		battlefield = new RSTile (rocktile.getX()-5,rocktile.getY()-28);
        		//log("Rock Tile:"+rocktile.getX()+","+rocktile.getY());
        		//log("Knight Tile:"+knighttile.getX()+","+knighttile.getY());
        	} else {
        	}
        }
       
        public String side() {
        	if(getLocation().getX()-(rocktile.getX()-6)>=0){
        		return "Left";
        	} else 
        		return "Right";
        }
        
        public boolean byknight() {
        	return distanceTo(knighttile)<8;
        }
        
        public void walktoknight() {
        	RSTile TempTile = new RSTile (rocktile.getX()-random(((rocktile.getX()-knighttile.getX())/2),((rocktile.getX()-knighttile.getX())/2)+2),rocktile.getY()-random(((rocktile.getY()-knighttile.getY())/2),((rocktile.getY()-knighttile.getY())/2)+2));
        	walkTo(TempTile); 	
        	wait(random(1200,1700)+random(1000,1800));
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				//walkPathMM(temp);
    			}
    		}
        	RSTile TempTile2 = new RSTile (knighttile.getX()+random(-2,2),knighttile.getY()+random(-2,2));
        	walkTo(TempTile2); 	
        	if (waitToMove(random(800, 1200))) {
    			while (getMyPlayer().isMoving()) {
    				antiban2();
    				wait(15);
    				fights();
    			}
    		}
        }    
        
        //private void openGate() {
    		
    	//}
    
        
        public RSTile getNearest(final ArrayList<RSTile> tiles, final RSTile t) {
    		RSTile nearest = tiles.get(0);
    		for (int i = 0; i < tiles.size(); i++) {
    			if (distanceBetween(tiles.get(i), t) < distanceBetween(nearest, t)) {
    				nearest = tiles.get(i);
    			}
    		}
    		return nearest;
    	}
    
        
        public RSTile[] genPath(final RSTile t) {
    		RSTile current = getMyPlayer().getLocation();
    		final ArrayList<RSTile> tiles = new ArrayList<RSTile>();
    		final ArrayList<RSTile> path = new ArrayList<RSTile>();
    
    		while (distanceBetween(t, current) > 2) {
    			final int x = current.getX();
    			final int y = current.getY();
    			tiles.add(new RSTile(x, y - 1));
    			tiles.add(new RSTile(x - 1, y));
    			tiles.add(new RSTile(x + 1, y));
    			tiles.add(new RSTile(x, y + 1));
    			tiles.add(new RSTile(x - 1, y - 1));
    			tiles.add(new RSTile(x + 1, y - 1));
    			tiles.add(new RSTile(x + 1, y + 1));
    			tiles.add(new RSTile(x - 1, y + 1));
    			final RSTile tile = getNearest(tiles, t);
    			path.add(tile);
    			this.path = path.toArray(new RSTile[path.size()]);
    			current = tile;
    			tiles.clear();
    		}
    		this.path = path.toArray(new RSTile[path.size()]);
    		return this.path;
    	}
    
        public boolean WalkCorrectPath(String SideLoc, String portal, RSTile[] Paths){
        	if(SideLoc=="Left"){
        		if(portal=="West" || portal=="South West"){
        			Paths = reversePath(Paths);
        		}
        	}
        	if(!(SideLoc=="Left")){
        		if(portal=="West" || portal=="South West"){
        			if(getLocation().getX()>portaltw.getX()){
        				if(getLocation().getY()>rocktile.getY()+20)
        					Paths = reversePath(Paths);
        			}
        		}
        	}
        	if(!(walkPathMM(Paths))){
    			if(onisland()){
    				//if(!(walkPathMM(randomizePath(genPath(path.get(path.size()-1)), 2, 2), 10))){
    				if(!(walkPathMM(randomizePath(genPath(Paths[Paths.length-1]), 2, 2), 10))){
    					if(onisland()){
    						if(!walkPathMM(randomizePath(genPath(portaltw), 2, 2), 12)) {
    							log("Please post about a walk SUGGESTION (Not error)");
    							log("Suggestion to post: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()+ " P:"+portal));
    						}
    					}
    				}
    			}
    		}
        	return true;
        }
        
        public void walktoportal(String portal) {
        	 ArrayList<RSTile> path = new ArrayList<RSTile>();
        	 if(path.size()>1){
        		 path.clear();
        	 }
        	if(onisland()){
        		if(portal=="West") {
        			portaltw = new RSTile (rocktile.getX()-31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-random(10,12),rocktile.getY()-random(9,11)));
        			path.add(new RSTile (rocktile.getX()-random(17,19),rocktile.getY()-random(13,15))); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-18));//Right before portal
        			path.add(new RSTile (rocktile.getX()-28,rocktile.getY()-17)); 
        		}
        		if(portal=="East"){
        			portaltw = new RSTile (rocktile.getX()+31,rocktile.getY()-20);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+random(7,9),rocktile.getY()-28));
        			path.add(new RSTile (rocktile.getX()+random(16,18),rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()+random(26,31),rocktile.getY()-random(18,21)));
        		}
        		if(portal=="South East"){
        			portaltw = new RSTile (rocktile.getX()+7,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate		
        			path.add(new RSTile (rocktile.getX()-9,rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX(),rocktile.getY()-30));
        			path.add(new RSTile (rocktile.getX()+8,rocktile.getY()-36)); //Right before portal
        		}
        		if(portal=="South West"){
        			portaltw = new RSTile (rocktile.getX()-16,rocktile.getY()-40);
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-10));
        			path.add(new RSTile (rocktile.getX()-18,rocktile.getY()-14)); // Before gate
        			path.add(new RSTile (rocktile.getX()-22,rocktile.getY()-24));
        			path.add(new RSTile (rocktile.getX()-14,rocktile.getY()-33));
        			path.add(new RSTile (rocktile.getX()-12,rocktile.getY()-38)); //Right before portal
        		}
        		//if(gateclosed){
        			//opengate();
        		//}
        		WalkCorrectPath(side(), portal,path.toArray( new RSTile[ path.size() ] ));
        		//walkPathMM(randomizePath(genPath(portaltw), 2, 2), 10);
        	}
        }
        
        public boolean closeportal(String Portalz){
        	int westpi, eastpi, sepi,swpi;
        	westpi = distanceTo(new RSTile (rocktile.getX()-31,rocktile.getY()-20));
        	eastpi = distanceTo(new RSTile (rocktile.getX()+31,rocktile.getY()-20));
        	sepi = distanceTo(new RSTile (rocktile.getX()+7,rocktile.getY()-40));
        	swpi = distanceTo(new RSTile (rocktile.getX()-16,rocktile.getY()-40));
    	    if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    	 log("Close west");
    	    }
    		if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    			log("Close east");
    		}
    		if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    			log("Close sep");
    		}
    		if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    			log("Close swp");
    		}
        	
        	if(Portalz=="westp"){
    	    	if((westpi<eastpi) && (westpi<sepi) && (westpi<swpi)){
    	    		return true;
    	    	}
        	}
        	if(Portalz=="eastp"){
    			if((eastpi<westpi) && (eastpi<sepi) && (eastpi<swpi)){
    				return true;
    			}
        	}
    		if(Portalz=="sep"){
    			if((sepi<eastpi) && (sepi<westpi) && (sepi<swpi)){
    				return true;
    			}
    		}
    		if(Portalz=="swp"){
    			if((swpi<eastpi) && (swpi<sepi) && (swpi<westpi)){
    				return true;
    			}
    		}
        	return false;
        }
        
        public boolean walktoaportal(boolean realwalk) {
        	if(onisland()){
        		final RSInterface portalface = RSInterface.getInterface(408);
        		if (portalface.isValid()) {
        			westp = Integer.parseInt(RSInterface.getChildInterface(408,13).getText());
        			eastp = Integer.parseInt(RSInterface.getChildInterface(408,14).getText());
        			sep = Integer.parseInt(RSInterface.getChildInterface(408,15).getText());
        			swp = Integer.parseInt(RSInterface.getChildInterface(408,16).getText());
        			
        		}
        		portalname = "null!";
        		//boolean skip = false;
        		//int myrand;
        		if(p4match){
        			//myrand=10;
        		} else {
        			//myrand = random(1,4);
        		}
        		//log("Random portal = "+ myrand);
        		if(eastp>=40){//&& closeportal("eastp")){
        			portalname = "East";
        			//if(myrand==1){
        				//skip = true;
        				//p4match = true;
        				
        			//}
        		}
        		if(sep>=40){ //&& !(skip) && closeportal("sep")){
        			portalname = "South East";
        			//if(myrand==2){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(swp>=40){ //&& !(skip) && closeportal("swp")){
        			portalname = "South West";
        			//if(myrand==3){
        				//skip = true;
        				//p4match = true;
        			//}
        		}
        		if(westp>=40){ // && !(skip) && closeportal("westp")){
        			//if(myrand==4){
        				//skip = true;
        				//p4match = true;
        			//}
        			portalname = "West";
        		}
        		if(!(portalname=="null!")&&realwalk){
        			walktoportal(portalname);
        		} else if(!(portalname=="null!")){
        			return true;
        		}
        		else return false;
        	}
        	return true;
        }
    
    	public boolean abletoattack() {
          return(getMyPlayer().getInteracting() == null);	
        }
        
        public int getSpec() {
    		return getSetting(300)/10;
    	}
        
        public boolean prayerenabled() {
    		return getSetting(1396)>0;
    	}
    
    	boolean specEnabled() {
    		return (getSetting(301)) == 1;
    	}
    
    	void doSpec() {
    		if(onisland()){
    			if (getSpec() == 100 && !specEnabled() && usespec) {
    				openTab(Constants.TAB_ATTACK);
    				clickMouse(645 + random(0, 4), 425 + random(0, 4), true);
    				wait(random(500, 1000));
    			} else {
    				wait(random(10, 50));
    			}
    		}
    	}
    
        
        public boolean cangetonboat(String boat) {
        	return !(RSInterface.getInterface(243).isValid()) || !(RSInterface.getInterface(211).isValid() || !RSInterface.getInterface(242).isValid()); 	
        }
        
        public boolean notbuyarmour() {
        	if(buytop&&!(topbuy)){
        		return false;
        	}
        	if(buybottom&&!(bottombuy)){
        		return false;
        	}
        	if(buygloves&&!(glovesbuy)){
        		return false;
        	}
        	if(buymace&&!(macebuy)){
        		return false;
        	}
        	return true;
        }
        
        public boolean canaffordanitem() {
        	if(pcpoints>=150){
        		if(buygloves&&!glovesbuy) {
        			return true;
        		}
        	}
        	if(pcpoints==250){
        		if(buybottom&&!bottombuy) {
        			return true;
        		}
        		if(buytop&&!topbuy) {
        			return true;
        		}
        	}
        	return false;
        }
        
        public int gettheskill(String skill) {
        	if(tskill=="Melee"){	
    			if(skill=="Att"){
    				cons = Constants.STAT_ATTACK; 
    			}
    			if(skill=="Str"){
    				cons = Constants.STAT_STRENGTH;
    			}
    			if(skill=="Def"){
    				cons = Constants.STAT_DEFENSE;
    			}
    		} else if(skill=="Mage"){
    			cons = Constants.STAT_MAGIC;
    		} else if(skill=="Range"){
    			cons = Constants.STAT_RANGE;
    		} 
        	return  skills.getCurrentSkillLevel(cons);
        }
        
        public boolean canbuysomething() {
          if(logfullz&&pcpoints>=250-boatp+1){
        	  log("Have full points, ending script");
        	  stopScript(true);
          }
          if(logfullz) {
        	  return false;
          }
          if(pcpoints>=100&&buyskills&&notbuyarmour()){
        	  return true;
          }
          if(!notbuyarmour()) {
        	if(canaffordanitem()){
        		return true;
        	}
          }
          if(!logfullz &&pcpoints>=250-boatp+1 ){
        	  log.warning("Can not buy because your boat points wont add up to desired item");
        	  stopScript(true);
          }
          return false;
        }
        
        public void DoExchange() {
        	RSNPC knight;
        	if(outsideboat()){
        		for (int i = 0; i < topoints.length; i++) {
        			if(getNearestNPCByName("Void Knight").isOnScreen()){
        				break;
        			}
        			wait(random(1000,2500));
        			flags();
        			walkPathMM(topoints);
        		}
        		knight = getNearestNPCByName("Void Knight");
        		if(!(knight==null)){
        			if(!getNearestNPCByName("Void Knight").isOnScreen()){
        				walkTo(knight.getLocation());
        				waitToMove(2000);
            			flags();
        			}
        			atNPC(getNearestNPCByID(3788), "change");
        			wait(random(500,800));
        			flags();
        			wait(random(5000,8000));
        			SpendingPoints();
        		}
        	}    	
        }
        
        public boolean doslider(){
        	if (RSInterface.getInterface(267).isValid()) {	
        		clickMouse(random(473,483),random(180,195),true);
        		wait(random(4000,5000));
        		return true;
        	}
        	return false;
        }
        
        public void confirms() {
        	if (RSInterface.getInterface(267).isValid()) {	
        		atInterface(RSInterface.getInterface(267).getChild(101));
        		wait(random(4000,5000));
        	}
        }
        
        public void SpendingPoints() {
    		if (RSInterface.getInterface(267).isValid()) {				
    			if (skilltobuy == "Attack") { 
    				atInterface(RSInterface.getInterface(267).getChild(56));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Strength") { 
    				atInterface(RSInterface.getInterface(267).getChild(57));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Defence") { 
    				atInterface(RSInterface.getInterface(267).getChild(58));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Ranged") { 
    				atInterface(RSInterface.getInterface(267).getChild(59));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Magic") { 
    				atInterface(RSInterface.getInterface(267).getChild(60));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Hitpoints") { 
    				atInterface(RSInterface.getInterface(267).getChild(61));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if (skilltobuy == "Prayer") { 
    				atInterface(RSInterface.getInterface(267).getChild(62));								
    				wait(random(1000, 2000));								
    				confirms();
    			} else if(!notbuyarmour()) {
    		    	if(canaffordanitem()){
    		    		if(pcpoints>=150){
    		        		if(buygloves&&!glovesbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(44));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				glovesbuy = true;
    		        		}
    		        	}
    		        	if(pcpoints==250){
    		        		if(buybottom&&!bottombuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(43));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				bottombuy = true;
    		        		}
    		        		if(buytop&&!topbuy) {
    		        			atInterface(RSInterface.getInterface(267).getChild(42));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				topbuy = true;
    		        		}
    		        		if(buymace&&!(macebuy)){
    		        			atInterface(RSInterface.getInterface(267).getChild(41));
    		        			wait(random(1000, 2000));								
    		    				confirms();
    		    				macebuy = true;
    		            	}
    		        	}
    		    	}
    		      }
    		} else {
    			atNPC(getNearestNPCByID(3788), "change");
    			wait(random(1000, 2000));
    		}
    	}
    
        
        public boolean died() {
        	if(inArea(getMyPlayer().getLocation().getX(),getMyPlayer().getLocation().getX(),topleftbb.getX(),topleftbb.getY(),bottomrightbb.getX(),bottomrightbb.getY())){
        		walkd = false;
        		return true;
        	}
        	return false;
        }
        
        public boolean byaportal() {
        	if(onisland()){
        		final RSNPC portal = getNearestNPCByName("Portal");
        		if(!(portal==null)){
        			if(distanceTo(portal.getLocation())>5){
        				return false;	
        			}
        			else return true;
        		}
        	}
        	return false;
        }
        
        public boolean shouldattack(){
        	if(walktoaportal(false) && !gotzealforround()) {
        		return true;
        	}
        	if(walktoaportal(false)){
        		return true; 
        	}
        	return walktoaportal(false) && !gotzealforround(); 
        }
        
        public boolean fights() {
        	if(onisland()){
        		RSNPC Me,Portal = null;
        		String[] me;
        		ArrayList<String> attz = new ArrayList<String>();
        		attz.add("Attack");
        		boolean mee = false;
        		int I;
        		if(!defendk){
        			//Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
        			Me = getNearestNPCByName(ta);
        		} else {
        			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
        		}
        		if(attportals){
        			Portal = getNearestNPCToAttackByName("Portal");	
    	    		if(!(Portal==null)){
    	    			me =Portal.getActions(); 
    	    			for(I=0; I < me.length; I++){
    	    				//log(me[I]);
    	    				if(attz.contains(me[I])){
    	    					mee=true;
    	    				}
    	    			}
    	    		}
    	    		if(!mee){
    					Portal = null;
    				}
        		}
        		
        		if(attportals&&(Portal != null)&&Portal.isOnScreen() && shouldattack()){
        			if(getMyPlayer().getInteracting() == null && (Portal != null) && Portal.isOnScreen()) {
        				try {
        					if(atNPC(Portal, "Attack Por")) {
        						wait(random(500,1000));
        						flags();
        						return true;
        					} else {
        						status = "Doing antiban";
        						antiban2();
        					}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		} else {
        			if(getMyPlayer().getInteracting() == null && (Me != null) && Me.isOnScreen() && shouldattack()) {
        				try {
    	    				if(atNPC(Me, "Attack " + Me.getName())) {
    	    					wait(random(500,1000));
    	    					flags();
    	    					return true;
    	    				} else {
    	    					status = "Doing antiban";
    	    					antiban2();
    	    					if(!defendk){
    	    		    			//RSNPC Me = getNearestNPCByName("Spinner","Shifter","Brawler","Ravager","Torcher","Defiler","Splatter");
    	    		    			Me = getNearestNPCByName(ta);
    	    		    		} else {
    	    		    			Me = getNearestNPCByName("Shifter","Ravager","Torcher","Defiler");
    	    		    		}
    	    					if(!(Me==null)&&Me.isOnScreen()) {
    	    						return true;
    	    					}
    	    				}
        				} catch (IndexOutOfBoundsException  e) { 
        					log("Ignore the above error! Caused from teleporting while trying to fight.");
        				}
        			} else
        				antiban2();
        		}
        	}
        	return false;
        }
         
        public RSInterfaceChild getPrayerInterface() {
    		if (Bot.getClient().getRSInterfaceCache() == null) {
    			return null;
    		}
    		final RSInterface iface = RSInterface.getInterface(749);
    		final RSInterfaceChild child = iface.getChild(4);
    		
    		return child;
    	}
        
        public boolean DoQuickPrayers() {
        	int prayerp;
        	if(onisland()){
        		prayerp = Integer.parseInt(RSInterface.getChildInterface(749,4).getText());
        		if(!prayerenabled()) {
        			if(prayerp>0&&useqp){
        				final RSInterfaceChild cont = getPrayerInterface();
        				return (atInterface(cont));	
        			}
        		}
        	}
    		return false;
        	
        }
        
        public boolean enterboat() {
        	wait(random(2000,4000));
        	final RSInterface IFACE = RSInterface.getInterface(243);
    		final RSInterface IFACE2 = RSInterface.getInterface(211);
    		if (IFACE.isValid()) {
        		zealgained = zealgained + boatp;
    		} else if (IFACE2.isValid()) {
    			loz++;
        	}
        	if(!tileOnScreen(laddertile)) {
    			if(!tileOnMap(laddertile)&& !getMyPlayer().isMoving()){
    				walkPathMM(toboat, 10);
    			} else {
    				if(!getMyPlayer().isMoving()){
    					walkTo(laddertile);
    				}
    			}
    		} else {
    			final RSObject ladderid = getNearestObjectByID(ladderd);
    			if (ladderid != null && !insideboat() && !canbuysomething()) {
    				status = "Entering Boat";
    				wait(random(700,2400));
    				atObject(ladderid, "Cross");
    				wait(random(1000,2000));
    				if(!insideboat()){
    					wait(random(1000,1500));
    					atObject(ladderid, "Cross");
    					wait(random(1000,2000));
    				}
    				if(!insideboat()&& !cangetonboat("novice")){
    					return false;
    				}	
    			} else {
    				if(!insideboat()&& !cangetonboat("novice")){
    					//log("Failed to board boat");
    					return false;
    				}	
    			}
    		}
        	return false;
        }
        
    	@Override
    	public int loop() {
    		if(!firstlogin){
    			wait(random(3000,5000));
    			firstlogin = true;
    		}
    		wait(random(400,600));
    		setCameraAltitude(true);
    		if(startlvl==0){
    			if(tskill=="Mage"){
    				tskilld = tskill;
    			} else if(tskill=="Range"){
    				tskilld = tskill;
    			}
    			startlvl = gettheskill(tskilld);
    			
    		}		
    		if(outsideboat()){
    			if(canbuysomething()&&!insideboat()){
    				DoExchange();
    			}
    			walkd = false;
    			mappedisland = false;
    			setangleisland = false;
    			knighttile = new RSTile (0,0);
    			toplefttile = new RSTile (0,0);
    			bottomrighttile = new RSTile (0,0);
    			newround = true;
    			p4match = false;
    			enterboat();
    		}
    		if(insideboat()){
    			mappedisland = false;
    			walkd= false;
    			newround = true;
    			setangleisland = false;
    			p4match = false;
    			status = "Waiting on boat.";
    			return antiban();
    		}
    		
    		if(onisland()){
    			status = "Fighting!!!";
    			if(!setangleisland){
    				setRun(true);
    				setFightMode(dfightm);
    				wait(random(200,300));
    				setangleisland=true;
    			}
    			if(!mappedisland){
    				mapisland();		
    			}
    			//if(!walkd || died()) {
    				//walktoaportal();
    			//}	
    			
    			DoQuickPrayers();
    			doSpec();
    			if(defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && (getMyPlayer().getInteracting() == null)){
    						if(!byknight()){
    							walktoknight();
    						}
    					  }
    					}
    				} else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}
    			}
    			if(!defendk){
    				if(!getMyPlayer().isInCombat() || getMyPlayer().getInteracting() == null) {
    					if(!fights() && !byaportal() && (getMyPlayer().getInteracting() == null)){
    						if(!getMyPlayer().isMoving()) {
    							walktoaportal(true); 
    						}
    					}
    				}else if(getMyPlayer().isInCombat()){
    					status = "In Fight!";
    					antiban2();		
    				}				
    			}
    
    		return 200;
    	}
    		
    	
    
    
    
    	@Override
    	public boolean onStart(final Map<String, String> args) {
    		wtbs = args.get("wtbs");
    		knighttile = new RSTile (0,0);
    		toplefttile = new RSTile (0,0);
    		bottomrighttile = new RSTile (0,0);
    		final gui gui = new gui();
    		gui.setVisible(true);
    		try {
    			log("Checking for updates");
    			// Open the version text file
    			URLConnection url = new URL("http://www.zaszmedia.com/scripts/zpc/version.txt").openConnection();
    			// Create an input stream for it
    			BufferedReader reader = new BufferedReader(new InputStreamReader(url.getInputStream()));
    			// Check if the current version is out dated
    			if (Double.parseDouble(reader.readLine()) > version){
    				outdated = true;
    				log("You have an old version of the script!");
    				log("You can update by visiting http://www.rsbot.org/vb/showthread.php?t=177106");
    			} else {
    				outdated = false;
    				log("You have the latest version of the script!");
    			}
    			if (reader != null)
    				reader.close();
    		} catch (IOException e) {
    			Bot.getEventManager().removeListener(PaintListener.class, this);
    			log("Problem getting version.");
    			stopScript();
    		}
    
    		while (!startScript) {
    			wait(20);
    		}
    		return true;
    	}
    
    	
    	public boolean inAreza(final int x, final int y, final int maxX, final int minY, final int minX,final int maxY) {
    		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
    			return true;
    		}
    		return false;
    	}
    
    	
    	public int optionpaint() {
    		Mouse m = Bot.getClient().getMouse();
    		//bottom left then top right
    		if (inArea(m.x,m.y,560+50,226-60,560,226-10)) {
                return  1;
            }
            if (inArea(m.x,m.y,560+110,226-60,560+51,226-10)) {
            	return  2;
            }
            if (inArea(m.x,m.y,560+170,226-60,560+111,226-10)) {
            	return  3;
            }
    		return 0;
    	}
    	
    	// final int x = 300-50; orig
    	//int y = 16+75; orig
    	//g.fill3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.draw3DRect(295-50, 3+75, 222+50, 100+75, true); orig
    	//g.setColor(new Color(60, 140, 200, 50)); orig
    	
    	public void onRepaint(Graphics g) {
            if (isLoggedIn()) {	
                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;
                
                final int x = 560;
    			int y = 226;
    			
    			if(newround && onisland()){
    				gamesplayed = gamesplayed + 1;
    				newround = false;
    			}
    			if(!(startlvl==0)){
    				gettheskill(tskilld);
    				startEXP = skills.getCurrentSkillExp(cons);
    			}
    			if(optionpaint()==0){
    				g.setColor(new Color(0, 0, 0, 175));	//new
    				g.fillRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 95, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				
    			}
    			if(optionpaint()==1){	
    				
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				if(onisland()){
    					g.drawString("Games played:"+ (gamesplayed-1), x, y);
    				} else {
    					g.drawString("Games played:"+gamesplayed, x, y);
    				}
    				if(pcpoints>0){
    					y = y + 16;
    					g.drawString("PCP Gained: "+zealgained+" Total PCP: "+pcpoints, x, y);	
    				} else {
    					y = y + 16;
    					g.drawString("PC Points Gained: "+zealgained, x, y);
    				}
    				y = y + 16;
    				if(onisland()&&gamesplayed>0){
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+ ((gamesplayed-1) - (zealgained/2)+ " Lack of Z: " + loz), x, y);
    				} else {
    					g.drawString("Wins: "+ zealgained/2+" Losses: "+(gamesplayed - (zealgained/2) + " Lack of Z: " + loz), x, y);
    				}
    			}
    			if(optionpaint()==2){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y +16;
    				g.drawString("Using: "+tskill+" Skill: "+tskilld, x, y);
    				y = y + 16;
    				g.drawString("Start "+tskilld+" lvl: "+startlvl+" Current lvl: "+gettheskill(tskilld), x, y);
    			}
    				//if(!(knighttile.getX()==0)){
    					//y = y + 16;
    					//g.drawString("Knight tile: " + knighttile.getX()+","+knighttile.getY(), x, y);
    				//}
    			if(optionpaint()==3){
    				g.setColor(new Color(0, 0, 0, 175));
    				g.fillRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.drawRoundRect(555, 210-45, 175, 250+45, 10, 10); //new
    				g.setColor(Color.green);
    				g.drawString("Game", x, y-40);
    				g.drawLine(x+50, y-60, x+50, y-30);
    				g.drawString("Skills", x+60, y-40);
    				g.drawLine(x+110, y-60, x+110, y-30);
    				g.drawString("Misc", x+120, y-40);
    				
    				
    				g.setColor(Color.red);
    				g.drawString("	     Zasz's Pest Control!", x, y);
    				g.setColor(Color.white);
    				y = y + 16;
    				g.drawString("Status: " + status, x, y);
    				y = y + 16;
    				g.drawString("Time running :" + hours + ":" + minutes + ":"+ seconds + "", x, y);
    				y = y + 16;
    				g.drawString("Boat Kind:"+ boattb , x, y);
    				if(!(amode=="Mage")){
    					if(usespec){
    						y = y + 16;
    						g.drawString("Set to use spec when able", x, y);
    					}
    				}
    				if(!(knighttile.getX()==0)){
    					y = y + 16;
    					g.drawString("Earned Zeal for round "+gotzealforround(), x, y);
    					
    				}
    				if(onisland()){
    					y = y + 16;
    					g.drawString("By a portal: "+ byaportal(), x, y);
    					y = y + 16;
    					y = y + 16;
    					g.drawString("Island Tile: x-"+ (rocktile.getX()-getLocation().getX())+",y-"+(rocktile.getY()-getLocation().getY()), x, y);
    				}
    			}
            } 
        }
    }
    
    Zasz's PC script, made by a very good script writer.
    He has the best auto enchanter out there and Out of 600 games of PC, I've gotten no points 7 times.
     
  19. Unread #10 - Mar 7, 2010 at 1:29 AM
  20. phat-master
    Joined:
    Jul 18, 2009
    Posts:
    284
    Referrals:
    1
    Sythe Gold:
    0

    phat-master Forum Addict
    Banned

    Whats the best FREE pest control bot?

    out of 600 games of pc u have got no points 7 times? dont think ill try that one lol...
     
  21. Unread #11 - Mar 7, 2010 at 2:49 AM
  22. giedrius107
    Joined:
    Apr 26, 2008
    Posts:
    122
    Referrals:
    0
    Sythe Gold:
    0

    giedrius107 Active Member
    Banned

    Whats the best FREE pest control bot?

    was their a need to post that like 5 times?
     
  23. Unread #12 - Mar 7, 2010 at 6:08 AM
  24. davril101
    Joined:
    Mar 7, 2010
    Posts:
    50
    Referrals:
    0
    Sythe Gold:
    0

    davril101 Member

    Whats the best FREE pest control bot?

    Why would you post the entire code why not just discuss it on msn...
     
  25. Unread #13 - Mar 7, 2010 at 6:15 AM
  26. The Riddler_
    Joined:
    Nov 28, 2008
    Posts:
    2,779
    Referrals:
    3
    Sythe Gold:
    0

    The Riddler_ Grand Master
    Banned

    Whats the best FREE pest control bot?

    No, that's a good thing.

    593 Successful games
    7 Unsuccessful games

    Would a mod care to delete the superfluous posts?
     
  27. Unread #14 - Mar 7, 2010 at 8:04 AM
  28. zertoyah
    Joined:
    Mar 18, 2007
    Posts:
    66
    Referrals:
    0
    Sythe Gold:
    0

    zertoyah Member

    Whats the best FREE pest control bot?

    Noob , why are you posting that code so many times. Its just dumb.
     
  29. Unread #15 - Mar 7, 2010 at 9:49 AM
  30. damageplan
    Joined:
    Feb 8, 2009
    Posts:
    563
    Referrals:
    0
    Sythe Gold:
    0

    damageplan Forum Addict
    Banned

    Whats the best FREE pest control bot?

    The PCbot that comes on rsbot.com's "free rs2 bot" has a semi-decent script. It works, but it isn't special. I would go for rsbots.net premium, more likely to keep you pesting while you're not looking at your screen.
     
  31. Unread #16 - Mar 7, 2010 at 11:26 AM
  32. scylla
    Joined:
    Mar 25, 2007
    Posts:
    361
    Referrals:
    0
    Sythe Gold:
    0

    scylla Forum Addict

    Whats the best FREE pest control bot?

    Ok lets set things straight. Rsbot is still being updated by it's creator (it seems) here http://code.google.com/p/rsbot2/

    And since rsbot.org (maybe for good) is down you can unofficially get scripting help for it here
    http://vgchat.info/forum/f89-rsbot-org

     
  33. Unread #17 - Mar 7, 2010 at 11:53 AM
  34. I Eric I
    Joined:
    Nov 2, 2005
    Posts:
    1,676
    Referrals:
    0
    Sythe Gold:
    0

    I Eric I Guru
    Banned

    Whats the best FREE pest control bot?

    Id just pay for one of the premiere PC bots. Less likely to get banned and its more effective.
     
< Gp Transfer? | >FREE< Runescape Membership (No Surveys) >

Users viewing this thread
1 guest


 
 
Adblock breaks this site