Sin 0 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?
Bonnie 2 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
Sin 0 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
Dreamlicker 750 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"); } }
Sin 0 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?
Dreamlicker 750 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)
Sin 0 Posted October 15, 2015 Yes, getWalk() will use the web walker that Dreambot has. (I believe) awesome! thanks for the helpful information!
qbots 240 Author 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)
Dioxin 29 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)
Pandemic 2853 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.