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 isn't this working?


    Synergy1

    Recommended Posts

    Posted

    Can you guys tell me why isn't this method working:

    private void fletch(){
    Item knife = getInventory().get("Knife");
    Item logs = getInventory().getRandom("Maple logs");
    if(getInventory().count("Maple logs") != 0 && getInventory().count("Knife") != 0){
    knife.interact("Use");
    
    }
    if(knife.interact("Use")){
    logs.interact("Use");
    }
    Posted

    Hey, instead of using .interact use knife.useOn(logs). Also check if neither of them are null just to be sure :)

    Posted

    Maybe you should do 

    <code>

    if(getInventory().count("Maple logs") != 0 && getInventory().count("Knife") != 0){
    knife.interact("Use");
    logs.interact("Use");
    }

    </code>

    Might work, might not work, I don't know.

     

    Edit:: I believe that the if statement also does the interaction, so you would click knife twice, then log once.

    Posted

    Tried both ways still doesn't work, I'll post my script here so if you guys want you can point the errors in it:

    package main;
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.items.Item;
    
    
    @ScriptManifest(author = "Synergy1", category = Category.FLETCHING,name = "FletchingThing",version = 1.0)
    public class Main extends AbstractScript{
    
        private boolean checkInventory(){
            if(getInventory().isFull()){
                return true;
    
            }else{
                return false;
            }
        }
        private void fletch(){
           Item knife = getInventory().get("Knife");
            Item logs = getInventory().getRandom("Maple logs");
            if(logs.getAmount() != 0 && knife.getAmount() != 0){
                knife.useOn(logs);
    
            }
    
        }
        private boolean isThereLogs(){
            if(getInventory().contains("Maple logs")){
                return true;
            }else{
                return false;
            }
        }
        private boolean isThereBows(){
            if(getInventory().contains("Maple longbow (u)")){
                return true;
            }else return false;
        }
        private void openBank(){
            getBank().openClosest();
        }
        private boolean isBankOpen(){
            if(getBank().isOpen()){
                return true;
            }return false;
        }
        @Override
        public int onLoop() {
            if(!getBank().isOpen() && isThereLogs()){
                fletch();
            }
            if(checkInventory() && !isThereLogs() && !isBankOpen()){
                openBank();
            }else if(getBank().isOpen() && !isThereLogs() && checkInventory()) {
                getBank().depositAll("Maple longbow (u)");
            }
            if(isBankOpen() && !checkInventory()){
                getBank().withdraw("Maple logs", 27);
                sleep(100);
            }else{
                getBank().close();
            }
            return 0;
        }
    }
    

    The script opens the bank, deposit, withdraw then closes it but I couldn't manage to make it fletch the logs =x


    C'mon guys help me pl0x :D

    Posted

    Tried both ways still doesn't work, I'll post my script here so if you guys want you can point the errors in it:

    package main;
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.items.Item;
    
    
    @ScriptManifest(author = "Synergy1", category = Category.FLETCHING,name = "FletchingThing",version = 1.0)
    public class Main extends AbstractScript{
    
        private boolean checkInventory(){
            if(getInventory().isFull()){
                return true;
    
            }else{
                return false;
            }
        }
        private void fletch(){
           Item knife = getInventory().get("Knife");
            Item logs = getInventory().getRandom("Maple logs");
            if(logs.getAmount() != 0 && knife.getAmount() != 0){
                knife.useOn(logs);
    
            }
    
        }
        private boolean isThereLogs(){
            if(getInventory().contains("Maple logs")){
                return true;
            }else{
                return false;
            }
        }
        private boolean isThereBows(){
            if(getInventory().contains("Maple longbow (u)")){
                return true;
            }else return false;
        }
        private void openBank(){
            getBank().openClosest();
        }
        private boolean isBankOpen(){
            if(getBank().isOpen()){
                return true;
            }return false;
        }
        @Override
        public int onLoop() {
            if(!getBank().isOpen() && isThereLogs()){
                fletch();
            }
            if(checkInventory() && !isThereLogs() && !isBankOpen()){
                openBank();
            }else if(getBank().isOpen() && !isThereLogs() && checkInventory()) {
                getBank().depositAll("Maple longbow (u)");
            }
            if(isBankOpen() && !checkInventory()){
                getBank().withdraw("Maple logs", 27);
                sleep(100);
            }else{
                getBank().close();
            }
            return 0;
        }
    }
    

    The script opens the bank, deposit, withdraw then closes it but I couldn't manage to make it fletch the logs =x

    C'mon guys help me pl0x :D

    Don't return 0, it'll make more calls to onLoop than you need. Return something like Calculations.random(300,600); 

    Posted

    null check the items instead of checking if amount != 0

    Posted

    Ok changed the return value, thx for the tip :D But I still getting problem with the interact method...


    Ok changed the return value, thx for the tip :D


    null check the items instead of checking if amount != 0

    Done that. nothing has changed.

    Posted

    wasnt suppose to fix that problem it will fix future problems

     

    do that for everything from now on

    Posted

    wasnt suppose to fix that problem it will fix future problems

     

    do that for everything from now on

    Ok, thx m8 :D

    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.