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
  • Player woodcutting animation and wait till the animation is done


    Kirito

    Recommended Posts

    Posted

    so i finally finished a woodcutting script i'm working on but now i'm in a bit off trouble, so it cuts the tree and drops the logs it needs to drop but for now it cuts 1 log and instantly drops it also it keeps spamming the tree even tough its already copping/cutting that tree.

     

     

    so what i need now is that it waits till the animation off chopping is done then starts cutting again and for the dropping part how do i make it so that it waits till the inventory is full?

     

     

    i'l post the code when its requested to post it

    Posted

    so i finally finished a woodcutting script i'm working on but now i'm in a bit off trouble, so it cuts the tree and drops the logs it needs to drop but for now it cuts 1 log and instantly drops it also it keeps spamming the tree even tough its already copping/cutting that tree.

     

     

    so what i need now is that it waits till the animation off chopping is done then starts cutting again and for the dropping part how do i make it so that it waits till the inventory is full?

     

     

    i'l post the code when its requested to post it

    Pasting code would help, but you could just implement a if(!getAnimation() == //the animation)) { choptree(): or just if(getLocalPlayer.isStandingStill) choptree();

     

     

    Basic way's of doing it but will work

    Posted

    Pasting code would help, but you could just implement a if(!getAnimation() == //the animation)) { choptree(): or just if(getLocalPlayer.isStandingStill) choptree();

     

     

    Basic way's of doing it but will work

    ok so the current code is

    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.methods.Calculations;
     
    @ScriptManifest(author = "Kirito", name = "Simple Power Chopper", version = 1.0, description = "Simply cuts tree's anywhere and drops them.", category = Category.WOODCUTTING)
    public class main extends AbstractScript {
     
    public void onStart() {
    log("Welcome to Simple Power Chopper by Kirito.");
    log("This is my first script please leave feedback and or report bugs on the topic.");
    log("Enjoy gaining levels!.");
    }
     
    private enum State {
    CHOP, DROP, WAIT
    };
     
    private State getState() {
    GameObject tree = getGameObjects().closest("Tree");
    if (!getInventory().isEmpty())
    return State.DROP;
    if (tree != null)
    return State.CHOP;
    return State.WAIT;
    }
     
    public void onExit() {
    log("Thank you for using Simple Power Chopper by Kirito.");
    }
     
    @Override
    public int onLoop() {
    switch (getState()) {
    case CHOP:
    GameObject tree = getGameObjects().closest("Tree");
    if (tree != null) {
    log("Status: Chopping that tree");
    tree.interact("Chop Down");
    return Calculations.random(1500, 2000);
    }
    case DROP:
    log("Status: Dropping all logs");
    getInventory().dropAll("Logs");
    break;
    case WAIT:
    sleep(Calculations.random(500, 600));
    break;
    }
    return Calculations.random(500, 600);
    }
    }
    Posted
    @Override
    public int onLoop() {
    switch (getState()) {
    case CHOP:
    GameObject tree = getGameObjects().closest("Tree");
    if (tree != null && getLocalPlayer.isStandingStill()) {
    log("Status: Chopping that tree");
    tree.interact("Chop Down");
    return Calculations.random(1500, 2000);
    }
    

     

     

    ok so the current code is

    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.methods.Calculations;
     
    @ScriptManifest(author = "Kirito", name = "Simple Power Chopper", version = 1.0, description = "Simply cuts tree's anywhere and drops them.", category = Category.WOODCUTTING)
    public class main extends AbstractScript {
     
    public void onStart() {
    log("Welcome to Simple Power Chopper by Kirito.");
    log("This is my first script please leave feedback and or report bugs on the topic.");
    log("Enjoy gaining levels!.");
    }
     
    private enum State {
    CHOP, DROP, WAIT
    };
     
    private State getState() {
    GameObject tree = getGameObjects().closest("Tree");
    if (!getInventory().isEmpty())
    return State.DROP;
    if (tree != null)
    return State.CHOP;
    return State.WAIT;
    }
     
    public void onExit() {
    log("Thank you for using Simple Power Chopper by Kirito.");
    }
     
    @Override
    public int onLoop() {
    switch (getState()) {
    case CHOP:
    GameObject tree = getGameObjects().closest("Tree");
    if (tree != null) {
    log("Status: Chopping that tree");
    tree.interact("Chop Down");
    return Calculations.random(1500, 2000);
    }
    case DROP:
    log("Status: Dropping all logs");
    getInventory().dropAll("Logs");
    break;
    case WAIT:
    sleep(Calculations.random(500, 600));
    break;
    }
    return Calculations.random(500, 600);
    }
    }

    Would be one way to do it (syntax should be correct)

     

     

    NOTE: Probably not the best way but will work none the less

    Posted

    @Override

    public int onLoop() {

    switch (getState()) {

    case CHOP:

    GameObject tree = getGameObjects().closest("Tree");

    if (tree != null && getLocalPlayer.isStandingStill(){

    log("Status: Chopping that tree");

    tree.interact("Chop Down");

    return Calculations.random(1500, 2000);

    }

    Would be one way to do it (syntax should be correct)

     

     

    NOTE: Probably not the best way but will work none the less

    then i get the problem "getrLocalPlayer cannot be resolved"

    Posted

    then i get the problem "getrLocalPlayer cannot be resolved"

    if you pasted that (it might just be a type) make sure it's spelt right, you could also make it a different if statment not just && or use getAnimation() == <woodcutting one>

    Posted

    Don't forget the parenthesis after getLocalPlayer

     

    getLocalPlayer().isStandingStill()

    Posted

    if(getLocalPlayer.isStandingStill()) {

    choptree();

    }

     

    Would bring no error for me unless I either A) put a typo B) Put the syntax wrong or C) had no method for choptree, make sure it is all correct also if not try getAnimation

    idk if this is correct

    @Override
    public int onLoop() {
    switch (getState()) {
    case CHOP:
    if(getLocalPlayer.isStandingStill()){
    GameObject tree = getGameObjects().closest("Tree");
    log("Status: Chopping that tree");
    tree.interact("Chop Down");
    return Calculations.random(1500, 2000);
    }
    case DROP:
    log("Status: Dropping all logs");
    getInventory().dropAll("Logs");
    break;
    case WAIT:
    sleep(Calculations.random(500, 600));
    break;
    }
    return Calculations.random(500, 600);
    }
    }

    lolafter re-checking the code its gone forgot to place () behind if(getLocalPlayer"()".isStandingStill()){

     

    now for the dropping part i did the same as above but then for the inventory

     

    if (!getInventory().isFull()) {
    log("Status: Dropping all logs");
    getInventory().dropAll("Logs");
    }

    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.