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
  • New Scripter Needing A few Tips


    NZL

    Recommended Posts

    I made a nice log cutter using Computor's tutorial.

    However I moved to oaks, and the script doesn't work!!! jk :P

    I am wondering if I can change the count to just be,
    getinventory().count and not even count the logs, because theres to many types of logs and shit
    would be easier just to count items doesnt matter what they are.
    Also the next thing is the sleep until!
    I'm not sure how to do a sleep until for a tree that has multiple logs...
    I was thinking sleepuntil(() -> getplayeraction(woodcuttinganimation(false) || currentTreeObject == null)

    Any suggestions? I am new to the scripting scene so it would be nice for some help :)

    (btw that was the first time scripting for anything for runescape :P)
     

    this is what i currently do but obviously Logs wouldnt work because it should be Oak Logs?


    if(tree != null && tree.interact("Chop down")){
                int countLog = getInventory().count("Logs");
                sleepUntil(() -> getInventory().count("Logs") > countLog,  Calculations.random(10000, 14000));
            }

    Thanks! Also I am interested in some bigger projects if someone wants to talk to me :< !!
    edit: Also! How do we detect random events?! Just throw in a detectrandom() between actions?, I've been getting into threads... can we run detect random on a seperate thread 24.7?

    Link to comment
    Share on other sites

    If you're going to sleep until your inventory contains oak logs, then yeah you'd replace "Logs" with "Oak logs"

    and to count an item, you have to know what you're counting :P

     

    the client detects randoms on its own. You don't have to worry about that.

     

    And no tree has multiple logs ;o nvm I misread.

     

    Pretty much you'd have two checks

    if you're not animating (getLocalPlayer().isAnimating()) then chop a tree

    if you are animating, sleep.

    Link to comment
    Share on other sites

    so if you want a challenge, make the thing dynamic. So on start wait until a player is interacting and use that name to look for someone something a tree to start chopping.

     

    In order to count the logs use a lambda or a filter and search for getName().contains("log")

    As for when to sleep, get animtion != -1

     

    let me know if you need more help.

    Link to comment
    Share on other sites

    That's not a reliable way. You will sit for 10 seconds if someone chops the tree before you get a log. (Also wouldn't work for anything other than normal trees cus u can get more than 1 log per tree, but still not sure why someone would say to check inventory for wcing) For woodcutting it's best to check animation since you will be animating the entire duration of chopping.

     

    Example:

    if(getLocalPlayer().getAnimation == -1 && !getLocalPlayer().isMoving())
        if(tree.interact("Chop down")) {
            sleepWhile(() -> getLocalPlayer().isMoving || getLocalPlayer().getAnimation != -1,10000);
        }
    
    

    You can also check if the tree is still valid as well for quicker switching I guess. :)

    Link to comment
    Share on other sites

    so if you want a challenge, make the thing dynamic. So on start wait until a player is interacting and use that name to look for someone something a tree to start chopping.

     

    In order to count the logs use a lambda or a filter and search for getName().contains("log")

    As for when to sleep, get animtion != -1

     

    let me know if you need more help.

     

    That's not a reliable way. You will sit for 10 seconds if someone chops the tree before you get a log. (Also wouldn't work for anything other than normal trees cus u can get more than 1 log per tree, but still not sure why someone would say to check inventory for wcing) For woodcutting it's best to check animation since you will be animating the entire duration of chopping.

     

    Example:

    if(getLocalPlayer().getAnimation == -1 && !getLocalPlayer().isMoving())
        if(tree.interact("Chop down")) {
            sleepWhile(() -> getLocalPlayer().isMoving || getLocalPlayer().getAnimation != -1,10000);
        }
    
    

    You can also check if the tree is still valid as well for quicker switching I guess. :)

    Hey guys, thanks for the help! I was in class all day, and time zone difference! But I came up with

    sleepUntil(() -> getInventory().isFull() ||
                    getInventory().isFull() && !getLocalPlayer().isAnimating() ||
                    !tree.exists(), Calculations.random(25000, 40000));
    

    it's working very well! I think that solves my "if someone else kills the tree people I arrive" problem however if I don't start cutting the tree within the return 600; the script loops and it clicks the tree every 600ms

     

    I'm not sure any amount of logic can win against that :P So I'm thinking the solution is to have enum's and states.

     

    because my current goal is to overcome the idle if someone cuts the tree down before I arrive....

     

     

    -------------

    Also a script in the sdn, if someone else cut the tree it would just remain animating on a !exists tree sooooo yeah haha, so many small things to consider :o

    OOH MY GOD! even leveling up stops cutting :l gg lol added in a !animating aswell now

    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.