Lord Rivaldo 0 Share Posted August 28, 2017 Here is a free script source for you guys, i wrote this yesterday in 2 minutes because i needed a bot to run while going to sleep. aslong as your name isn't eclipseop or vladboobs don't criticize my code haha package thief; import java.awt.Graphics; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.skills.Skill; 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.utilities.impl.Condition; import org.dreambot.api.wrappers.interactive.GameObject; import org.dreambot.api.wrappers.interactive.NPC; @ScriptManifest(author = "Riet/Trester/Rivaldo", category = Category.THIEVING, description = "", name = "[Riet] safe cracker", version = 0) public class looter extends AbstractScript { Timer timer; private Timer t = new Timer(); private State state; private enum State { LOOTING, BANKING, WAIT; } private State getState() { if (getInventory().contains("Lobster")) { return State.LOOTING; } if (getInventory().isFull() || !getInventory().contains("Lobster")) { return State.BANKING; } return State.WAIT; } public void onStart() { getSkillTracker().start(Skill.THIEVING); } @Override public int onLoop() { GameObject safe = getGameObjects().closest("Wall safe"); NPC bankguy = getNpcs().closest("Emerald Benedict"); state = getState(); switch (state) { case LOOTING: if (getLocalPlayer().getHealthPercent() < 50) { getInventory().interact("Lobster", "Eat"); sleep(1090); } else { if (safe != null) { if (safe.isOnScreen()) { if (!getLocalPlayer().isAnimating() && !getLocalPlayer().isInteractedWith() && !getLocalPlayer().isMoving() && getLocalPlayer().getAnimationDelay() == 0) { safe.interact("Crack"); sleep(1790); sleepUntil(new Condition() { public boolean verify() { return !getLocalPlayer().isAnimating(); } }, Calculations.random(5000, 12000)); } } else { getCamera().rotateToEntity(safe); } } } case BANKING: if (getBank().isOpen() && !getInventory().contains("Lobster")) { if (getBank().contains("Lobster")) { getBank().depositAllItems(); sleepUntil(new Condition() { public boolean verify() { return getInventory().isEmpty(); } }, Calculations.random(5000, 12000)); getBank().withdraw("Lobster", 7); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Lobster"); } }, Calculations.random(5000, 12000)); } else { System.exit(0); } } if (getInventory().isFull() || !getInventory().contains("Lobster")) { if (bankguy != null) { if (!getBank().isOpen()) { if (bankguy.isOnScreen()) { bankguy.interact("Bank"); sleep(1090); } else { getCamera().rotateToEntity(bankguy); } } } else { if (getBank().contains("Lobster")) { getBank().depositAllItems(); sleepUntil(new Condition() { public boolean verify() { return getInventory().isEmpty(); } }, Calculations.random(5000, 12000)); getBank().withdraw("Lobster", 7); sleepUntil(new Condition() { public boolean verify() { return getInventory().contains("Lobster"); } }, Calculations.random(5000, 12000)); } else { System.exit(0); } } } case WAIT: break; default: break; } return 5; } public void onPaint(Graphics g) { if (t == null) { t = new Timer(0); } g.drawString("Time running: " + Timer.formatTime(t.elapsed()), 12, 59); g.drawString( "Levels gained: " + getSkills().getRealLevel(Skill.THIEVING) + "(+" + getSkillTracker().getGainedLevels(Skill.THIEVING) + ")", 12, 79); g.drawString( "XP gained: " + getSkillTracker().getGainedExperience(Skill.THIEVING) + "(" + getSkillTracker().getGainedExperiencePerHour( Skill.THIEVING) + ")", 12, 91); g.drawString( "XP to level: " + getSkills().getExperienceToLevel(Skill.THIEVING), 12, 103); } } Link to comment Share on other sites More sharing options...
Almonds 110 Share Posted August 28, 2017 Nice, helps to see some basics. Link to comment Share on other sites More sharing options...
Lord Rivaldo 0 Author Share Posted August 28, 2017 Nice, helps to see some basics. glad you find this useful Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted August 28, 2017 While my name might not be Eclipseop or Vladboobs I still have some really minor suggestions for your code. First of all I am not saying your code is bad, it actually is really good and I hope to see you release some Scripts to the SDN! Instead of using System#exit you can also just use AbstractScript#stop which will keep the Client up instead of closing it (I do realize that System#exit probably was on purpose since you said you wrote this to run it over night) You have two Timer Objects, one would have been enough and allows you to remove the null check from the Paint You define two Objects (safe,bankguy) no matter which state it is, you could only define it in the specific case Wrap methods like Bank#withdraw with an if and sleep inside there, incase the method fails to withdraw you wont stand there sleeping 5-12 seconds Lambdas are a cool feature of Java8 you should check it out @Notorious post about it Link to comment Share on other sites More sharing options...
Lord Rivaldo 0 Author Share Posted August 28, 2017 While my name might not be Eclipseop or Vladboobs I still have some really minor suggestions for your code. First of all I am not saying your code is bad, it actually is really good and I hope to see you release some Scripts to the SDN! Instead of using System#exit you can also just use AbstractScript#stop which will keep the Client up instead of closing it (I do realize that System#exit probably was on purpose since you said you wrote this to run it over night) You have two Timer Objects, one would have been enough and allows you to remove the null check from the Paint You define two Objects (safe,bankguy) no matter which state it is, you could only define it in the specific case Wrap methods like Bank#withdraw with an if and sleep inside there, incase the method fails to withdraw you wont stand there sleeping 5-12 seconds Lambdas are a cool feature of Java8 you should check it out @Notorious post about it thanks for your reply i will look into lambda and the other points can be improved on yeah Link to comment Share on other sites More sharing options...
Articron 738 Share Posted August 28, 2017 Hey Trester, when did you get unbanned? Link to comment Share on other sites More sharing options...
Roma 2221 Share Posted August 28, 2017 I'm still waiting for the Entrana walker Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted August 29, 2017 Hey Trester, when did you get unbanned? lmao hes banned! Link to comment Share on other sites More sharing options...
Nederland 0 Share Posted September 4, 2017 Hey Trester, when did you get unbanned? i never get banned arti i was always here and evade whenever besneden lul I'm still waiting for the Entrana walker HAHAHAHHA Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.