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
  • need help dropping inventory


    virgo

    Recommended Posts

    So I am following the video tuts for the basic woodcutter. Instead of banking I would like to just drop I have tried so many things and I just cant seem to get it to work. Also can someone explain how to use an item on an item (like tinderbox to log).

     

    here is my code 

    package firstdayout;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.Inventory;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.interact.Interactable;
    
    @ScriptManifest(author = "VIRGO", name = "First day out", version = 1.0, description = "Simple Tea Thiever", category = Category.THIEVING)
    public class Main extends AbstractScript {
    	Area treeArea = new Area(3182, 3505, 3188, 3498, 0);
    	Area bankArea = new Area(3165, 3494, 3168, 3487, 0);
    
    	public void onStart() {
    		log("---welcome to Virgo woodcut---");
    	}
    
    	public void onExit() {
    
    	}
    
    	@Override
    	public int onLoop() {
    		if (!getInventory().isFull()) {
    			if (treeArea.contains(getLocalPlayer())) {
    				chopTree("Tree");
    			} else {
    				if (getWalking().walk(treeArea.getRandomTile())) {
    					sleep(Calculations.random(3000, 5500));
    
    				}
    			}
    		}
    		if (getInventory().isFull()) { // it is time to bank
    			dropLogs("Logs");
    			sleepUntil(() -> getInventory().count("Logs") < 1, 12000);
    		}
    
    		return 600;
    	}
    
    	private void dropLogs(String nameOfLogs) {
    		if (getInventory().isFull()) {
    
    			// need what to put here to drop
    			sleepUntil(() -> getInventory().count("Logs") < 1, 12000);
    		}
    	}
    
    Link to comment
    Share on other sites

    Remember to search the API first, it might take longer but it's good practice and shows us you're making an effort.

     

    https://dreambot.org/javadocs/org/dreambot/api/methods/container/impl/Inventory.html

    I looked at the api and I was trying to use dropAll() after if inv full, but had no

    sucess

     

    here is one of the things I tried but it failed to drop logs still not sure where im going wrong here...

    package firstdayout;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.Inventory;
    import org.dreambot.api.methods.interactive.GameObjects;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.interact.Interactable;
    
    @ScriptManifest(author = "VIRGO", name = "First day out", version = 1.0, description = "Cut 'N' Burn", category = Category.WOODCUTTING)
    public class Main extends AbstractScript {
    	Area treeArea = new Area(3182, 3505, 3188, 3498, 0);
    	Area bankArea = new Area(3165, 3494, 3168, 3487, 0);
    
    	public void onStart() {
    		log("---welcome to Virgo woodcut---");
    	}
    
    	public void onExit() {
    
    	}
    
    	@Override
    	public int onLoop() {
    		if (!getInventory().isFull()) {
    			if (treeArea.contains(getLocalPlayer())) {
    				chopTree("Tree");
    			} else {
    				if (getWalking().walk(treeArea.getRandomTile())) {
    					sleep(Calculations.random(3000, 5500));
    
    				}
    			}
    		}
    		if (getInventory().isFull()) { 
    			dropLogs("Logs");
    			sleep(6000);
    		}
    
    		return 600;
    	}
    
    	private void dropLogs(String nameOfLogs) {
    		if (getInventory().isFull()) {
    			if( getInventory().drop("Logs"));
    			// need what to put here to drop
    			sleepUntil(() -> getInventory().count("Logs") < 1, 12000);
    		}
    	}
    
    	private void chopTree(String nameOfTree) {
    		GameObject tree = getGameObjects()
    				.closest(gameobject -> gameobject != null && gameobject.getName().equals("Tree"));
    		if (!getInventory().isFull()) {
    			if (tree.interact("Chop down")) {
    				int countlog = getInventory().count("Logs");
    				sleepUntil(() -> getInventory().count("Logs") > countlog, 12000);
    
    			}
    		}
    	}
    }
    
    
    Link to comment
    Share on other sites

     

    I looked at the api and I was trying to use dropAll() after if inv full, but had no

    sucess

     

    here is one of the things I tried but it failed to drop logs still not sure where im going wrong here...

    package firstdayout;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.container.impl.Inventory;
    import org.dreambot.api.methods.interactive.GameObjects;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.interact.Interactable;
    
    @ScriptManifest(author = "VIRGO", name = "First day out", version = 1.0, description = "Cut 'N' Burn", category = Category.WOODCUTTING)
    public class Main extends AbstractScript {
    	Area treeArea = new Area(3182, 3505, 3188, 3498, 0);
    	Area bankArea = new Area(3165, 3494, 3168, 3487, 0);
    
    	public void onStart() {
    		log("---welcome to Virgo woodcut---");
    	}
    
    	public void onExit() {
    
    	}
    
    	@Override
    	public int onLoop() {
    		if (!getInventory().isFull()) {
    			if (treeArea.contains(getLocalPlayer())) {
    				chopTree("Tree");
    			} else {
    				if (getWalking().walk(treeArea.getRandomTile())) {
    					sleep(Calculations.random(3000, 5500));
    
    				}
    			}
    		}
    		if (getInventory().isFull()) { 
    			dropLogs("Logs");
    			sleep(6000);
    		}
    
    		return 600;
    	}
    
    	private void dropLogs(String nameOfLogs) {
    		if (getInventory().isFull()) {
    			if( getInventory().drop("Logs"));
    			// need what to put here to drop
    			sleepUntil(() -> getInventory().count("Logs") < 1, 12000);
    		}
    	}
    
    	private void chopTree(String nameOfTree) {
    		GameObject tree = getGameObjects()
    				.closest(gameobject -> gameobject != null && gameobject.getName().equals("Tree"));
    		if (!getInventory().isFull()) {
    			if (tree.interact("Chop down")) {
    				int countlog = getInventory().count("Logs");
    				sleepUntil(() -> getInventory().count("Logs") > countlog, 12000);
    
    			}
    		}
    	}
    }
    
    

    With this code, it's going to drop one log, sleep for 12 seconds, pause in the onLoop for 600ms and then chop 1 log.

     

    dropAll or dropAllExcept should work. Also, you don't need the if (inv full) check inside the dropLogs method because you are already checking that in the onLoop before calling the method. and 'nameOfLogs' is never used

    Link to comment
    Share on other sites

    With this code, it's going to drop one log, sleep for 12 seconds, pause in the onLoop for 600ms and then chop 1 log.

     

    dropAll or dropAllExcept should work. Also, you don't need the if (inv full) check inside the dropLogs method because you are already checking that in the onLoop before calling the method. and 'nameOfLogs' is never used

    thank you for this explanation I understand things on a better level now.

    Link to comment
    Share on other sites

    for(String x : getInventory.all()) {

        if(x != null && x.getName().equalsIgnoreCase("logs")) {

            getInventory().drop(x);

        }

    }

    Link to comment
    Share on other sites

    for(String x : getInventory.all()) {

        if(x != null && x.getName().equalsIgnoreCase("logs")) {

            getInventory().drop(x);

        }

    }

    Thanks for this was still struggling. Only made bots for simba and rawr bot (b4 devs gave up on it) a long time ago (probably around 5 years ago so its taking time to refresh my brain and also get hip to this api. I appreciate everyone's help and look forward to making some contributions when i have time off work.

    Link to comment
    Share on other sites

    Thanks for this was still struggling. Only made bots for simba and rawr bot (b4 devs gave up on it) a long time ago (probably around 5 years ago so its taking time to refresh my brain and also get hip to this api. I appreciate everyone's help and look forward to making some contributions when i have time off work.

    Just a heads up that code doesn't work, you'll need to replace String x with Item x.

    Link to comment
    Share on other sites

    Thx for noticing that, havent written that code in idek how long xd

     

    Just a heads up that code doesn't work, you'll need to replace String x with Item x.

    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.