Jump to content

Botre

Members
  • Posts

    5883
  • Joined

  • Last visited

  • Days Won

    18
  • Feedback

    100%

Everything posted by Botre

  1. RandomExecutor.unregisterHook(RandomEvent.RUN_AWAY_FROM_COMBAT) ;
  2. If 50 bots stand in between two trees and all of them pick the right one over the left one then there's nothing glad about that :p Ah well, I'll keep the left one for myself I guess (a)
  3. I have no doubts about it's functionality ^^ But it's the reason why most people botting are standing at the same bankbooths for example, or will choose the same tree over and over again when standing in between two trees. Not sure if Jagex tracks such behavior, I doubt it actually :p But yeah, just annoys me
  4. objects.closest seems to always return the first loaded object when multiple objects are the closest (have the same distance), I hate that.
  5. This should do the job ;) public static RS2Object getClosest(Script script, String name, String action, Integer minDistance, Integer maxDistance, Area mandatoryArea, Area illegalArea, Position mandatoryPosition, Position illegalPosition, boolean mustBeReachable) { RS2Object closestObject = null; double lowestDistance = Double.MAX_VALUE; List<RS2Object> objectList = script.objects.getAll(); int size = objectList.size(); int index = 0; for (RS2Object object : objectList) { index++; if (object == null) { continue; } if (!object.exists()) { continue; } if (!object.getName().toLowerCase().equalsIgnoreCase(name)) { continue; } if (object.getDefinition() == null) { continue; } if (!Arrays.asList(object.getDefinition().getActions()).contains(action)) { continue; } if (minDistance != null && object.getPosition().distance(script.myPosition()) < minDistance) { continue; } if (maxDistance != null && object.getPosition().distance(script.myPosition()) > maxDistance) { continue; } if (mandatoryArea != null && !mandatoryArea.contains(object.getPosition())) { continue; } if (illegalArea != null && illegalArea.contains(object.getPosition())) { continue; } if (mandatoryPosition != null && !object.getPosition().equals(mandatoryPosition)) { continue; } if (illegalPosition != null && object.getPosition().equals(illegalPosition)) { continue; } if (mustBeReachable && !script.map.canReach(object)) { continue; } if (object.getPosition().distance(script.myPosition()) < lowestDistance) { closestObject = object; lowestDistance = object.getPosition().distance(script.myPosition()); } if (object.getPosition().distance(script.myPosition()) == lowestDistance) { if (new Random().nextInt(size - index + 1) == 0) { closestObject = object; lowestDistance = object.getPosition().distance(script.myPosition()); } } } return closestObject; }
  6. Wrote this mainly for the cooldown timer. setCooldown(Message message) goes in the onMessage method of the script instance you use it in. Constructive feedback is appreciated as always! public class LumbridgeHomeTeleporter { private Script script; private int cooldown; public LumbridgeHomeTeleporter(final Script script) { this.script = script; Thread cooldownTimer = new Thread(new Runnable() { public void run() { while (true) { try { MethodProvider.sleep(60000); if (cooldown > 0) { --cooldown; } } catch (InterruptedException e) { e.printStackTrace(); } } } }); cooldownTimer.start(); } public void teleport() throws InterruptedException { if (this.cooldown == 0 && this.script.skills.getDynamic(Skill.MAGIC) > 0) { Timer timer = new Timer(); if (this.script.magic.castSpell(Spell.HOME_TELEPORT)) { while (this.cooldown == 0 && !this.script.map.canReach(LocationArea.LUMBRIDGE_TELEPORT_AREA.getArea().getRandomPosition(0)) && timer.getElapsed() < 10000) { MethodProvider.sleep(600); } } } } public void setCooldown(Message message) { if (message.getType().equals(Message.MessageType.GAME) && message.getMessage().toLowerCase().contains("you need to wait another")) { String match = null; Pattern pattern = Pattern.compile("[0-9]+"); Matcher matcher = pattern.matcher(message.getMessage()); while (matcher.find()) { match = matcher.group(); } this.cooldown = Integer.parseInt(match); } } public int getCooldown() { return this.cooldown; } } h
  7. == false ew
  8. If they don't force the switch it won't happen and the switch not happening ins't an option anymore.
  9. Very evil, twc'ed, bob.
  10. dat avatar tho <3

    1. Extreme Scripts

      Extreme Scripts

      Much beast, such sexiness <3

  11. Guys the reason everyone is getting access to all scripts is because the client isn't 100% stable. Please report your client-related bugs in the correct thread: http://osbot.org/forum/forum/232-osbot-2-bugserrors/ There's not much APA can do about broken randoms.
  12. You do get randoms on pvp worlds. Proof: http://osbot.org/forum/topic/50632-randoms-pvp-worlds/ Stop making baseless claims.
  13. You do get randoms on PVP worlds. I have seen it happen countless times :p
  14. Motherlode ore veins are dynamic / have multiple states. Get its depleted id or model and use that reference to check if the vein is depleted instead (the depleted state, contrary to the undepleted state, is static).
  15. You could get a random yes. The risk of getting them is significantly lower on PVP worlds though.
  16. If you stay near the object in question it shouldn't cease existing. Objects change reference when the game reloads (walking away to far / logging out) unless you use their unique hash value as explained by Laz here: http://osbot.org/forum/topic/54215-object-reference-becomes-irrelevant-when-reloading-how-to/ Or is the object you are trying to mine dynamic ? Does it have multiple states? In that case you might need to revisit its declaration.
  17. While (animating) { sleep for the duration of one animation cycle; } The time of a full cycle will always be a multiple of 600 (in ms). Another way of doing it would be to start a timer once you are not animating anymore, and if this timer exceeds the animation rest time -> re-click rock.
  18. Ah beast! Exactly what I was looking for ty!
  19. Botre

    @JAGEX

    Some one's mad
  20. Ok, so I have an Entity variable holding the value of an entity (not null). When I walk away far enough or teleport away, this variable's value becomes irrelevant: when you walk back to the initial Entity the value does not refer to that same Entity anymore (I doesn't refer to anything anymore actually). I suppose this is because the game reloads and a new reference is given, if I'm wrong about this please inform me Is there a way to store the initial value so that it does not become irrelevant whenever an entity is reloaded? I'm thinking about storing data of the initial Entity and then re-scanning for that data, but kinda hoping for a better solution :p
  21. World hopping is broken.
  22. Yeah But if you add a model or definition check it will.
  23. It will probably reduce the bans caused by client-mechanics detection.
  24. http://osbot.org/osbot2_api/org/osbot/rs07/api/model/InteractableObject.html
×
×
  • Create New...