Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Why is my script not working I've coded it perfectly and its not working the public int p isnt counting properly


    Light17

    Recommended Posts

    import java.awt.Graphics;
    import java.lang.Thread.State;
    import java.io.File;
    import org.ini4j.*;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.bank.BankLocation;
    import org.dreambot.api.methods.filter.Filter;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.walking.path.impl.LocalPath;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.GroundItem;
    
    @ScriptManifest(author = "Light17", name = "Rune_Glider", version = 2, description = "The most advanced in Artificial Intelligence and Social Intelligence!", category = Category.MONEYMAKING)
    
    public class Main extends AbstractScript {
    	public String SKILL = "Woodcutting"; //Specify Skill type
    	public String TREE = "Tree"; //Specify Tree Type
    	public boolean Phase_001 = false, Phase_002 = false, Phase_003 = false, Phase_004 = false, Phase_005 = false, Phase_006 = false, Phase_007 = false, Bank = false, Bank_no_axe = false, Bank_axe = false;
    	
    	public static String Current_Coordinates;
    	private State state;
    	public String Axe;
    	public int L, F, P, A, Path_Number;
    	      
    	public String Paths[][] = { {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"},
    		               {"3169,3454","3169,3454","3165,3455","3165,3455","3161,3457","3161,3457","3156,3456","3156,3456","9","10"} };
    
        public String Path_Tree_Coordinates[][] = { {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3155,3454","3154,3457","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"},
             {"3170,3454","3167,3452","3163,3454","3164,3457","3159,3458","3157,3454","3156,3456","3156,3456","9","10"} };
     
     
    	//Tree, Oak Tree, Willow Tree, Maple Tree, Yew Tree, Magic Tree
    
    	//---------------------------------------------------------------
    	
    	@Override
      	public void onStart() {
    		int X,Y;
    		log("-----------------------~Runeglider----------------------");
    		log("Starting! ~Runeglider...");
    		log("Ignition!... Sequence!!! Started!");
    		log("5... 4.... 3... 2... 1...");
    		log("Lift! Off!....");
    		log("Runeglider! in orbit....");
    		log("--------------------------------------------------------");
    	}
    	
    	
    	public void Identify_Skill_Levels() {
    		
    	}
    	
    	public void Detect_Axe() {		
    		if(getInventory().count("Bronze Axe") == 1) {
    			Axe="Bronze Axe";
    		}
    		
    		if(getInventory().count("Iron Axe") == 1) {
    			Axe="Iron Axe";
    		}
    		
    		if(getInventory().count("Steel Axe") == 1) {
    			Axe="Steel Axe";
    		}
    		
    		if(getInventory().count("Black Axe") == 1) {
    			Axe="Black Axe";
    		}
    		
    		if(getInventory().count("Mithril Axe") == 1) {
    			Axe="Mithril Axe";
    		}
    		
    		if(getInventory().count("Adamant Axe") == 1) {
    			Axe="Adamant Axe";
    		}
    		
    		if(getInventory().count("Rune Axe") == 1) {
    			Axe="Rune Axe";
    		}
    		
    		if(getInventory().count("Dragon Axe") == 1) {
    			Axe="Dragon Axe";		
    		}
    		
    	}
    	
    	
        private enum Action {
          ENACT_EMOTE, EQUIP_ITEM, CAST_SPELL, PICK_UP_ITEM, FIGHT, FISH, CUT, DROP, WAIT, BANK, GRAND_EXCHANGE_BUY, GRAND_EXCHANGE_SELL, STORE_BUY, STORE_SELL   
        };
        
        private enum State{
          LUMBRIDGE_CASTLE, VARROCK_EAST, VARROCK_EAST_BANK, VARROCK_EAST_TREE, VARROCK_EAST_OAK_TREE, VARROCK_WEST, VARROCK_WEST_BANK, VARROCK_WEST_TREE, VARROCK_WEST_OAK_TREE, VARROCK_WEST_TREES, VARROCK_WEST_OAK_TREES, VARROCK_EAST_TREES
          };
    
        //---------------------------------------------------------------
        
    
        
        private Action performAction() {
    		return null;
        	
        }
        
        public int Action() {
          switch (performAction()) {
            case ENACT_EMOTE:
            break;
            
    	    case BANK:
    		break;
    		
    	    case CAST_SPELL:
    		break;
    		
         	case CUT:
    		break;
    
         	case DROP:
    		break;
    
         	case EQUIP_ITEM:
    		break;
    
         	case FIGHT:
    		break;
    		
    	    case FISH:		
    		break;
    		
        	case GRAND_EXCHANGE_BUY:
    		break;
    		 
         	case GRAND_EXCHANGE_SELL:
    		break;
    
         	case PICK_UP_ITEM:
    		break;
    		
    	    case STORE_BUY:
    		break;
    		
        	case STORE_SELL:
    		break;
    		
         	case WAIT:
    		break;
          }
          return Calculations.random(500, 600);
        }
        //---------------------------------------------------------------
    
        
        private State getState(){
    		
        	int X,Y,Z;
    	    X=getLocalPlayer().getX();
    	    Y=getLocalPlayer().getY();
    	    Z=getLocalPlayer().getZ();
    	    log("Current Coordinates = X: " + Integer.toString(X) + " Y:" + Integer.toString(Y) + "  Z:" + Integer.toString(Z));
    	    
            if (((X>3203) & (Y<3234)) & ((X<3226) & (Y>3210))) {
              log("We are at the castle");
              return State.LUMBRIDGE_CASTLE;
            }    
            else if ((X>100) & (Y>100) & (X<100) & (Y<100)) {  
              return State.VARROCK_EAST;
            }
            else if ((X>100) & (Y>100) & (X<100) & (Y<100)) {  
                return State.VARROCK_EAST_BANK;
            }
            else if ((X>100) & (Y>100) & (X<100) & (Y<100)) {  
                return State.VARROCK_EAST_TREES;
            }
            else if ((X>100) & (Y>100) & (X<100) & (Y<100)) { 
                return State.VARROCK_EAST_OAK_TREE;
            }
            else if ((X>100) & (Y>100) & (X<100) & (Y<100)) {  
              return State.VARROCK_WEST;
            }
            else if ((X>=3180) & (Y<=3446) & (X<=3185) & (Y>=3433)) {  
              log("We are at the Varrock West Bank");
              return State.VARROCK_WEST_BANK;
            } 
            else if ((X>=3106) & (Y<=3470) & (X<=3176) & (Y>=3441)) { 
              log("We are at the Varrock West Trees");	
              return State.VARROCK_WEST_TREES;
            }
            else if ((X>100) & (Y>100) & (X<100) & (Y<100)) {  
                return State.VARROCK_WEST_OAK_TREES;
            } else 
    		  return null;
              
    
              
        }
        @Override
        public int onLoop() {
    		if(getLocalPlayer().isMoving()){
    			Tile dest = getClient().getDestination();
    			if(dest != null && getLocalPlayer().getTile().distance(dest) > 5){
    				return Calculations.random(200,400);
    			}
    		}
    		//we should add a run energy check too! see all the fun things we think of
    		if(!getWalking().isRunEnabled() && getWalking().getRunEnergy() > 70){
    			getWalking().toggleRun();
    		}
    		
    		//state = getState();
    
    		switch (getState()) {
          
      	    case LUMBRIDGE_CASTLE:
              log("We are located at the Lumbridge Castle Death Spawn spot!");
              log("Walking! to the place we need to be...");
              
      	      int I;
      	      I=5;
              while (I == 5) 
              { 
                  log("Navigating... to the correct Location Zone!");
                  getWalking().walk(new Tile(3183,3441,0));
                  sleep(Calculations.random(2000,7000));
                  
                  if(getLocalPlayer().distance(new Tile(3183,3441,0)) < 5) {
                    break;
                  }
              } 
              
              
              break;
      		case VARROCK_EAST:
      	  	  GameObject tree = getGameObjects().closest("Tea stall");
      	  	  //if (tree != null) {+
      	  	  //  tree.interact("Chop Down");	   
      		break;
      		case VARROCK_EAST_BANK:
      		  sleep(Calculations.random(500, 600));
      		break;
      		case VARROCK_WEST:
      		  sleep(Calculations.random(500, 600));
      		break;
      		case VARROCK_WEST_BANK:
      		{	
      		  
      		  if(Phase_001==false) {
      	      if((getInventory().count("Logs")==27) & (getInventory().count(Axe) == 1)) {
      		    log("The inventory is full of logs and 1 Axe");
      	   	    log("Lets bank!");
      	   	    Bank=true;
      	   	    Bank_axe=true;
      	     	Phase_001=true;
      	     	Phase_002=true;
      	  	  }
      		  }
      	      
      	      if(Phase_001==false) {
      	  	  if(getInventory().isFull() & (getInventory().count(Axe) == 0)){
      	  	    log("The inventory is full of logs");
      	  	   	log("Lets bank!");
      	  	    Bank=true;
      	    	Bank_no_axe=true;
      		    sleep(Calculations.random(500, 600));
      		    Phase_001=true;
      		    Phase_002=true;
      		  }
      	      }
      	  	  
      	  	  if(Bank==true) {
    
      	              if(Phase_002 == true)
      	              {
      		            getWalking().walk(new Tile(3183,3445,0));
      		            sleep(Calculations.random(2000,7000));
      	                if(getLocalPlayer().distance(new Tile(3183,3445,0)) < 5) {
      	                  Phase_002=false;
      	                  Phase_003=true;
      	                }
      	               }	
      	  		
      	  		if(Phase_003==true) {
      	  		NPC Bank_Deposit_Box_1 = getNpcs().closest("Banker");
      	  	    //sleep(Calculations.random(300,700));
      	  		if (Bank_Deposit_Box_1 != null) {
      	  	      log("Bank_Deposit_Box didn't = null");
      	  	      Bank_Deposit_Box_1.interact("Bank");
      	  	    
      	     	  sleep(Calculations.random(2000, 3600));
    
      	     	  if(Bank_axe==true) {
      	     		  log("Bank axe = true");
      	     		  Bank_axe=false;
                      getBank().depositAll("Logs");
                    }
                
                    if(Bank_no_axe==true) {
                    log("Bank axe = false");	
                    Bank_no_axe=false;	
              	    int i;
              	    i=Calculations.random(0,2);
             
              	    if(i==0) {
          	          getBank().depositAllItems();
              	    }
              	  
          	        if(i>=1){
                        getBank().depositAll("Logs");	
                      }   		
                    }
                
                    sleep(Calculations.random(100, 1600));
                    getBank().close();
                    Bank=false;
                    Phase_001=false;
                    Phase_003=false;
      	  	    }
      	  		}
      	  	  } 
    
      	  	 if((Bank==false) & (Phase_001==false)) {
      	     Phase_004=true;  
      	     log("Navigating to Trees!");  
      	  	 }
       		
                  if(Phase_004 == true)
                  {
    	            getWalking().walk(new Tile(3172,3452,0));
    	            sleep(Calculations.random(2000,7000));
                    if(getLocalPlayer().distance(new Tile(3172,3452,0)) < 5) {
                      Phase_004=false;
                    } 		 
      	  	     }
                  
      		}
        	break;
      		case VARROCK_WEST_TREES: {
      		   log("SSSs.....");
      		   
      		  if(Phase_001==false) {
      		  if(getInventory().isFull()) {
      	        Phase_001=true;
      	        Phase_002=true;
      		  }
      		  }
      		  
      	           if(Phase_002==true) {  
      	              log("Navigating... to the Varrock West Bank Location Zone!");
      	              getWalking().walk(new Tile(3183,3441,0));
      	              sleep(Calculations.random(2000,7000));
      	              
      	              if(getLocalPlayer().distance(new Tile(3183,3441,0)) < 5) {
      	            	sleep(Calculations.random(10000,19000));
      	                Phase_002=false;
      	                Phase_001=false;
      	                
      	          }       
      		  }
      		
      	    if(Phase_003==false) {		
      		if(!getInventory().isFull()) {
      			Phase_003=true;
      			Phase_004=true;
      	  		log("Navigating... to available trees");    
      	  	      // allocating memory for 5 integers. 
      	  			                      //Zone1  //Zone2
      	  	      Path_Number = Calculations.random(0,9);
      	  	     
      		      }
      	        }
      	    
      	          int B = 3;
                  int C = 3;
      	          
      	        	  
      	  	        if(Phase_004==true) {  
      	  	          log("Walking...");
      	  	          String str = Paths[Path_Number][P]; 
      	              String[] arrOfStr = str.split(",", 2);
      	          
    	              if(getLocalPlayer().distance(new Tile(Integer.parseInt(arrOfStr[0].trim()),Integer.parseInt(arrOfStr[1].trim()),0)) < 5) {
    	            	  Phase_004=false;
    	            	  Phase_005=true;  
    	            	  break;
    	              }   
    
    	              getWalking().walk(new Tile(Integer.parseInt(arrOfStr[0].trim()),Integer.parseInt(arrOfStr[1].trim()),0));
    	              sleep(Calculations.random(2000,7000));
    	              
    	              if(getLocalPlayer().distance(new Tile(Integer.parseInt(arrOfStr[0].trim()),Integer.parseInt(arrOfStr[1].trim()),0)) < 5) {
    	            	  Phase_004=false;
    	            	  Phase_005=true;
      	  	          }
      	  	        } 
      	  	       
      	  	       if(Phase_005==true) {
     	  	         String str_coordinates = Path_Tree_Coordinates[Path_Number][P]; 
     	  	         String[] Tree_Coordinates = str_coordinates.split(",", 2);
     	  	           log("Current Tree Coordinates = X: " + Integer.toString(Integer.parseInt(Tree_Coordinates[0].trim())) + " Y:" + Integer.toString(Integer.parseInt(Tree_Coordinates[1].trim())));
    		  	          F=getInventory().count("Logs");
    		  	        
    		  	        log("Detecting if tree is present at whatever tile");
    			  	  	GameObject Tree = getGameObjects().getTopObjectOnTile(new Tile(Integer.parseInt(Tree_Coordinates[0].trim()),Integer.parseInt(Tree_Coordinates[1].trim()),0));
    			  	    P=P+1;
    			  	    
    			  	  	log("P = " + Integer.toBinaryString(P));
    			  	    
    			  	  	Phase_004=true;
    			  	    Phase_005=false;
    			  	  	if(Tree.getRealID()==1278) {
    			          Tree.interact("Chop down"); 
    			          Phase_004=false;
    		
    			          Phase_006=true;
    			  	  	}
      	              }
    			  	  	
    		  	        if(Phase_006==true) { //Counting Logs and comparing to previous count 
    		  	        	log("Counting logs to detect when a new log enters the inventory!");
    		  	        	if(getInventory().count("Logs")>F) {
    		  	        	  Phase_006=false;
    		  	              Phase_004=true;
    		  	              break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  Phase_004=true;	
    		  	        	  Phase_006=false;
    		  	        	}
    		  	        	
    		  	        }     
    		      		 
    		      	           if(P==9) {
    		      	        	 P=0;
    		      	             Phase_004=false;
    		      	        	 Phase_003=false;
    		      	           }
      		}
      	    break;	
      		case VARROCK_WEST_OAK_TREES: { 
      		  sleep(Calculations.random(500, 600));
      		break;
      	  }
      		
      		
      	}
    		return Calculations.random(500, 600);
        }
    
      	@Override
    	public void onExit() {
      	
    		log("----------------------------------------------------");
    		log("   Stopped! ~Runeglider... 2020 V0.1");
    		log("----------------------------------------------------");
    	}
      	
       //---------------------------------------------------------------
      	
    }

     

    Script that isnt workign.png

    Link to comment
    Share on other sites

    Archived

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

    ×
    ×
    • Create New...

    Important Information

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