Jump to content

liverare

Scripter II
  • Posts

    1296
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    0%

Everything posted by liverare

  1. It sort of depends on what you're communicating. If I had 10 bots all running on the same machine and I required them to communicate locally, then I'd do one of the following: In-game clan chat/direct messaging. This is the simplest method to implement which removes any other external dependencies (like hosting server). However, you risk exposing your entire bot network to JaGeX. Sockets and ports. This is by far the best method, because you can communicate on a local network and public network. However, I'm not sure OSBot enables this. External SQL servers. This is good if you have multiple networks that need a single place to communicate. However, you risk the server breaking and going offline, or being hacked. Flat-files per bot. Good if you need simple local communication only. However, race conditions (as @Alek mentioned) will be a problem. I'd probably go with flat files: Each bot would create a flat file. The bot that owns that file is the only bot permitted to write to said file. The bot has read-only permissions for the other bot's files. The bot would write communications in JSON format: [ { "when":3424310251234, "to":"someRandomUsername2", "from":"someRandomUsername1", "what":"Hi!" }, { "when":3424310276666, "to":"someRandomUsername2", "from":"someRandomUsername1", "what":"Awesome!" } ] Implement a file system listener to check for newly created/updated files, then require all (except the bot that created/updated the file) to read it.
  2. return !tree.exists() || myPlayer().isAnimating(); "tree doesn't exist OR we are not animating" Keyword: "OR" If the tree exists, then we check whether we're chopping it. If we're not chopping it, aka. "animating", then we should probably 'wake up' and get back to chopping it.
  3. https://osbot.org/forum/topic/130001-appearance-api/
  4. That's quite possibly the best and most neatest onLoop I've ever seen.
  5. Find items. Grab prices for items. Cache them. Calculate whether item is worth taking. Take item.
  6. public boolean canReach(Position from, Position to) { return !(new LocalPathFinder(bot).findPath(from,to).isEmpty()); } https://osbot.org/api/org/osbot/rs07/api/util/LocalPathFinder.html
  7. Won't you gain HP experience while your pking anyways? If so, then why'd you train with cannon?
  8. Resources works for the SDN, but not for local scripts. To get around this, you'll need two separate pieces of interchangeable code. When you're ready to publish your script, make sure to have the script load assets from the resource folder. Otherwise, have the script load the resource from the data folder. For example: /** * Attempt to load sprites from resource folder. * * @param dir * - (e.g. "/resources/sprites/record-blue.png") * @return new {@link ImageIcon} instance */ private static ImageIcon loadImageFromResource(String dir) { ImageIcon imageIcon = null; try { imageIcon = new ImageIcon(ImageIO.read(MacroRecorder.class.getResourceAsStream(dir))); } catch (IOException e) { //Attempt to print to GLOBAL_LOGGER Logger.GLOBAL_LOGGER.error(e); } return imageIcon; } /*private static ImageIcon loadImageFromResource(String dir) { ImageIcon imageIcon = null; try { imageIcon = new ImageIcon( ImageIO.read(new File(String.format("%s/OSBot/Data/%s", System.getProperty("user.home"), dir)))); } catch (IOException e) { Logger.GLOBAL_LOGGER.error(e); } return imageIcon; }*/
  9. Greece invented democracy. Democracy is majority rule. No Western country is ruled under the strict definition of a Democracy. There are sometimes a call for democratic votes, for such as Brexit, and even that Russian poll. By-enlarge, banks are companies. Companies are amoral. They only care about making a profit. With that, companies aren't imperialistic; they swear no loyalty or allegiance to any plot of land, as they'll move to whichever country will accommodate them and is more profitable. If a country turns hostile and that hostility affects the company's profits, they move. Companies do purchase favours from politicians, but that's not a failure in democracy; that's a failure of the politician who can be brought and sold. They're people, and people are inherently flawed, and most importantly of all, bureaucratic people are wholly useless. Companies are hardly to blame either, because companies cutting each other's throats at every turn and are simply playing the game and surviving by any means necessary. Most good politicians died 100's of years ago when they founded America. There are perhaps fewer politicians than I have finger that actually serve their constituents in a faithful manner. The rest are simply surviving; buying votes, betraying voters, and selling favour. There are flaws in a constitutional republic, namely that politicians can be brought and sold. However, the United States of America has survived longer as a freer nation than most (if not all) countries on Planet Earth. Also, Russia is under Putin's dictatorship. You can't convince me an ex-KGB member doesn't rig the election.
  10. It's no longer possible to read the current growth states of crops from farming patches. It used to be; the most notable example was RSBuddy. However, Jagex felt the feature was an exploit, and the farming necklace had already existed for the purpose of tracking your farming patches. Jagex patched this. There may be a farming patch for a quest that might still work, but it's unlikely. I had worked on a farming tracker for OSBot v1 before the patch. It tracked all the herbs, and I was working to include every single farming patch in the game. :edit: I harvested toadflax from the Ardougne herb and, you're right, configuration #529 responded with the following values: 0x27030303 0x03030303 0x2c030303 0x2b030303 The values that changes are 0xFF000000 (where the "F" is, the numbers changes). To extract it, you could do: public int extractValueFromArdougneHerbPatch() { int c = configs.get(529); c >>>= 24; c &= 0xFF; return c; }
  11. Thread: The content and links have been removed. However, I managed to get the links from a cached web-text version of that page on Google: http://webcache.googleusercontent.com/search?q=cache:-ajScYCXVaIJ:https://www.reddit.com/r/2007scape/comments/87hmhb/selling_07_accs_for_steam_cashcsgo_skins/&num=1&hl=en&gl=uk&strip=1&vwsrc=0 The links are as follows: https://imgur.com/a/3Ihs3 https://imgur.com/a/NuQPL Despite there not being any usernames on display, Mod Weath was still able to ban these accounts. We can infer the following: Accounts can be found by bank items. Accounts can be found by by quest statuses. Accounts can be found by by skill levels. To be honest, I'm not at all surprised. They have the data, after all. However, this should serve as a cautionary tale for when you decide to advertise your accounts. Make sure to omit more stuff from your screenshots, namely more skills, incomplete/not started/irrelevant quests, collapse your bank contents and put the things you want to display in one tab and screenshot that (and omit amounts), etc. gl :edit: After reading the thread that sparked my interest: I came across this: I will chose to believe this is truthful damage control. They perhaps found the accounts using the quests/items/levels, then investigated them further to see whether those accounts were linked to the same owner. I don't know if Jagex can get IP addresses of Reddit users, but I don't use Reddit, so I don't know what more Mod Wreath could have pulled from the original post.
  12. Thank you - I will look into this shortly.
  13. It's the paint. You can create 100+ tiny mouse movements a second, and each movement is rendered as a small square. Yeah...wouldn't advise you to show the paint if you're going to be recording for a very long time. Don't render the recorded path.
  14. Save the source code in a new file called "AmountAPI.java", and put it where your script file is. Then, follow the example code.
  15. There's no point looping through an array if you still intent to reference elements from the array manually. Now that you're requiring to know more than just the pickaxe name, you need to look into different data structures that'll help you achieve what you're looking for. @Apaec solution is a good starting point. However, his enumerator is a little overly complicated for someone of your learning level (especially the Lambda stuff), so I've simplified it a bit: /* * Pickaxe.java */ public enum Pickaxe { BRONZE("Bronze pickaxe", 1, 1), IRON("Iron pickaxe", 1, 1), DRAGON("Dragon pickaxe", 61, 60); private final String name; private final int miningLevel; private final int attackLevel; private Pickaxe(String name, int miningLevel, int attackLevel) { this.name = name; this.miningLevel = miningLevel; this.attackLevel = attackLevel; } @Override public boolean toString() { return name; } public int getMiningLevel() { return miningLevel; } public int getAttackLevel() { return attackLevel; } } Now you can iterate through this enumerator using its values method: for (Pickaxe pickaxe : Pickaxe.values()) { String pickaxeName = pickaxe.toString(); int pickaxeMiningLevel = pickaxe.getMiningLevel(); int pickaxeAttackLevel = pickaxe.getAttackLevel(); /* TODO - checks n stuff */ } What you'll find is that you can treat the enumerators similarly to how you were treating the array. Except now, you have more than just the names to work with. See if you can replace your array of pickaxe names with an enumerator.
  16. public boolean depositWornItems() throws InterruptedException { RS2Widget deposit = script.getWidgets().get(BANK_PARENT, BANK_CHILD_DEPOSIT_BUTTON); ConditionalSleep conditionalSleep = new ConditionalSleep(5000, 500) { @Override public boolean condition() { return script.getEquipment().isEmpty(); } }; return deposit != null // Is widget valid? && deposit.isVisible() // Is widget visible? && deposit.interact("Deposit inventory") // Did we click it? && conditionalSleep.sleep(); // Have we deposited everything within 5 seconds? } Don't take my solution as correct, because there are many ways to do the same thing. However, what I like about the changes I've made include: Variables neatly defined. Sleep condition is an abstract class, which means you have to greedily use up multiple lines of code. Doing that and storing the object as a variable just makes things a little easier to read, than having mid-sections of code full of instantiated abstract classes. The return statement is structured so that everything, from the widget being valid, visible, and clicked, have to be true before we even get to testing whether or not we've successfully deposited our items within 5 seconds. ConditionalSleep#sleep function returns true if the items have been deposited prior to the time having been elapsed. This is particularly useful in laggy situations. The only thing I dislike is that I've instantiated an object that may not even be used. What I'd normally do is create a separate class to handle the implementation of the conditional sleep, then I'd instantiate a new object from that class: public boolean depositWornItems() throws InterruptedException { RS2Widget deposit = script.getWidgets().get(BANK_PARENT, BANK_CHILD_DEPOSIT_BUTTON); return deposit != null // Is widget valid? && deposit.isVisible() // Is widget visible? && deposit.interact("Deposit inventory") // Did we click it? && new SleepUntilDepositedItems().sleep(); // Have we deposited everything within 5 seconds? } private static class SleepUntilDepositedItems extends ConditionalSleep { public SleepUntilDepositedItems() { super(5000, 500); } @Override public boolean condition() { return script.getEquipment().isEmpty(); } } It's all just preference, though.
  17. If you're exporting jar files of your scripts to test, then read this: The closest function uses Pythagoras algorithm. There are alternative functions to find the closest entity using real distance. The real distance is calculated by how many tiles you would need to traverse before reaching the entity. I'm not at all familiar with the web walking API. However, I'd do something similar to promises in JavaScript. This should allow you to do asynchronous/concurrent actions after having clicked somewhere to walk. However, those actions would need to be interrupted if there's not enough time to complete them. This would lead to problems, such as, the bot failing to walk to the next tile because an item is selected. There'd need to be something like: WebWalker#walk#resolve(TRY_FLETCH)#reject(UNSELECT_ITEM)
  18. I've made some changes that will hopefully solve the problem. Please wait for version 1.5. If the problem persists with a new save, you'll need to send me your macro file. It updates the configuration rules. I'll perhaps rename it in the future.
  19. I've made some significant changes (as you can see), so I'm not sure how long before it'll be on the SDN.
  20. I just realised what's causing this problem. The time between the very first and very last actions are subtracted and used to as the amount of time to wait. lol. I'll fix this shortly. Sure. I'll see what I can do.
  21. I was on the toilet. That's where I get my best ideas.
  22. The macro is continuously looped through and you can save/load your macros.
×
×
  • Create New...