Hashtag 9078 Posted January 7, 2019 To get your health, use https://dreambot.org/javadocs/org/dreambot/api/methods/combat/Combat.html#getHealthPercent-- To calculate potion boosts, use https://dreambot.org/javadocs/org/dreambot/api/methods/skills/Skills.html To interact with a piece of food or potion, use https://dreambot.org/javadocs/org/dreambot/api/methods/container/impl/Inventory.html#interact-java.lang.String-java.lang.String-
Plsnojagex 0 Author Posted January 7, 2019 So to utilize this in my script, I would first use getHealthPercent(), and then place an if statement with the following code: interact(lobster,eat); ?
Hashtag 9078 Posted January 7, 2019 15 minutes ago, Plsnojagex said: So to utilize this in my script, I would first use getHealthPercent(), and then place an if statement with the following code: interact(lobster,eat); ? That's right, so: // Eats at 50% or below if (getCombat().getHealthPercent() <= 50) { getInventory().interact("Lobster", "Eat"); }
Plsnojagex 0 Author Posted January 7, 2019 What package would I need to interact with an NPC? Like during quests when you have to communicate with a lot of NPCs, which packages should I be using? Sorry if im asking a bit too much Im just trying to learn
Nuclear Nezz 2107 Posted January 7, 2019 9 hours ago, Plsnojagex said: What package would I need to interact with an NPC? Like during quests when you have to communicate with a lot of NPCs, which packages should I be using? Sorry if im asking a bit too much Im just trying to learn npc.interact NPC n = getNpcs().closest("Plsnojagex"); n.interact("Help");
Recommended Posts
Archived
This topic is now archived and is closed to further replies.