Jump to content

domp

Members
  • Posts

    17
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

889 profile views

domp's Achievements

Newbie

Newbie (1/10)

3

Reputation

  1. @Alek Position rcarea = new Position(2701, 3719, 0); Area rcarea1 = new Area(2702, 3719, 2701, 3719); Area reset = new Area(2705, 3687, 2699, 3689); WalkingEvent walk = new WalkingEvent(rcarea); private Position[] resetpath = { new Position(2698, 3695, 0), new Position(2699, 3708, 0), new Position(2701, 3719, 0) }; // private ExperienceTracker expTracker; long timer = 0L; public long startTime = System.currentTimeMillis(); String status = "Idle"; public void onStart() throws InterruptedException { startExp = skills.getExperience(Skill.STRENGTH); if (!combat.isAutoRetaliateOn()) { combat.toggleAutoRetaliate(true); expTracker = getExperienceTracker(); } } @Override public int onLoop() throws InterruptedException { // attack if (rcarea1.contains(myPosition())) { status = "Attacking"; log("in rcarea auto-retaliating"); timer += 1L; antiban(); } // reset if (timer >= 250) { status = "Reset aggro"; log("timer hit 250, resetting aggro"); getWalking().walk(reset); camera.moveYaw(random(0, 360)); timer = 0L; } // walkback if (reset.contains(myPosition())) { status = "Walking back"; log("walking back"); getWalking().walkPath(resetpath); camera.moveYaw(random(0, 360)); } return (random(1000, 3000)); } I get an error at getWalking().walkpath(resetpath); saying the method is not applicable. Only webWalk seems to get rid of the error. EDIT: tried webWalk and it reaches final destination in the middle of the path. seems to walk to the closest position and end webwalk. Any help? Should the path have more points? They can all be seen by each other on the minimap
  2. The problem with that is I'm afking in between two rock crabs so if my player is not in the exact position he needs to be then it won't aggro both crabs. I believe it's a default deviation of 2 so that wouldn't work. I'm going to try a different reset spot, maybe a little closer and not in all the trees and see if It runs smooth
  3. Hello World! I've run into a problem with my script not executing the walkingevent properly. Position rcarea = new Position(2701, 3719, 0); Area rcarea1 = new Area(2702, 3719, 2701, 3719); Area reset = new Area(2705, 3687, 2699, 3689); WalkingEvent walk = new WalkingEvent(rcarea); onLoop if (timer >= 250) { getWalking().walk(reset); camera.moveYaw(random(0, 360)); timer = 0L; status = "Reset aggro"; } // walkback if (reset.contains(myPosition())) { walk.setMinDistanceThreshold(0); walk.setEnergyThreshold(25); execute(walk); status = "Walking back"; } Now my problem comes into play when my player is resetting aggro and walks to the reset spot. IT works smoothly every now and then but sometimes he just sits in the reset spot and doesnt walk back to the crabs. The script is able to walk to the rockcrab area with no problem if I start in the reset area. And sometimes it works 100% smoothly. I have a status check and when my player gets stuck the status is 'Walking Back'. Is there any way to check what is actually going on and why my player wont walk back to crabs 90% of the time? IS the reset area I'm using too small?
  4. Bless you. All is fixed. I apologize for not posting the ab code at first
  5. // flick on if (this.timer == this.random) { if (this.prayer.open()) { this.status = "Flicking on"; this.prayer.set(PrayerButton.RAPID_HEAL, true); } else { this.prayer.open(); } this.timer = 0L; this.random = random(32, 45); } else { sleep(random(972, 1028)); this.timer += 1L; antiban(); } This used to work flawlessly and now when antiban(); gets called, either the timer stops completely or it will continue until it equals the random number and then just stop. My flicking off code is if (this.prayer.isActivated(PrayerButton.RAPID_HEAL)) { this.status = "Flicking off"; this.prayer.set(PrayerButton.RAPID_HEAL, false); } antiban code-- per alek's request private void antiban() throws InterruptedException { //beginTime = System.currentTimeMillis(); this.AB = random(1, 200); if (this.AB == 1) { this.status = "Anti-ban"; this.camera.movePitch(random(0, 360)); } if (this.AB == 2) { this.status = "Anti-ban"; this.mouse.moveOutsideScreen(); } if (this.AB == 3) { this.status = "Anti-ban"; this.mouse.moveOutsideScreen(); } if (this.AB == 4) { this.status = "Anti-ban"; this.mouse.moveOutsideScreen(); } if (this.AB == 5) { this.status = "Anti-ban"; this.skills.hoverSkill(Skill.HITPOINTS); } if (this.AB == 25) { this.status = "Anti-ban"; this.skills.hoverSkill(Skill.RANGED); } if (this.AB == 10) { this.status = "Anti-ban"; this.skills.hoverSkill(Skill.RANGED); } if (this.AB == 15) { this.status = "Anti-ban"; this.camera.moveYaw(random(0, 360)); } if (this.AB == 28) { this.status = "Anti-ban"; this.mouse.moveOutsideScreen(); } if (this.AB == 27) { this.status = "Anti-ban"; this.mouse.moveOutsideScreen(); } if (this.AB == 26) { this.status = "Anti-ban"; this.mouse.moveOutsideScreen(); } if (this.AB == 20) { this.status = "Anti-ban"; this.mouse.moveRandomly(); } if (this.AB == 19) { this.status = "Anti-ban"; this.mouse.moveRandomly(); } if (this.AB == 18) { this.status = "Anti-ban"; this.mouse.moveRandomly(); } if (this.AB == 17) { this.status = "Anti-ban"; this.mouse.moveRandomly(); } } Any help would be great
  6. https://osbot.org/api/org/osbot/rs07/api/ui/Message.MessageType.html I know this exists. I am trying to use it but I need some assistance. The messageType is what I need help with chatbox.contains(messageType, String) GAME, PLAYER, RECEIVE_TRADE???? What should messageType be if I want to be able to read a string inputted by game for example "You can't dig here." Thankyou for the halp
  7. domp

    Easy help

    Thankyou, I implemented this and I will let you know how it works, currently laying low..did alot of testing that was faulty Thank you for this idea! I will be using this for my reset state!
  8. domp

    Easy help

    I am trying to get my player to walk back to ONE specific coord(x, y, z), I am using getWalking().walk(coord) and the bot always seems to click one tile off of the coordinate I have it set to move to. I need to be on a specific tile to aggro all the monsters and efficiently run my script Also on tips/ideas/logic about having myPlayer reset aggro? I'm using a not so good check because If I kill all the crabs my script thinks I have to reset aggro if (!myPlayer().isHitBarVisible()) { if (!RESET_AREA.contains(myPlayer())) { return State.Reset; } } Is there a efficient way to set a timer so after a certain amount of time the script returns a state? By the way, trying to make a simple Sandcrab killer with resetting Thank you so much !
  9. import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.util.Objects; import org.osbot.rs07.api.Inventory; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.api.ui.MagicSpell; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.api.ui.Spells.NormalSpells; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.api.util.ExperienceTracker; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Domp", info = "Tree Farming", logo = "@", name = "TP", version = 0.1) public class TP extends Script { public TP(String name){ this.willowtree = Objects.requireNonNull(willowtree); } // learn to use areas public Position[] vpath = { new Position(3213, 3436, 0), new Position(3225, 3457, 0), new Position(3228, 3457, 0) }; public Position[] gpath = { new Position(3218, 3451, 0), new Position(3206, 3454, 0), new Position(3199, 3459, 0), new Position(3196, 3468, 0), new Position(3196, 3485, 0), new Position(3186, 3494, 0), new Position(3186, 3505, 0) }; public Position[] lpath = { new Position(3204, 3217, 0), new Position(3195, 3218, 0), new Position(3193, 3229, 0) }; public Position[] tpath = { new Position(2966, 3388, 0), new Position(2963, 3402, 0), new Position(2957, 3417, 0), new Position(2949, 3430, 0), new Position(2946, 3444, 0), new Position(2938, 3451, 0), new Position(2936, 3441, 0) }; public Position[] fpath = { new Position(2975, 3379, 0), new Position(2988, 3372, 0), new Position(2998, 3374, 0) }; String willowtree = "Willow Tree"; final String WILLOW_TREE = "Willow Tree"; final String WILLOW_LOG = "Willow logs"; // final Area BANK_AREA = new Area(x,y,topleft,topright); private ExperienceTracker expTracker; private long start; @[member=Override] public void onStart() { log("starting tree farming!!"); this.expTracker = getExperienceTracker(); this.expTracker.start(Skill.FARMING); this.start = System.currentTimeMillis(); } private static enum State { Varrock, Gnome, Lumby, Falador, Taverly, Done; public String toString() { String s = name().toLowerCase().replaceAll("_", " "); return s.substring(0, 1).toUpperCase().concat(s.substring(1, s.length())); } } // if(player.getPosition() == new Position(3228, 3457, 0)) <----could work // for a check // if player position = last location // teleport to next tree patch return.nextstate int check = new Integer(0); private State getState() { // need to fix this to correctly return states... if (getInventory().contains(new String[] { "Rune axe" })) { check++; return State.Varrock; } if (check == 1) { // or use a check on the amount of empty pots in check++; // invent return State.Gnome; } if (check == 2) { check++; return State.Lumby; } if (check == 3) { // change int x check++; return State.Taverly; } if (check == 4) { return State.Falador; } return State.Done; } // code in loop Entity willow = closestObjectForName(WILLOW_TREE); @[member=Override] public int onLoop() throws InterruptedException { State result = getState(); log(result); switch (result) { case Varrock: if (getInventory().isFull()) { getInventory().dropForNameThatContains("Willow"); getInventory().dropForNameThatContains("Empty plant pot"); } else { castSpell(Spells.NormalSpells.VARROCK_TELEPORT); sleep(random(300, 600)); getWalking().webWalk(vpath); getCamera().toEntity(willow); log(check + "varrock"); /* * if(!open(Tab.MAGIC)){ open(Tab.MAGIC); * castSpell(Spells.NormalSpells.VARROCK_TELEPORT);// tele * sleep(random(25, 100)); getWalking().webWalk(vpath); } */ if (willow != null) { if (willow.isVisible()) { // basic woodcutter if (!this.myPlayer().isAnimating()) { if (!getInventory().isFull()) {// for future use if (!this.myPlayer().isMoving()) { willow.interact("Check-health"); sleep(random(500, 700)); willow.interact("Chop down"); sleep(random(25, 75)); } else if (!willow.isVisible()) { if (!this.myPlayer().isAnimating()) { if (!getInventory().isFull()) {// add a full // inv // check... // drop // willows // if // inv // reaches // full objects.closest("Tree stump").interact("Dig"); } else { objects.closest("Dead tree").interact("Dig"); sleep(random(500, 700)); getInventory().dropForNameThatContains("willow"); } } } } } } } } // code using supercompost and planting tree. look up using mouse // entity with entity break; case Gnome: // tele Entity spirit = closestObjectForName("Spirit tree"); getWalking().webWalk(gpath); getCamera().toEntity(spirit); objects.closest("Spirit tree").interact("Travel"); break; case Lumby: { if (!open(Tab.MAGIC)) { open(Tab.MAGIC); castSpell(Spells.NormalSpells.LUMBRIDGE_TELEPORT); getWalking().webWalk(lpath); } log(check + "lumbridge"); } break; case Falador: { // tele if (!open(Tab.MAGIC)) { castSpell(Spells.NormalSpells.FALADOR_TELEPORT); getWalking().webWalk(fpath); } log(check + "fally"); } break; case Taverly: { // tele if (!open(Tab.MAGIC)) { castSpell(Spells.NormalSpells.FALADOR_TELEPORT); getWalking().webWalk(tpath); } log(check + "taverly"); } break; case Done: stop(); default: } return random(600); } private Entity closestObjectForName(String WILLOW_TREE) { // TODO Auto-generated method stub return willow;//FIX THIS FUCKING NULL } private boolean open(Tab magic) { // TODO Auto-generated method stub return true; } @SuppressWarnings("unused") private void castSpell(MagicSpell spell) { // TODO Auto-generated method stub NormalSpells vartele = Spells.NormalSpells.VARROCK_TELEPORT; } public final boolean toEntity(Entity willow) { return false; } // code executed at the end @[member=Override] public void onExit() { log("Done farming"); } @[member=Override] public void onPaint(Graphics2D graphics) { State state1 = getState(); Graphics2D g = graphics; g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF)); if (this.expTracker != null) { g.setColor(Color.WHITE); g.drawString("Time till level " + (getSkills().getStatic(Skill.FARMING) + 1) + ": " + formatTime(this.expTracker.getTimeToLevel(Skill.FARMING)), 10, 250); g.drawString("Exp: " + this.expTracker.getGainedXP(Skill.FARMING) + " (" + this.expTracker.getGainedXPPerHour(Skill.FARMING) + " / hour)", 10, 270); g.drawString("Level: " + getSkills().getStatic(Skill.FARMING) + " (Gained: " + this.expTracker.getGainedLevels(Skill.FARMING) + ")", 10, 290); } g.setColor(Color.CYAN); g.drawString("Status: " + state1.toString(), 10, 310); g.drawString("Runtime: " + (this.start == -1L ? "Idle" : formatTime(System.currentTimeMillis() - this.start)), 10, 330); } private String formatTime(long ms) { long s = ms / 1000L; long m = s / 60L; long h = m / 60L; s %= 60L; m %= 60L; h %= 24L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(h), Long.valueOf(m), Long.valueOf(s) }); } } Added some of your guises suggestions. Changed private Entity to return willow; instead of return null; Does this make the difference? I also set int check as a new Integer instead of not giving it a value. Spent the whole day today thinking about this and didnt get much progress. Ahh 7 hours later and I barely got any further Wish me luck
  10. state1 is used to draw the current state instead of using the state I used for my switch, for some reason the first state I used to grab getState(). isnt applicable when I try to draw it. Maybe I need a lesson on nulls as I am confuzzzzled.
  11. @[member=Override] public void onPaint(Graphics2D graphics) { State state1 = getState(); Graphics2D g = graphics; g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF)); if (this.expTracker != null) { g.setColor(Color.WHITE); g.drawString("Time till level " + (getSkills().getStatic(Skill.FARMING) + 1) + ": " + formatTime(this.expTracker.getTimeToLevel(Skill.FARMING)), 10, 250); g.drawString("Exp: " + this.expTracker.getGainedXP(Skill.FARMING) + " (" + this.expTracker.getGainedXPPerHour(Skill.FARMING) + " / hour)", 10, 270); g.drawString("Level: " + getSkills().getStatic(Skill.FARMING) + " (Gained: " + this.expTracker.getGainedLevels(Skill.FARMING) + ")", 10, 290); } g.setColor(Color.CYAN); g.drawString("Status: " + state1.toString(), 10, 310); g.drawString("Runtime: " + (this.start == -1L ? "Idle" : formatTime(System.currentTimeMillis() - this.start)), 10, 330); } I put State state1 = getState(); in the paint method where it is going to be used instead. private Entity closestObjectForName(String wILLOW_TREE2) { // TODO Auto-generated method stub return null; } Any help with this? Im not sure on what to properly configure for null
  12. Lol yes I wrote this script, I am pretty much self-taught and know very little. I am fixing what you suggested at the moment. I also purposely wanted falador to return if check is greater than 3 because it is the last case and I dont think it really needs a check. Thank you for spotting the return null; I am also working on seeing if it is an NPE
  13. import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import org.osbot.rs07.api.Inventory; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.api.ui.MagicSpell; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.api.ui.Spells.NormalSpells; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.api.util.ExperienceTracker; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; @ScriptManifest(author = "Dp", info = "Tree Farming", logo = "@", name = "TP", version = 0.1) public class TP extends Script { // learn to use areas public Position[] vpath = { new Position(3213, 3436, 0), new Position(3225, 3457, 0), new Position(3228, 3457, 0) }; public Position[] gpath = { new Position(3218, 3451, 0), new Position(3206, 3454, 0), new Position(3199, 3459, 0), new Position(3196, 3468, 0), new Position(3196, 3485, 0), new Position(3186, 3494, 0), new Position(3186, 3505, 0) }; public Position[] lpath = { new Position(3204, 3217, 0), new Position(3195, 3218, 0), new Position(3193, 3229, 0) }; public Position[] tpath = { new Position(2966, 3388, 0), new Position(2963, 3402, 0), new Position(2957, 3417, 0), new Position(2949, 3430, 0), new Position(2946, 3444, 0), new Position(2938, 3451, 0), new Position(2936, 3441, 0) }; public Position[] fpath = { new Position(2975, 3379, 0), new Position(2988, 3372, 0), new Position(2998, 3374, 0) }; // final String WILLOW_TREE = "Willow Tree"; final String WILLOW_LOG = "Willow logs"; // final Area BANK_AREA = new Area(x,y,topleft,topright); private ExperienceTracker expTracker; private long start; @[member=Override] public void onStart() { log("starting tree farming!!"); this.expTracker = getExperienceTracker(); this.expTracker.start(Skill.FARMING); this.start = System.currentTimeMillis(); } private static enum State { Varrock, Gnome, Lumby, Falador, Taverly; public String toString() { String s = name().toLowerCase().replaceAll("_", " "); return s.substring(0, 1).toUpperCase().concat(s.substring(1, s.length())); } } // if(player.getPosition() == new Position(3228, 3457, 0)) <----could work // for a check // if player position = last location // teleport to next tree patch return.nextstate State state1 = getState(); int check; private State getState() { // need to fix this to correctly return states... if (getInventory().contains(new String[] { "Rune axe" })) { check++; return State.Varrock; } if (check == 1) { // or use a check on the amount of empty pots in check++; // invent return State.Gnome; } if (check == 2) { check++; return State.Lumby; } if (check == 3) { // change int x check++; return State.Taverly; } return State.Falador; } // code in loop Entity willow; @[member=Override] public int onLoop() throws InterruptedException { State result = getState(); log(result); switch (result) { case Varrock: willow = closestObjectForName(WILLOW_TREE); if (getInventory().isFull()) { getInventory().dropForNameThatContains("willow"); getInventory().dropForNameThatContains("Empty plant pot"); } else { castSpell(Spells.NormalSpells.VARROCK_TELEPORT); sleep(random(25, 100)); getWalking().webWalk(vpath); getCamera().toEntity(willow); log(check + "varrock"); /* * if(!open(Tab.MAGIC)){ open(Tab.MAGIC); * castSpell(Spells.NormalSpells.VARROCK_TELEPORT);// tele * sleep(random(25, 100)); getWalking().webWalk(vpath); } */ if (willow != null) { if (willow.isVisible()) { // basic woodcutter if (!this.myPlayer().isAnimating()) { if (!getInventory().isFull()) {// for future use if (!this.myPlayer().isMoving()) { willow.interact("Check-health"); sleep(random(500, 700)); willow.interact("Chop down"); sleep(random(25, 75)); } else if (!willow.isVisible()) { if (!this.myPlayer().isAnimating()) { if (!getInventory().isFull()) {// add a full // inv // check... // drop // willows // if // inv // reaches // full objects.closest("Tree stump").interact("Dig"); } else { objects.closest("Dead tree").interact("Dig"); sleep(random(500, 700)); getInventory().dropForNameThatContains("willow"); } } } } } } } } // code using supercompost and planting tree. look up using mouse // entity with entity break; case Gnome: // tele Entity spirit = closestObjectForName("Spirit tree"); getWalking().webWalk(gpath); getCamera().toEntity(spirit); objects.closest("Spirit tree").interact("Travel"); break; case Lumby: { if (!open(Tab.MAGIC)) { open(Tab.MAGIC); castSpell(Spells.NormalSpells.LUMBRIDGE_TELEPORT); getWalking().webWalk(lpath); } log(check + "lumbridge"); } break; case Falador: { // tele if (!open(Tab.MAGIC)) { castSpell(Spells.NormalSpells.FALADOR_TELEPORT); getWalking().webWalk(fpath); } log(check + "fally"); } break; case Taverly: { // tele if (!open(Tab.MAGIC)) { castSpell(Spells.NormalSpells.FALADOR_TELEPORT); getWalking().webWalk(tpath); } log(check + "taverly"); } break; default: } return random(600); } private boolean open(Tab magic) { // TODO Auto-generated method stub return false; } @SuppressWarnings("unused") private void castSpell(MagicSpell spell) { // TODO Auto-generated method stub NormalSpells vartele = Spells.NormalSpells.VARROCK_TELEPORT; } private Entity closestObjectForName(String willow_tree2) { // TODO Auto-generated method stub return null; } public final boolean toEntity(Entity entity) { return false; } // code executed at the end @[member=Override] public void onExit() { log("Done farming"); } @[member=Override] public void onPaint(Graphics2D graphics) { Graphics2D g = graphics; g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF)); if (this.expTracker != null) { g.setColor(Color.WHITE); g.drawString("Time till level " + (getSkills().getStatic(Skill.FARMING) + 1) + ": " + formatTime(this.expTracker.getTimeToLevel(Skill.FARMING)), 10, 250); g.drawString("Exp: " + this.expTracker.getGainedXP(Skill.FARMING) + " (" + this.expTracker.getGainedXPPerHour(Skill.FARMING) + " / hour)", 10, 270); g.drawString("Level: " + getSkills().getStatic(Skill.FARMING) + " (Gained: " + this.expTracker.getGainedLevels(Skill.FARMING) + ")", 10, 290); } g.setColor(Color.CYAN); g.drawString("Status: " + state1.toString(), 10, 310); g.drawString("Runtime: " + (this.start == -1L ? "Idle" : formatTime(System.currentTimeMillis() - this.start)), 10, 330); } private String formatTime(long ms) { long s = ms / 1000L; long m = s / 60L; long h = m / 60L; s %= 60L; m %= 60L; h %= 24L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(h), Long.valueOf(m), Long.valueOf(s) }); } }
  14. I deleted both those variables and replaced all references with actual values. Script still not working. Changed a few things, still not working
  15. Added @override and no change, logger still shows nothing happened
×
×
  • Create New...