Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Why doesn't this script work?

Featured Replies

Hey guys, here are my problems with this script, then I'll post the code.

  • When at the Yew Tree in Varrock, even though I have a ConditionalSleep, it still spam clicks the tree
  • Once the tree is cut down once, it won't click on the tree once it respawns
  • Once the inventory is full, it won't walk to the bank, If I walk the player to the bank, it won't open the bank, deposit the logs.
Spoiler

				
			import org.osbot.rs07.api.Bank;
		import org.osbot.rs07.api.Inventory;
		import org.osbot.rs07.api.map.Position;
		import org.osbot.rs07.api.map.constants.Banks;
		import org.osbot.rs07.api.model.RS2Object;
		import org.osbot.rs07.api.util.ItemContainer;
		import org.osbot.rs07.script.Script;				
			import org.osbot.rs07.script.ScriptManifest;
		import org.osbot.rs07.utility.ConditionalSleep;				
			import java.awt.*;				
			@ScriptManifest(author = "MySQLi", info = "Varrock Yew Cutter / Banker", name = "SqlYewCutter", version = 1.0, logo = "")				
			public class Main extends Script {				
			    
		    
		    @Override
		    public void onStart() {
		        log("Enjoy cutting yews!");
		        //Code here will execute before the loop is started
		    }				
			    public int onLoop() throws InterruptedException{
		        if(canCutTrees()){
		            cut();
		        }
		        else{
		            bank();
		        }
		    
		        
		        return random (150,200); //The amount of time in milliseconds before the loop starts over
		    }				
			
		    @Override
		    public void onExit() {
		        log("Thank you for supporting my script!");
		        //Code here will execute after the script ends
		    }				
			    private void bank() throws InterruptedException{
		        if(inventory.isFull() && !Banks.VARROCK_EAST.contains(myPosition())){
		            getWalking().webWalk(Banks.VARROCK_EAST);
		        }
		        else if (!getBank().isOpen()){
		            getBank().open();
		            getBank().depositAll("Yew Logs");
		        }
		        else{
		            getWalking().walk(new Position(3247,3472,0));
		        }
		    }
		  
		    
		    private void cut(){				
			            RS2Object yew = getObjects().closest("Yew");
		            if(yew != null && yew.interact("Chop down"));
		            new ConditionalSleep(5000){
		                public boolean condition(){
		                    return myPlayer().isAnimating() || !yew.exists();
		                }
		            }.sleep();
		    }				
			    public boolean canCutTrees(){
		        return myPlayer().isOnScreen();
		        
		    }
		    
		    
		   
		    @Override
		    public void onPaint(Graphics2D g) {
		        //This is where you will put your code for paint(s)
		    }				
			}				
			

 

42 minutes ago, MySQLi said:

Hey guys, here are my problems with this script, then I'll post the code.

  • When at the Yew Tree in Varrock, even though I have a ConditionalSleep, it still spam clicks the tree
  • Once the tree is cut down once, it won't click on the tree once it respawns
  • Once the inventory is full, it won't walk to the bank, If I walk the player to the bank, it won't open the bank, deposit the logs.
  Hide contents

 



				
			import org.osbot.rs07.api.Bank;
		import org.osbot.rs07.api.Inventory;
		import org.osbot.rs07.api.map.Position;
		import org.osbot.rs07.api.map.constants.Banks;
		import org.osbot.rs07.api.model.RS2Object;
		import org.osbot.rs07.api.util.ItemContainer;
		import org.osbot.rs07.script.Script;				
			import org.osbot.rs07.script.ScriptManifest;
		import org.osbot.rs07.utility.ConditionalSleep;				
			import java.awt.*;				
			@ScriptManifest(author = "MySQLi", info = "Varrock Yew Cutter / Banker", name = "SqlYewCutter", version = 1.0, logo = "")				
			public class Main extends Script {				
			    
		    
		    @Override
		    public void onStart() {
		        log("Enjoy cutting yews!");
		        //Code here will execute before the loop is started
		    }				
			    public int onLoop() throws InterruptedException{
		        if(canCutTrees()){
		            cut();
		        }
		        else{
		            bank();
		        }
		    
		        
		        return random (150,200); //The amount of time in milliseconds before the loop starts over
		    }				
			
		    @Override
		    public void onExit() {
		        log("Thank you for supporting my script!");
		        //Code here will execute after the script ends
		    }				
			    private void bank() throws InterruptedException{
		        if(inventory.isFull() && !Banks.VARROCK_EAST.contains(myPosition())){
		            getWalking().webWalk(Banks.VARROCK_EAST);
		        }
		        else if (!getBank().isOpen()){
		            getBank().open();
		            getBank().depositAll("Yew Logs");
		        }
		        else{
		            getWalking().walk(new Position(3247,3472,0));
		        }
		    }
		  
		    
		    private void cut(){				
			            RS2Object yew = getObjects().closest("Yew");
		            if(yew != null && yew.interact("Chop down"));
		            new ConditionalSleep(5000){
		                public boolean condition(){
		                    return myPlayer().isAnimating() || !yew.exists();
		                }
		            }.sleep();
		    }				
			    public boolean canCutTrees(){
		        return myPlayer().isOnScreen();
		        
		    }
		    
		    
		   
		    @Override
		    public void onPaint(Graphics2D g) {
		        //This is where you will put your code for paint(s)
		    }				
			}				
			

 

 

First of all the boolean canCutTree is wrong, it is just checking if player is on screen, while it should check if player is not animating and yew is not null and inventory is not full and check equipment for anyitem that contains "axe" or inventory has anything that contains "axe".

cut() condition sleep only sleeps untill animating, add another sleep to sleep untill is not animating or inventory is full.

 

private void cut() {
		RS2Object yew = getObjects().closest("Yew");
		if (yew != null && yew.interact("Chop down")) {
			new ConditionalSleep(5000) {
				public boolean condition() {
					return myPlayer().isAnimating() || !yew.exists();
				}
			}.sleep();
			new ConditionalSleep(5000) {
				public boolean condition() {
					return !myPlayer().isAnimating() || !yew.exists() || inventory.isFull();
				}
			}.sleep();
		}
	}
public boolean canCutTrees(){
	return YEWAREA.contains(myPlayer())
				&& (getInventory().contains(f -> f.getName().contains("axe"))
						|| getmp().getEquipment().contains(f -> f.getName().contains("axe")))
				&& !myPlayer().isAnimating() && !myPlayer().isMoving() && !getInventory().isFull();
}

The YEWAREA is where u define the area for the Yews. you can change it.

 

One more tip, try to format the code in your IDE for us to be able to help more.

Edited by progamerz

18 minutes ago, Juggles said:

So much wrong with this. Don't even know where to start.
Just leech off my code

https://pastebin.com/wFGP0F29
Thanks that'll be 2m 

nice now I can add a log message and sell my private wc script

  • Author
2 hours ago, progamerz said:

tEquipm

 

1 hour ago, Juggles said:

So much wrong with this. Don't even know where to start.
Just leech off my code

https://pastebin.com/wFGP0F29
Thanks that'll be 2m 

I appreciate that, I'm having a lot of trouble learning how to write scripts, there so many different guides, and things to learn, I'm having trouble where to start, and every guide is different with how people do things so I'm getting mixed up. I appreciate everyone's help though.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.