Synergy1 1 Posted April 10, 2016 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"); }
Hashtag 9071 Posted April 10, 2016 Hey, instead of using .interact use knife.useOn(logs). Also check if neither of them are null just to be sure
IcCookies 24 Posted April 10, 2016 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.
Synergy1 1 Author Posted April 10, 2016 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
JoieDeVivre 33 Posted April 10, 2016 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 Don't return 0, it'll make more calls to onLoop than you need. Return something like Calculations.random(300,600);
Synergy1 1 Author Posted April 10, 2016 Ok changed the return value, thx for the tip But I still getting problem with the interact method... Ok changed the return value, thx for the tip null check the items instead of checking if amount != 0 Done that. nothing has changed.
Rabrg 83 Posted April 10, 2016 wasnt suppose to fix that problem it will fix future problems do that for everything from now on
Synergy1 1 Author Posted April 10, 2016 wasnt suppose to fix that problem it will fix future problems do that for everything from now on Ok, thx m8
Recommended Posts
Archived
This topic is now archived and is closed to further replies.