Sin 0 Share Posted October 15, 2015 Thanks for showing me the Lamba expressions . Now i have to keep it stuck in memory while I am coding. Edit: ETA on eating tutorial? Link to comment Share on other sites More sharing options...
Bonnie 2 Share Posted October 15, 2015 Thanks for showing me the Lamba expressions . Now i have to keep it stuck in memory while I am coding. Edit: ETA on eating tutorial? Here is an example of this with eatting and banking that might help you. http://pastebin.com/raw.php?i=k7WkBfp8 Link to comment Share on other sites More sharing options...
Sin 0 Share Posted October 15, 2015 Here is an example of this with eatting and banking that might help you. http://pastebin.com/raw.php?i=k7WkBfp8 private String food = "Monkfish"; you could make it use any food if you did this private String[] food = {"food 1","Food 2"}; // and so on also what is this used for? if(fixxx.contains(getPlayers().localPlayer().getTile()) still learning this API Link to comment Share on other sites More sharing options...
Dreamlicker 750 Share Posted October 15, 2015 private String food = "Monkfish"; you could make it use any food if you did this private String[] food = {"food 1","Food 2"}; // and so on also what is this used for? if(fixxx.contains(getPlayers().localPlayer().getTile()) To eat, just do private void eatFood() { if (getCombat().getHealthPercent() < whatever) { getInventory().interact(i -> i.getName(foodName), "Eat"); } } Link to comment Share on other sites More sharing options...
Sin 0 Share Posted October 15, 2015 To eat, just do private void eatFood() { if (getCombat().getHealthPercent() < whatever) { getInventory().interact(i -> i.getName(foodName), "Eat"); } } Yeah thanks for this. Still getting used this the API Yeah thanks for this. Still getting used this the API Does the Dreambot API have webwalker? Link to comment Share on other sites More sharing options...
Dreamlicker 750 Share Posted October 15, 2015 Yeah thanks for this. Still getting used this the API Does the Dreambot API have webwalker? Yes, getWalk() will use the web walker that Dreambot has. (I believe) Link to comment Share on other sites More sharing options...
Sin 0 Share Posted October 15, 2015 Yes, getWalk() will use the web walker that Dreambot has. (I believe) awesome! thanks for the helpful information! Link to comment Share on other sites More sharing options...
qbots 239 Author Share Posted October 26, 2015 For eating, you dont need to set a specific name. Example: String foodName = null; public int onLoop() { if(foodName == null) { Item i = getInventory().get(item -> item != null && item.hasAction("Eat")); if(i != null) foodName = i.getName(); } else { Item i = getInventory().get(item -> item != null && item.hasAction("Eat")); if(i != null) i.interact("Eat"); } return 10; } This will set foodName when you start the script with food. Then when/if you add banking the script will know what to withdraw. (This removes the need for adding a field to the GUI) Link to comment Share on other sites More sharing options...
Dioxin 29 Share Posted December 15, 2015 currentNpc = getNpcs().closest(npc -> npc != null && ...); if(currentNpc != null) { } This is why null is bad (haters can hate). You already check for null when you filter, so currentNpc will not be null. Yet you still do another null check. This happens quite a bit without people realizing. Double check your null checks! (or remove null from the equation) Link to comment Share on other sites More sharing options...
Pandemic 2721 Share Posted December 15, 2015 currentNpc = getNpcs().closest(npc -> npc != null && ...); if(currentNpc != null) { } This is why null is bad (haters can hate). You already check for null when you filter, so currentNpc will not be null. Yet you still do another null check. This happens quite a bit without people realizing. Double check your null checks! (or remove null from the equation) It could still be null if there are no npcs that match the filter Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.