randalthor 6 Share Posted September 4, 2015 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 private void filling() { if(getInventory().interact("Jug", "Use")) { currentState = "filling jugs"; GameObject source = getGameObjects().closest(waterObject); if(source != null) { fillingJugs = true; sleepUntil(() -> fillingJugs, 5000); currentState = "pump not null"; String[] possibleActions = source.getActions(); int i = possibleActions.length; for(int j = 0; j < i; j++) { log(possibleActions[j]); } if(source.interact("Use")) { currentState = "startedFilling"; jugsFilled += 28; sleepUntil(() -> !getInventory().contains("Jug"), 8000); } } else { currentState = "pump is null"; } } } 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 More sharing options...
Rabrg 81 Share Posted September 4, 2015 check what source.isOnScreen() returns when it is stuck Link to comment Share on other sites More sharing options...
Vlad 216 Share Posted September 4, 2015 When you select an item in your inventory the action becomes Use on everything. Link to comment Share on other sites More sharing options...
Recommended Posts