H0rn Posted March 1, 2018 Share Posted March 1, 2018 (edited) Pretty simple script, it picks a random dummy in the room to attack in varrock east, gets you 8 attack then stops. Download: dummy.jar Source: import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.event.WalkingEvent; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(name = "H0rns Dummy Attacker", author = "H0rn", version = 0.1, info = "", logo = "") public class Main extends Script { private long startTime, timeRan; Position[] dummySpot = {new Position(3254,3437,0), new Position(3251,3436,0), new Position(3251,3438,0)}; Position chosenSpot; public static String currentStatus = "Starting"; @Override public void onStart() { this.startTime = System.currentTimeMillis(); getExperienceTracker().start(Skill.ATTACK); log ("* Welcome to " + this.getName()); chosenSpot = dummySpot[random(0,dummySpot.length-1)]; log ("We chose spot"+chosenSpot); } @Override public void onExit() { log ("* Thanks for using "+ this.getName()); log ("We gained "+getSkills().getExperienceTracker().getGainedXP(Skill.ATTACK)+" ("+getSkills().getExperienceTracker().getGainedLevels(Skill.ATTACK)+" Levels)"); } @Override public int onLoop() throws InterruptedException { if (!myPosition().equals(chosenSpot)) { currentStatus = "Walking to dummy"; WalkingEvent walkEvent = new WalkingEvent(chosenSpot); walkEvent.setMinDistanceThreshold(0); walkEvent.setOperateCamera(true); execute(walkEvent); } else if (getSkills().getStatic(Skill.ATTACK) < 8) { attackDummy(); } else if (getSkills().getStatic(Skill.ATTACK) >=8) { log ("Attack level is 8."); this.stop(false); } return random(100,600); } @Override public void onPaint(Graphics2D g) { this.timeRan = (System.currentTimeMillis() - this.startTime); g.setFont(new Font("Sans-Serif", Font.BOLD, 10)); g.setColor(Color.RED); g.drawRect(mouse.getPosition().x - 3, mouse.getPosition().y - 3, 6, 6); g.setColor(new Color(20,237,240,255)); g.drawString(getName()+" v"+getVersion(), 10, 60); g.setColor(Color.WHITE); g.drawString("Runtime: "+ft(this.timeRan), 10,75); g.drawString("Task: "+currentStatus,10,90); if (getSkills().getExperienceTracker().getGainedXP(Skill.ATTACK) >0) { g.drawString("Attack Lvl: "+getSkills().getStatic(Skill.ATTACK) + " (+"+getSkills().getExperienceTracker().getGainedLevels(Skill.ATTACK)+")",10,105); g.drawString("Attack XP: "+getSkills().getExperienceTracker().getGainedXP(Skill.ATTACK),10,120); } } public final String ft(final long ms){ long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } private void attackDummy() throws InterruptedException { RS2Object dummy = objects.closest("Dummy"); if (dummy != null && dummy.interact("Attack")) { currentStatus = "Attacking dummy"; Sleep.sleepUntil(() -> !myPlayer().isAnimating(),3000); } } } Edited March 1, 2018 by H0rn Removed unused imports. 1 Quote Link to comment Share on other sites More sharing options...
Zappster Posted March 1, 2018 Share Posted March 1, 2018 Gz on release Quote Link to comment Share on other sites More sharing options...