Jump to content

Botre

Members
  • Posts

    5883
  • Joined

  • Last visited

  • Days Won

    18
  • Feedback

    100%

Community Answers

  1. Botre's post in Is there a way to use shortcut keys in my script? was marked as the answer   
    VK_F6
    VK_ESCAPE
  2. Botre's post in Help me find a pattern to this madness was marked as the answer   
    Enjoy
     
    http://en.wikipedia.org/wiki/Bitwise_operation
  3. Botre's post in Interface object's getMessage() returns %1 instead of number was marked as the answer   
    config debug
  4. Botre's post in Need help with walking a path was marked as the answer   
    Not my greatest snippet :p
    public static boolean traversePath(Script script, Position[] path, boolean reversed, int toggleRunOnAt, int toggleRunOffAt, boolean toggleRunOnInCombat, long timeout) throws InterruptedException { Timer timer = new Timer(); while (!reversed ? script.map.distance(path[path.length - 1]) > 4 : script.map.distance(path[0]) > 4 && timer.getElapsed() < timeout) { PathWalkMethods.runManager(script, toggleRunOnAt, toggleRunOffAt, toggleRunOnInCombat); Position bestPosition = null; int attempts = 0; if (!reversed) { for (int i = 1; i < path.length; i++) { if (script.map.canReach(path[i])) { MiniMapTileDestination mmtd = new MiniMapTileDestination(script.bot, path[i]);// TODO if (mmtd != null && mmtd.isVisible()) { bestPosition = path[i]; } } } } else { for (int i = path.length - 1; i > 0; i--) { if (script.map.canReach(path[i])) { MiniMapTileDestination mmtd = new MiniMapTileDestination(script.bot, path[i]);// TODO if (mmtd != null && mmtd.isVisible()) { bestPosition = path[i]; } } } } if (bestPosition != null) { script.mouse.click(new MiniMapTileDestination(script.bot, bestPosition)); int failsafe = 0; while (failsafe < 10 && script.myPlayer().getPosition().distance(bestPosition) > 2) { MethodProvider.sleep(600); failsafe++; if (script.myPlayer().isMoving()) { failsafe = 0; } } return true; } else { attempts++; if (attempts > 5) { return false; } script.camera.moveYaw(script.camera.getYawAngle() + MethodProvider.random(60,80)); } } return true; } public static void runManager(Script script, int toggleRunOnAt, int toggleRunOffAt, boolean toggleRunOnInCombat) { if (script.settings.getRunEnergy() >= toggleRunOnAt || (toggleRunOnInCombat ? script.settings.getRunEnergy() > 0 && script.myPlayer().isUnderAttack() : false)) { script.settings.setRunning(true); } if (script.settings.getRunEnergy() <= toggleRunOffAt && (toggleRunOnInCombat ? !script.myPlayer().isUnderAttack() : true)) { script.settings.setRunning(false); } }
  5. Botre's post in Position in front of player was marked as the answer   
    get your position, get your rotation, remove or add 1 to your position's x and/or y coordinate based on that rotation.
  6. Botre's post in Exp per hour request was marked as the answer   
    XperHour = TotalXGainedInRuntime * 3600000.0D / RunTime(inMs)
  7. Botre's post in OSBot 2 getPercentageToLevel? was marked as the answer   
    public class XpDistance { private final Script script; @SuppressWarnings("unused") private final Bot b; public XpDistance(final Script script, final Bot b) { this.script = script; this.b = b; } private final int[] XP = { 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431 }; public int getXpUntilLevel(Skill skill, int level) { int x = this.XP[level - 1] - this.script.skills.getExperience(skill); return x > 0 ? x : 0; } public int getXpUntilNextLevel(Skill skill) { int x = this.XP[this.script.skills.getStatic(skill)] - this.script.skills.getExperience(skill); return x > 0 ? x : 0; } public int getXpPastCurrentLevel(Skill skill) { int x = this.script.skills.getExperience(skill) - this.XP[this.script.skills.getStatic(skill) - 1]; return x > 0 ? x : 0; } public int getPercentageUntilNextLevelFromZero(Skill skill) { int p = this.script.skills.getExperience(skill) * 100 / this.XP[this.script.skills.getStatic(skill)]; return p > 0 ? p : 0; } public int getPercentageUntilNextLevelFromCurrentLevel(Skill skill) { int p = this.getXpUntilNextLevel(skill) * 100 / (this.XP[this.script.skills.getStatic(skill)] - this.XP[this.script.skills .getStatic(skill) - 1]); return p > 0 ? p : 0; } } Sorry my previous answer didn't really answer your question, this should do it^
     
    Update 2: added some ternary operators in the returns.
×
×
  • Create New...