Jump to content

lare96

Members
  • Posts

    70
  • Joined

  • Last visited

  • Feedback

    100%

Profile Information

  • Gender
    Male
  • Interests
    Music, runescape private server programming, osbot scripting, skateboarding, and watching japanese horror movies.

Contact Methods

  • Skype
    lare96.rsps

Recent Profile Visitors

1337 profile views

lare96's Achievements

Iron Poster

Iron Poster (3/10)

11

Reputation

  1. lare96

    NMZ Flicker

    Will flick "Rapid Heal", drink overloads when necessary and will drink 1-2 absorption sips after every overload sip. Make sure that you start the bot when you're inside the arena, you've guzzled your rock cakes and fully set up your character to be ready for combat (1HP, standing in corner, ready to flick). Sorry about the poor/messy quality but I whipped it up in 15 or so minutes, but I've been using it all day and it works perfectly. Enjoy! (Shitty XP because this is while I was debugging the script.) import com.google.common.base.Stopwatch; import org.osbot.rs07.api.ui.PrayerButton; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.time.LocalTime; import java.util.concurrent.TimeUnit; /** * @author lare96 <http://github.org/lare96> */ @ScriptManifest(logo = "", name = "NmzFlicker", author = "lare96", version = 1.0, info = "Will flick HP and pot overloads/absorbs.") public final class NmzFlicker extends Script { private final Stopwatch watch = Stopwatch.createStarted(); private String status = "Idle..."; private int sipAbsortption = 0; @Override public void onStart() { experienceTracker.start(Skill.ATTACK); experienceTracker.start(Skill.DEFENCE); experienceTracker.start(Skill.STRENGTH); } @Override public int onLoop() throws InterruptedException { if (!combat.isAutoRetaliateOn() && !prayer.isActivated(PrayerButton.RAPID_HEAL)) { status = "Turning on auto-retaliate..."; combat.toggleAutoRetaliate(true); return random(1000, 1500); } if (skills.getDynamic(Skill.HITPOINTS) == 51 && !prayer .isActivated(PrayerButton.RAPID_HEAL) && sipAbsortption == 0) { status = "Drinking Overload potion..."; for (int i = 1; i < 5; i++) { if (inventory.contains("Overload (" + i + ")")) { inventory.interact("Drink", "Overload (" + i + ")"); break; } } sipAbsortption = random(1, 2); return random(1000, 1500); } if (sipAbsortption > 0 && !prayer.isActivated(PrayerButton.RAPID_HEAL)) { status = "Drinking Absorption potion..."; for (int i = 1; i < 5; i++) { if (inventory.contains("Absorption (" + i + ")")) { inventory.interact("Drink", "Absorption (" + i + ")"); break; } } sipAbsortption--; return random(1000, 1500); } if (prayer.isActivated(PrayerButton.RAPID_HEAL)) { status = "Flicking \"Rapid Heal\" off..."; prayer.set(PrayerButton.RAPID_HEAL, false); } else { status = "Flicking \"Rapid Heal\" on..."; prayer.set(PrayerButton.RAPID_HEAL, true); return random(50, 100); } return random(3000, 15_000); } @Override public void onPaint(Graphics2D g) { g.setColor(Color.WHITE); g.setFont(new Font("Myriad Pro", Font.BOLD, 16)); g.drawString("NmzFlicker [By Lare96]", 7, 225); g.setFont(new Font("Myriad Pro", Font.PLAIN, 14)); g.drawString("Time Running: " + LocalTime.ofSecondOfDay(watch.elapsed(TimeUnit.SECONDS)).toString(), 7, 245); g.drawString("Status: " + status, 7, 260); g.drawString("Attack XP: " + experienceTracker.getGainedXP(Skill.ATTACK) + " (" + experienceTracker .getGainedXPPerHour(Skill.ATTACK) + ")", 7, 275); g.drawString("Strength XP: " + experienceTracker.getGainedXP(Skill.STRENGTH) + " (" + experienceTracker .getGainedXPPerHour(Skill.STRENGTH) + ")", 7, 290); g.drawString("Defence XP: " + experienceTracker.getGainedXP(Skill.DEFENCE) + " (" + experienceTracker .getGainedXPPerHour(Skill.DEFENCE) + ")", 7, 305); } }
  2. im adding the JavaDocs so I can look at the documentation for certain types, fields, methods, etc. while I'm developing right, I'm aware that it's not needed but my initial point was that it's a pain in the ass. thanks anyway though
  3. ??? Anyone know why this is happening? Makes developing scripts a pain in the ass...
  4. You should probably use some sort of event-node state system as it's much more modular, manageable, and it just looks better. Not trying to be a dick or anything, but especially for new scripters that aren't familiar with Java it's better to show them the best way of doing things so they learn and get comfortable with it from early on.
  5. I just used a map with a forced key type of Enum<E> for O(1) get, put, and contains but this is really nice.
  6. Nice tutorial, but a few things. This private String ft(long duration) { String res = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS .toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS .toMinutes(duration)); if (days == 0) { res = (hours + ":" + minutes + ":" + seconds); } else { res = (days + ":" + hours + ":" + minutes + ":" + seconds); } return res; } Can just be this LocalTime.ofSecondOfDay(TimeUnit.MILLISECONDS.toSeconds(duration)).toString(); And for the experience gained part, can you not just use the experience tracker...?
  7. cool beans, thanks for this
  8. Next time you say you get an "error" you should include the exception stack trace as well so we can help you pinpoint the exact location and cause of the problem very quickly.
  9. /** * Returns an array of {@link org.osbot.rs07.api.map.Position} nodes that * are randomized within {@code radius}. The {@code path} will not be * modified, nor will it hold any references to the returned array. * * @param path * the path that will be randomized. * @param radius * the radius in which the path will be randomized. * @return the new randomized path. */ public static Position[] getRandomizedPath(Position[] path, int radius) { Position[] newPath = new Position[path.length]; int idx = 0; for (Position node : path) newPath[idx++] = node.translate(MethodProvider.random(radius), MethodProvider.random(radius)); return newPath; } /** * Returns an array of {@link org.osbot.rs07.api.map.Position} nodes that * are localized for the {@code node} point. This method is very useful for * when the script needs to cut out certain positions that aren't relevant; * for example, if the player starts a script when they are in the middle of * a path instead of the beginning or ending. Take for instance, this * pseudo-code. * * <pre> * Position[] path = { position1, position2, position3, position4, position5, position6, position7 }; * </pre> * * If {@code node} is closest to "position3" in distance, the returned array * will look like... * * <pre> * ... = { position3, position4, position5, position6, position7 }; * </pre> * * @param node * the node in which the path should be localized for. * @param path * the path that will be localized. * @return the new localized path. */ public static Position[] getLocalPath(Position node, Position[] path) { List<Position> newPath = new LinkedList<>(); int dist = -1; int index = -1; for (int i = 0; i < path.length; i++) { int newDist = node.distance(path[i]); if (dist == -1 || newDist < dist) { dist = newDist; index = i; } } IntStream.range(index, path.length).forEach(x -> newPath.add(path[x])); return newPath.toArray(new Position[newPath.size()]); } Could come in handy for scripts that utilize walking, everything is explained in the documentation.
  10. Write your own Java programs. I started with Runescape servers. You'll learn best through hands on experience.
  11. You do know Eclipse has support for Git repositories right?
  12. I agree, but you could always develop some sort of plugin system to add content to your script in a language that compiles into Java bytecode (JRuby, Scala, Xtend, Groovy, etc.)
×
×
  • Create New...