Zendor 2 Share Posted August 11, 2018 Heya, i'm way too lazy to end it up this bot (make the GUI), but is a nice bot and i want to share it. But since its not fineshed i will post here and when i finish i will post in SVN. If u have any tips to improve the bot let me know. (I know i should do methods/functions, and i will). package NmzPack; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.prayer.Prayer; import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.methods.tabs.Tab; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.Timer; import org.dreambot.api.wrappers.interactive.GameObject; import java.awt.*; import java.util.Random; @ScriptManifest(name = "Zendor NMZ",version = 1.0,category = Category.MINIGAME,author = "Zendor", description = "Auto atack in NMZ, flick fast heal, use overloads and Absorption.") public class NMZ extends AbstractScript { private int beginningXP; private int currentXp; private int xpGained; private String status; private Timer timeRan; private int drink; private int timesPrayer = 1; @Override public int onLoop() { Random rand = new Random(); int i = rand.nextInt(100) + 1; if(i != 85){ getMouse().moveMouseOutsideScreen(); } status = "Auto atacking"; if (timeRan.elapsed() >= 30000 * timesPrayer) { status = "Rapid Heal"; if (!getTabs().isOpen(Tab.PRAYER)) { getTabs().open(Tab.PRAYER); } sleep(Calculations.random(700, 3352)); getPrayer().flick(Prayer.RAPID_HEAL, Calculations.random(950, 1250)); timesPrayer++; } if(getCombat().getHealthPercent() > 40){ sleep(Calculations.random(5000, 7000)); if (!getTabs().isOpen(Tab.INVENTORY)) { getTabs().open(Tab.INVENTORY); } if(getInventory().count("Overload (4)") > 0){ status = "Overload 4"; drink = 1; getInventory().interact("Overload (4)", "Drink"); }else if(getInventory().count("Overload (3)") > 0){ status = "Overload 3"; getInventory().interact("Overload (3)", "Drink"); drink = 1; }else if(getInventory().count("Overload (2)") > 0){ status = "Overload 2"; getInventory().interact("Overload (2)", "Drink"); drink = 1; }else if(getInventory().count("Overload (1)") > 0){ status = "Overload 1"; getInventory().interact("Overload (1)", "Drink"); drink = 1; } sleep(Calculations.random(1500, 2200)); if(drink == 1){ if(getInventory().count("Absorption (4)") > 0){ status = "Absorption 4"; getInventory().interact("Absorption (4)", "Drink"); }else if(getInventory().count("Absorption (3)") > 0){ status = "Absorption 3"; getInventory().interact("Absorption (3)", "Drink"); }else if(getInventory().count("Absorption(2)") > 0){ status = "Absorption 2"; getInventory().interact("Absorption (2)", "Drink"); }else if(getInventory().count("Absorption(1)") > 0){ status = "Absorption 1"; getInventory().interact("Absorption (1)", "Drink"); } drink = 0; } } if(getCombat().getSpecialPercentage() >= 50){ status = "Special atack"; getInventory().interact("Granite maul", "Wield"); getCombat().toggleSpecialAttack(true); sleep(500); getCombat().toggleSpecialAttack(true); sleep(Calculations.random(1200, 2300)); if(getCombat().getSpecialPercentage() <= 15){ getInventory().interact("Dharok's greataxe 100", "Wield"); getInventory().interact("Dharok's greataxe 75", "Wield"); getInventory().interact("Dharok's greataxe 50", "Wield"); getInventory().interact("Dharok's greataxe 25", "Wield"); } } return 1000; } @Override public void onPaint(Graphics g) { currentXp = getSkills().getExperience(Skill.STRENGTH); xpGained = currentXp - beginningXP; g.drawString("STRENGTH XP: " + xpGained + "(" + xpGained * (int)(3600000D/timeRan.elapsed()) + "/h)", 20, 95); g.drawString("Time run: " + timeRan.formatTime(), 20, 115); g.drawString("Status: " + status, 20, 135); } @Override public void onStart() { super.onStart(); status = "Starting"; beginningXP = getSkills().getExperience(Skill.STRENGTH); timeRan = new Timer(); } } Link to comment Share on other sites More sharing options...
Xephy 237 Share Posted August 11, 2018 If your special attack % is 75, it will try to spec twice and then leave the gmaul equipped because your logic is flawed. Although, I do appreciate the public release. Hopefully some of it will be tidied up and I can refer people to it for example code. Edit: For anybody who does want to make changes: Calculations#random can be used to calculate random number between two bounds (It's in the DB API) Special attack logic is superbly flawed Spacing is erratic Can use better state logic instead of setting int values Can surround interaction attempts with "if" because they do return booleans, after all Can simply restart the timer instead of using an counter Can use the SkillTracker class to track xp gained in skills (has a by-hour function) Can use a filter to simplify your overload-absorption potion logic. Link to comment Share on other sites More sharing options...
Zendor 2 Author Share Posted August 11, 2018 3 minutes ago, Xephy said: If your special attack % is 75, it will try to spec twice and then leave the gmaul equipped because your logic is flawed. Although, I do appreciate the public release. Hopefully some of it will be tidied up and I can refer people to it for example code. I know about that, but since the bot (normally) will start with 100% special attack, and the G maul use 50% it will never happen to have 55 or something like that, and i have the if after the use of the special att incase the person use the bot and manually get the "power surge" of the mini game. Thanks for point it out ! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.