Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/05/15 in all areas

  1. Here I will be covering streams. Streams are great ways to essentially sort through lists. Why should we use streams? Since you can do just about anything with them in a single line of code. There are cases where streams probably aren't the most useful, take this: NPC guard = getNpcs().closest("Guard"); This is our bog standard way of grabbing the closest "Guard" npc. What it would actually be doing behind the scenes would be using a stream like so: public NPC closest(String name) { return getNpcs().getAll().stream().filter(npc -> (npc.exists() && npc.getName().equalsIgnoreCase(name))).min(new Comparator<NPC>() { @Override public int compare(NPC one, NPC two) { return Integer.compare(getMap().distance(one), getMap().distance(two)); } }).orElse(null); } Looks complicated, right? Here's what it would look like if it wasn't all one line: public NPC closest(String name) { Stream<NPC> unfilteredStream = getNpcs().getAll().stream(); Stream<NPC> filteredStream = unfilteredStream.filter(npc -> (npc.exists() && npc.getName().equalsIgnoreCase(name))); Optional<NPC> npc = filteredStream.min(new Comparator<NPC>() { @Override public int compare(NPC one, NPC two) { return Integer.compare(getMap().distance(one), getMap().distance(two)); } }); return npc.orElse(null); } Here's a breakdown of all the functions: (more on comparators in a bit) filter() -> This function will filter out our list for the specified properties that we're looking for in an NPC. In our case, we're looking for an NPC that exists and has a name of our variable "name". Every NPC that is in our region that doesn't suit our needs is discarded. min() -> This is a bit of a complicated function, but what it will do is find the NPC which returns the smallest compare() value. In this scenario, it will return the NPC which is closest to us. orElse() -> This is the same as an if (x) y; else z; statement, however basically what we are saying is if we could not find a suitable NPC, we can return the value inside orElse() (in this case, null). Now, this probably still looks like a bunch of wizardry to you. No worries, streams are scary at first, but after you know how to write them they're great! How to write a stream By now, you're probably itching to write a stream. In this example, we're going to find all the players within a 6 tile radius. To start off, we're going to have a function called getPlayersWithinSix(): public List<Player> getPlayersWithinSix() { return null; //We'll change this soon } Now we're going to begin the filter! To start off, we want to grab all the players, and put it in a Stream<Player>. This is what we will be filtering! public List<Player> getPlayersWithinSix() { Stream<Player> ourStream = getPlayers().getAll().stream(); return null; //We'll change this soon } Now that we have our stream, we can finally begin filtering! In this example, we only want to filter to see if the player is within 6 tiles of our own player. We're going to store the filter in another stream like so: public List<Player> getPlayersWithinSix() { Stream<Player> ourStream = getPlayers().getAll().stream(); Stream<Player> ourFilteredStream = ourStream.filter(player -> (player.exists() && getMap().distance(player) <= 6)); return null; //We'll change this soon } In our filter, we're checking these conditions: Does the player exist? Is the distance of the player within 6 tiles? Finally, we want to turn our Stream into a list so we can use it. We do this like so: public List<Player> getPlayersWithinSix() { Stream<Player> ourStream = getPlayers().getAll().stream(); Stream<Player> ourFilteredStream = ourStream.filter(player -> (player.exists() && getMap().distance(player) <= 6)); return ourFilteredStream.collect(Collectors.toList()); } See how we changed our return to ourFilteredStream.collect();? What that will do is put all of these players we found into a list, and return it. Now, this doesn't look like our streams from before, so to put it all in one line it would look like this: public List<Player> getPlayersWithinSix() { return getPlayers().getAll().stream().filter(player -> (player.exists() && getMap().distance(player) <= 6)).collect(Collectors.toList()); } Comparators, what do they do? A comparator is basically a way we compare two objects. Since the Comparator type is abstract (much like our Filter<T> class), we have to make our own compare() method. An example can be seen in our NPC closest function: new Comparator<NPC>() { @Override public int compare(NPC one, NPC two) { return Integer.compare(getMap().distance(one), getMap().distance(two)); } } What this Comparator does, in essence, is compare the distances of both NPCs (relative to the player). Since getMap().distance() returns an integer, we use Integer.compare to compare both of the distances. You'll most likely be using a Comparator to check for distance. More stream examples Here I'll be writing a few more stream examples to show why they're so useful. Find the furthest away NPC that has the name "Man": getNpcs().getAll().stream().filter(npc -> (npc.exists() && npc.getName().equalsIgnoreCase("man"))).max(new Comparator<NPC>() { @Override public int compare(NPC one, NPC two) { return Integer.compare(getMap().distance(one), getMap().distance(two)); } }).orElse(null); Get all the NPCs in a 10 tile radius that you can attack: getNpcs().getAll().stream().filter(npc -> (npc.exists() && npc.hasAction("Attack") && getMap().distance(npc) <= 10)).collect(Collectors.toList()); Get all the fishing spots where you can cage for lobsters: getNpcs().getAll().stream().filter(npc -> (npc.exists() && npc.hasAction("Cage") && npc.hasAction("Harpoon"))).collect(Collectors.toList()); If I missed anything, let me know
    4 points
  2. Who gives a shit if its botted or not? The only thing that matters is if its got any blackmarks on it. If not then its no different then any other account. I never understood why people freak out over handtrained>botted unless its power leveling or a service it shouldn't matter unless the account has a ban or blackmark.
    3 points
  3. import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.Player; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Jards", info = "A Script", name = "Goblin Killer", version = 0.01, logo = "") public class main extends Script { @Override public void onStart() { log("Welcome to gusegger's bot!"); } // all the states we can be in private enum State { IDLE, ATTACKING_GOBLIN, IN_COMBAT, AT_FIELD }; // if player is by the goblin field public boolean atField() { Player player = myPlayer(); int x = player.getPosition().getX(); int y = player.getPosition().getY(); //stating if we're in these positions if ((x > 3242) && (x < 3249) && (y > 3243) && (y < 3249)) { log("x : " + x + " y " + y); log("You're at the goblins son!"); return true; } log("x : " + x + " y : " + y); return false; } // seeing if we're in combat public boolean inCombat() { if(myPlayer().isUnderAttack()) { log("We're in combat!"); return true; } log("We're not in combat yet, punk!"); return false; } public void killingGoblin() { NPC Goblin = npcs.closest("Goblin"); if (Goblin != null && Goblin.getHealth() != 0 && Goblin.isAttackable() && Goblin.getName().contains("Goblin")) { if (map.canReach(Goblin)) { log("Attacking that punk ass goblin!"); Goblin.interact("Attack"); } } else { log("No goblins found!"); } } private State getstate() { // if we are at the field of goblins but not in combat // if we are at the field and in combat, set to in_combat if (atField() && !inCombat()) return State.ATTACKING_GOBLIN; // if we are under attack, set to in_combat if (myPlayer().isUnderAttack()) return State.IN_COMBAT; //if nothing is happening, set to idle return State.IDLE; } @Override public int onLoop() throws InterruptedException { switch (getstate()) { case IN_COMBAT: break; case ATTACKING_GOBLIN: log("Start killing a goblin!"); killingGoblin(); break; } return random(100,300); } @Override public void onExit() { log("Thanks for using gusegger's bot!"); } @Override public void onPaint(Graphics2D g) { //NYI } }
    3 points
  4. Version 1.4 - Script rewritten to work without the now removed clientside information - Dynamic signatures are now updated again - Added some handling for the new loot widget ______ Unfortunately it is no longer possible for the script to simply look up which brother is going to be in the tunnels; this means that I've also had to remove the option to "Always check the correct tomb last". I'll look into alternative ways of re-implementing this in the future
    3 points
  5. User has been IP banned, sorry for your losses.
    2 points
  6. Note: This user has a dispute being made against him, we are just waiting for mods to approve it.
    2 points
  7. You're not going crazy. If you have a wheel mouse, and scroll at all, it will change the zoom settings. Even a slight scroll of the wheel mouse will change the zoom. There isn't a bot here that I have seen that can work unless the zoom is exactly default.
    2 points
  8. Tired of crafting? Angry that there is no free crafting bot for the bs early levels? This shitty, but functional, script made in 7 minutes is the perfect solution. Directions: Make a tab with needles, threads, and hard leathers. Stand in front of a bank chest (I use castle wars bank chest) Start the script Level up Source: import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import java.util.concurrent.TimeUnit; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "Christ1665", info = "Hard Body Maker (use near a bank chest)", name = "Hard Bodies", version = 0, logo = "") public class main extends Script { @Override public void onStart() { } private enum State { BANK, SETTING_UP, WORKING } private State getState() { if (bank.isOpen()) { return State.BANK; } if (!players.inventory.contains("Hard Leather") || !players.inventory.contains("Needle") || !players.inventory.contains("Thread")) { return State.SETTING_UP; } if (players.inventory.contains("Hard Leather") || players.inventory.contains("Needle") || players.inventory.contains("Thread")) { return State.WORKING; } return null; } @Override public int onLoop() throws InterruptedException { switch(getState()) { case BANK: if (!players.getInventory().isEmpty()){ bank.depositAll(); } bank.withdraw("Hard leather", 26); bank.withdraw("Needle", 1); bank.withdraw("Thread", 12); bank.close(); break; case SETTING_UP: Entity bank = objects.closest("Bank Chest"); bank.interact("Use"); break; case WORKING: getInventory().getItem("Hard leather").interact("Use"); getInventory().getItem("Needle").interact("Use"); sleep(random(700, 950)); RS2Widget w = widgets.get(309, 2); if (w != null) w.interact("Make ALL"); sleep(random(20000, 28000)); } return random(500, 800); } @Override public void onExit() { } @Override public void onPaint(Graphics2D g) { } } Jar: http://www.mediafire.com/download/ko4uao5prg1w18d/Christ1665.jar Pic:
    1 point
  9. Where are the statistics that prove you will not get banned after 24 hours? This seems more like a rage thread, especially after coming across your price check thread.
    1 point
  10. Yeah, 10m should be minimum im thinking.
    1 point
  11. Awesome thanks mate 17 hours. damn. Also has been featured. Btw here's your progress: http://apascripts.x10host.com/rockcrab/littlewayne.png apa
    1 point
  12. Hello Czar, Is there any chance I could test the script over a 24hr period. I will post proggy and dependent on how it goes, I will most probably buy it
    1 point
  13. you consume it and it permanently lights up zamorak gwd on your account
    1 point
  14. I've placed the user in TWC and let them know of the dispute. Can you post a picture of his skype profile?
    1 point
  15. Keeps saying started random solver - mouse zooming solver? My error: Nvm Czar, it seems to have taken care of itself.
    1 point
  16. czar i need to tell you something. the hunter kits script makes somewhere between 500k-1.5m/hr the impling jar seem to be only worth around 200-250gp but they are actually worth atleast 1k ea. often they sell for 1.2k ea and sometimes even when demand is high, they sell for 2k ea. the only downfall is that sometimes the demand is low, and you need to wait a little bit to sell it. but thats not often though, more like a couple days, until the price rises again. i made over 50m rs07 gp with the script and would like to thank you for that. im quitting so im telling you know, you might already knew that it was good money/hr. it also got me from 94 to 99 magic. btw another good money making method that is basically the same, but harder because you need to buy high amounts, is humidify clay to soft clay its also like 500k-1.5m/hr. im quitting, i just sold my 50m rs07 gp for like €51 euro's... im going to sell my rs07 zerker 45 def 99 str 99 magic account too because im just fed up with this game, pking isnt worth it because i've done it too many times, aint got the energy to explore and try new things because they are basically all the same and boring. if anyone is interested in my account, shoot me a pm so i can send screenshots... other than that... thanks for your dedication to the script and i wish you all the best. you been an osbot legend to me. goodbye....! Jesus Christ
    1 point
  17. Try deleting the Goblin.getHealth() != 0. I'm not sure but I think you can only check their health if they are already in combat which is not the case.
    1 point
  18. thought this was some quality thread till i saw muffin posted it ;(
    1 point
  19. happy bday!!!! OMGGG!!!!!
    1 point
  20. i hate the internet sometimes
    1 point
  21. - Script name: AIO RuneCrafter (24h) - Your member number (hover over your name to see it): 66292 I will buy it 100% if i enjoy it. ill try it only for like a 6 hour log and then buy it. rc and slay most complicated scripts and if yours is good you deserve the moneh. EDIT: i don't know how to activate it. its not in my lib
    1 point
  22. inb4 'selling lvl 83 pure, 70 qp' threads influxin
    1 point
  23. You brother shouldn't mess with stuff he doesn't know. Imagine if someone had told him that deleting system 32 would make it faster..
    1 point
  24. THIS IS A BULLSHIT FUCKING STORY HE PROCEEDED TO TELL ME IT AND PULLED THAT SHIT TWICE. THEN - TRIED TO HELP ME SCAM OTHERS
    1 point
  25. old you just had to show the ironman symbol right? how do we know how someone is an ironman?? -they fucking tell you
    1 point
  26. As i re-sold the account and the person put some trust into me i wouldnt mind paying back half if thats fine with peoples. @Fruity
    1 point
  27. don't forget the 55 slayer for broad bolts
    1 point
  28. Someone changed the email's password and it wasn't me. Must have been you or your friend since password was the same as rs log in pass. I'm not refunding shit since I didn't recover your account.
    1 point
  29. Thank you very much! One of the capes I've always wanted, but never could afford. Uhm, probably around 30m, depending on potion prices and etc. I cleaned a lot of herbs, since the cost is way lower if you do that, though I got impatient towards the 90+ levels and started to buy unf pots. I'd recommend super attacks, pretty cheap-ish.. 4-5gp/xp. I made a whole lot of unfinished potions myself, since you can sometimes get 700k gp/hr when doing it. Play around with it.. Took me nearly a month to get it, even when I'm always at the PC when botting. Bot with caution!
    1 point
  30. Just to let everyone know: 99 herblore achieved with this script. Thank you, Czar!
    1 point
  31. Had 20m lure teleport out (no tber sadly) but just got a solid 10m lure
    1 point
  32. It's a bot bro, not a human. No. Why would you want that? XP/H and profit is much better at other courses, could probably add it if there's a good reason to Yeah, read the first post One-time payment, unlimited auths
    1 point
  33. Khaleesi was nice enough to make a thorough bug/suggestion report, so it's something I'll take a look at again. If you are familiar with shapes in Java, we are essentially looking at the worldtoscreen (3d to 2d) shape translation and then finding a point within that shape that is towards the center-mass. From there a PointDestination is generated, the mouse is moved through InteractionEvent, and the evaluation checks to see whether or not the our mouse has reached the target. There is a lot of behind the scenes stuff so when I get a free minute from working on other stuff (like zoom), I'll open this can of worms again.
    1 point
Γ—
Γ—
  • Create New...