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
  • Best way to use inventory object on game object?


    Robby99

    Recommended Posts

    Hello, I'm new to programming here so I'm still learning the API. I'm making a Rouge Den cooker for my first script.

     

    I'm pretty much done with it except for paint and GUI. 

     

    One thing I don't know how to do better is the best way to use food on the fire. This is currently what I'm doing:

    getInventory().interact(typeOfFood, "Use");
    			
    Thread.sleep(200);
    		
    getGameObjects().closest(26185).interact();
    

    The problem is if someone is on top of the fire it can't use the food on fire. I'm guessing the fix would be to right click then select fire, but I'm not sure how to do that. 

    Link to comment
    Share on other sites

    I tried this earlier, but the script doesn't do anything. I got the syntax wrong or something.

     

    getInventory().get(typeOfFood).useOn(26185);

     

     

    Nvm I figured it out. I had to declare the entity. I'm still new to OOP and Java is all about OOP.

    Link to comment
    Share on other sites

    I tried this earlier, but the script doesn't do anything. I got the syntax wrong or something.

     

    getInventory().get(typeOfFood).useOn(26185);

     

     

    Nvm I figured it out. I had to declare the entity. I'm still new to OOP and Java is all about OOP.

    Yes, the value 26185 needs to be declared as an entity (object/npc/player). Good job on sussing it out.

    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.