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 does my bot take over the mouse still after stopping it?


    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! Bot that ever existed...", category = Category.MONEYMAKING)
    
    public class Main extends AbstractScript {
    	public String SKILL = "Woodcutting"; //Specify Skill type
    	public String TREE = "Tree"; //Specify Tree Type
    	public boolean Bank = false, Bank_no_axe = false, Bank_axe = false;	
    	
    	public static String Current_Coordinates;
    	private State state;
    	public String Axe;
    	
    	//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";		
    		}
    		
    	}
    	
    	//---------------------------------------------------------------
    	public void Practise_Skill(String Skill, String Location) {
    
    	  if(Skill=="Woodcutting") {
    	    if(Location=="VARROCK_WEST_BANK") {
    	      if(TREE=="Tree") {
    	  	      int Z;
    	  	      
    	  	      Z=5;
    	  	     
    
    	  	          log("Woodcutting - Practising! - Tree Cutting...");
    		          log("Until LVL 15 Woodcutting!");
    		        
    		          log("Navigating Past The Trees To Find A Available Tree...");
    	              
    	              while (Z == 5)
    	              {
    		            getWalking().walk(new Tile(3168,3455,0));
    		            sleep(Calculations.random(2000,7000));
    	                if(getLocalPlayer().distance(new Tile(3168,3455,0)) < 5) {
    	                  break;
    	                }
    	               }
    	              
    	              log("Walked to the first Tree scoping position!");
    	              log("Checking for Uncut Trees!");
    
    	  	  		  GameObject Tree = getGameObjects().getTopObjectOnTile(new Tile(3170,3454,0));
    	  	  		 	  	      
    		  	      if(Tree.getRealID()==1278) {
    		  	        Tree.interact("Chop down");
    		  	        sleep(Calculations.random(500,1000));
    		  	        
    		  	        int I,A = 0;
    		  	          I=getInventory().count("Logs");
    		  	          
    		  	        while (Z == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>I) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		  	        	
    		  	      }
    		  	      
    		  	        if(getInventory().isFull()==true) {
    		  	        	return;
    		  	        }
    		  	        
    	  	  		  GameObject Tree2 = getGameObjects().getTopObjectOnTile(new Tile(3167,3452,0));
    	  	  		 if(Tree.getRealID()==1278) {
    		  	        Tree2.interact("Chop down");
    		  	        sleep(Calculations.random(500,1000));
    		  	        
    		  	        int I,A = 0;
    		  	          I=getInventory().count("Logs");
    		  	          
    		  	        while (Z == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>I) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		  	        	
    		  	      }
    	  	  		 
    		  	        if(getInventory().isFull()==true) {
    		  	        	return;
    		  	        }
    		  	        
    	  	          log("Woodcutting - Practising! - Tree Cutting...");
    		          log("Until LVL 15 Woodcutting!");
    		        
    		          log("Navigating Past The Trees To Find A Available Tree...");
    	              
    	              while (Z == 5)
    	              {
    		            getWalking().walk(new Tile(3165,3456,0));
    		            sleep(Calculations.random(2000,7000));
    	                if(getLocalPlayer().distance(new Tile(3165,3456,0)) < 5) {
    	                  break;
    	                }
    	               }
    	              
    	              log("Walked to the second Tree scoping position!");
    	              log("Checking for Uncut Trees!");
    
    	  	  		  GameObject Tree3 = getGameObjects().getTopObjectOnTile(new Tile(3163,3454,0));
    
    	  	  	       if(Tree3.getRealID()==1278) {
    		  	    	  
    		  	        Tree3.interact("Chop down");
    		  	        sleep(Calculations.random(500,1000));
    		  	        
    		  	        int I,A = 0;
    		  	          I=getInventory().count("Logs");
    		  	          
    		  	        while (Z == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>I) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		  	        	
    		  	      }
    		  	       
    		  	        if(getInventory().isFull()==true) {
    		  	        	return;
    		  	        }
    		  	        
    	  	  		  GameObject Tree4 = getGameObjects().getTopObjectOnTile(new Tile(3164,3457,0));
    	  	  		if(Tree4.getRealID()==1278) {
    		  	        Tree4.interact("Chop down");
    
    		  	        int I,A = 0;
    		  	          I=getInventory().count("Logs");
    		  	          
    		  	        while (Z == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>I) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		  	        	
    		  	      }
    		  	      
    	  	        if(getInventory().isFull()==true) {
    	  	        	return;
    	  	        }
    	  	        
    	  	          log("Woodcutting - Practising! - Tree Cutting...");
    		          log("Until LVL 15 Woodcutting!");
    		        
    		          log("Navigating Past The Trees To Find A Available Tree...");
    	              
    	              while (Z == 5)
    	              {
    		            getWalking().walk(new Tile(3160,3456,0));
    		            sleep(Calculations.random(2000,7000));
    	                if(getLocalPlayer().distance(new Tile(3160,3456,0)) < 5) {
    	                  break;
    	                }
    	               }
    	              
    	              log("Walked to the third Tree scoping position!");
    	              log("Checking for Uncut Trees!");
    		  	      
    	              
    	  	  		  GameObject Tree5 = getGameObjects().getTopObjectOnTile(new Tile(3159,3458,0));
    
    	  	  	       if(Tree5.getRealID()==1278) {
    		  	    	  
    		  	        Tree5.interact("Chop down");
    		  	        //sleep(Calculations.random(500,1000));
    		  	        
    		  	        int I,A = 0;
    		  	          I=getInventory().count("Logs");
    		  	          
    		  	        while (Z == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>I) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		  	        	
    		  	      }
    		  	      
    		  	        if(getInventory().isFull()==true) {
    		  	        	return;
    		  	        }  
    	  	  	       
    	  	  		GameObject Tree6 = getGameObjects().getTopObjectOnTile(new Tile(3157,3454,0));
    	  	  		if(Tree6.getRealID()==1278) {
    		  	        Tree6.interact("Chop down");
    
    		  	        int I,A = 0;
    		  	          I=getInventory().count("Logs");
    		  	          
    		  	        while (Z == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>I) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		  	        
    		  	        if(getInventory().isFull()==true) {
    		  	        	return;
    		  	        }
    		  	        
    		  	      }
    		  	      
    	              
    	           } 
    	         
    	      }
    	      
    	   }
    		
    	}
    	//---------------------------------------------------------------
    
        public void Persue_Skill_Locations(String Skill, String Location) {
        	
          if(Skill=="Woodcutting") {
            if(Location=="VARROCK_WEST_BANK") {
            if(TREE=="Tree") {
               log("Persueing! Tree Cutting...");
               log("Walking to the Tree Location!...");
               getWalking().walk(new Tile(3173,3454,0));
               sleep(Calculations.random(2000,7000));
            }
            }
          }
          
          
        }
        
    	//------------------------------------------------------------------
    	public void Bank(String Skill, String Location) {
    	
    	  if(Skill=="Woodcutting")  {
    	    boolean Bank = false, Bank_no_axe = false, Bank_axe = 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;
    	  	  }
    	      
    	  	  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));
    		  } 	
           
    	  	  int Z;
    	  	  Z=5;
    	  	  
    	  	  if(Bank==true) {
    	  		if(Location=="VARROCK_WEST_BANK") {
    	              while (Z == 5)
    	              {
    		            getWalking().walk(new Tile(3183,3445,0));
    		            sleep(Calculations.random(2000,7000));
    	                if(getLocalPlayer().distance(new Tile(3183,3445,0)) < 5) {
    	                  break;
    	                }
    	               }	
    	  		}
    	  		
    	  		GameObject Bank_Deposit_Box = getGameObjects().closest("Bank booth");
    	  	    if (Bank_Deposit_Box != null) {
    	  	      Bank_Deposit_Box.interact("Bank");
    	  	    
    	     	  sleep(Calculations.random(2000, 3600));
    
    	     	  if(Bank_axe==true) {
                    getBank().depositAll("Logs");
                  }
              
                  if(Bank_no_axe==true) {
            	    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();
    	  	    }   
    	  	  } 
    	  }
    	  
    	  
    	}
    	
    	
        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:
      		{	
      			
      	  	  int Z;
      	  	  Z=5;
      		  if(getInventory().isFull()==false){
      			log("Navigating to Trees!");  
    
          	  	  
    
    
          	              while (Z == 5)
          	              {
          		            getWalking().walk(new Tile(3172,3452,0));
          		            sleep(Calculations.random(2000,7000));
          	                if(getLocalPlayer().distance(new Tile(3172,3452,0)) < 5) {
          	                  break;
          	                }
          	               }	
          	              
      		  }	  
      		  
      	      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;
      	  	  }
      	      
      	  	  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));
      		  } 	
      	  	  
      	  	  if(Bank==true) {
    
      	              while (Z == 5)
      	              {
      		            getWalking().walk(new Tile(3183,3445,0));
      		            sleep(Calculations.random(2000,7000));
      	                if(getLocalPlayer().distance(new Tile(3183,3445,0)) < 5) {
      	                  break;
      	                }
      	               }	
      	  		
      	  		
      	  		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;
      	  	    }
      	  	  } 
      		}
        	break;
      		case VARROCK_WEST_TREES: {
      		   log("SSSs.....");
      		  if(getInventory().isFull()) {
      	  	      I=5;
      	          while (I == 5) 
      	          { 
      	              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) {
      	                break;
      	              }
      	          }       
      		  }
      		
      	  			
      		if(!getInventory().isFull()) {
      	  		log("Navigating... to available trees");    
      	  	      // allocating memory for 5 integers. 
      	  			                      //Zone1  //Zone2
      	  	      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"} };
    
      	  	      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"} };
      	  	      
      	  	      int Path_Number = Calculations.random(0,9);
      	          int B = 3;
      	          int L = 0;
                  int C = 3;
      	          while (C == 3) {
      	        	  
      	  	        while (B == 3) {      
      	  	          String str = Paths[Path_Number][L]; 
      	              String[] arrOfStr = str.split(",", 2);
      	          
    	              if(getLocalPlayer().distance(new Tile(Integer.parseInt(arrOfStr[0].trim()),Integer.parseInt(arrOfStr[1].trim()),0)) < 10) 
    	                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) {
    	                break;
      	  	          }
      	  	        } 
      	  	      
     	  	         String str_coordinates = Path_Tree_Coordinates[Path_Number][L]; 
     	  	         String[] Tree_Coordinates = str_coordinates.split(",", 2);
    		  	        int P = 5;
    		  	        int F,A = 0;
    		  	          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));
    			  	  	if(Tree.getRealID()==1278) {
    			          Tree.interact("Chop down"); 
    				  	        
    		  	        while (P == 5) {
    		  	        	
    		  	        	if(getInventory().count("Logs")>F) {
    		  	        	  break;
    		  	        	}
    		  	        	sleep(Calculations.random(100,150)); 
    		  	        	A=A+1;
    		  	        	
    		  	        	if(A==150) {
    		  	        	  break;
    		  	        	}
    		  	        	
    		  	        }
    		    		  if(getInventory().isFull()) {
    		      	  	      I=5;
    		      	          while (I == 5) 
    		      	          { 
    		      	              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) {
    		      	                break;
    		      	              }
    		      	          }       
    		      		  }
    			  	  	}
    		 
      	           L=L+1;
      	           if(L==9) 
      	        	break;
    			   }
      	  	      }                   
      	  	
      		  sleep(Calculations.random(500, 600));
      		  
      		 
      		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("----------------------------------------------------");
    	}
      	
       //---------------------------------------------------------------
      	
    }

     

    Link to comment
    Share on other sites

    Because you are doing while loops inside the onLoop

    When you stop a script it will only stop after it finishes the current loop on the onLoop. If your script is inside the while loop then it will just keep running that until it finishes

    Link to comment
    Share on other sites

    31 minutes ago, Light17 said:

    Aha I understand

    What do you recommend that I do to do the same thing but avoid doing while loops?

    To put it simply its bad practice to use loops inside your onLoop unless its absolutely needed. Which in your case it's not needed.
    Your onLoop already loops itself, why are you using a while inside it?

     

    Link to comment
    Share on other sites

    2 hours ago, Light17 said:

    in order to sleep until a condition is met

    the method you are looking for is sleepUntil(), the whole script is a loop therefore putting loops inside it is bad practice. Example: sleepUntil(() -> getLocalPlayer().isInCombat(), 3600);

    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.