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
  • Use an item in the inventory


    triblion

    Recommended Posts

     

    It should be 

    if (Tree != null) {
    getInventory().get("Knife").useOn(Tree);
    }
    

     

    I believe it throws a null pointer exception if your inventory does not contain a knife.

    GameObject tree = getGameObjects().closest("Tree");
    Item knife = getInventory().get("Knife");
    if (tree != null && knife != null)
    knife.useOn(tree);//why would you use a knife on a tree?
    
    Link to comment
    Share on other sites

     

    I believe it throws a null pointer exception if your inventory does not contain a knife.

    GameObject tree = getGameObjects().closest("Tree");
    Item knife = getInventory().get("Knife");
    if (tree != null && knife != null)
    knife.useOn(tree);//why would you use a knife on a tree?
    

     

    Hm I will try this and see if it works, thanks.

     

    It's not a normal tree that will have the knife used on it.

     

     

    It worked, thanks Hashtag

    Link to comment
    Share on other sites

    "knife.useOn(tree);//why would you use a knife on a tree?"

     

    This lol. New woodcutting update :kappa:

    xD yeah, it was for sapping an evergreen, but the buckets of sap were overcharged on the GE their real value was 6gp each and a bucket is about 36 gp each 

    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.