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
  • Try asking for help in the chatbox
  • using an inventory object on a game object with no actions


    Recommended Posts

    So for my wine drinker and jug filler bot I withdraw wine, drink wine, run to water source, use jug on water source, run to bank, bank jugs of water, repeat.


    I'm stuck at the using jug on water source step. I have a method that sometimes works and sometimes the script just get stuck. To understand my problem more I'd like to know in the general case how you would script to use an object in your inventory on another game object. This could be using a jug on a fountain or grapes in your inventory on a jug of water. http://pastebin.com/axqANzsB




    1. private void filling() {
    2.                 if(getInventory().interact("Jug", "Use")) {
    3.                         currentState = "filling jugs";
    4.                         GameObject source = getGameObjects().closest(waterObject);
    5.                         if(source != null) {
    6.                                 fillingJugs = true;
    7.                                 sleepUntil(() -> fillingJugs, 5000);
    8.                                 currentState = "pump not null";
    9.                                 String[] possibleActions = source.getActions();
    10.                                 int i = possibleActions.length;
    11.                                 for(int j = 0; j < i; j++) {
    12.                                         log(possibleActions[j]);
    13.                                 }
    14.                                 if(source.interact("Use")) {
    15.                                         currentState = "startedFilling";
    16.                                         jugsFilled += 28;
    17.                                         sleepUntil(() -> !getInventory().contains("Jug"), 8000);
    18.                                 }
    19.                         } else {
    20.                                 currentState = "pump is null";
    21.                         }
    22.                 }
    23.         }

    I'm mostly interested in the code at line 14. Above I checked(lines 9-13) and like expected the source has no game actions. However interestingly it also does not have the action "Examine" although that is visible in game. However, if the source does not have the action "use" how can the code at line 14 run? Does the source temporarily gain the action "use" while the jug is selected after the code in line 2? 
    Link to comment
    Share on other sites

    • 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.