Jump to content

agentcallooh

Lifetime Sponsor
  • Posts

    13
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    0%

agentcallooh last won the day on November 28 2019

agentcallooh had the most liked content!

About agentcallooh

Profile Information

  • Gender
    Male
  • Interests
    Code

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

agentcallooh's Achievements

Newbie

Newbie (1/10)

16

Reputation

  1. Awesome! I assume this sort-of works similar to how nointerface mode will auto-exit if there's an issue (like login failure etc)? Aside... I have a few complaints about the logger in the new UI. Is it possible to pop it out (un-dock) it from the main window? A button to copy-paste the contents to clipboard would also help. Thanks Pat!
  2. The new UI looks real sleek, I like the RuneLite-inspired direction. Love that the logger has a button toggle, but I really dislike how there's no option to un-dock it from the window. Being able to move that shit around and resize it in a separate window is crucial for my workflow in debugging scripts. I also got this error while the client was injecting (right after selecting the account). [INFO][10/25 04:39:42 PM]: Welcome to OSBot 2.6.0! [INFO][10/25 04:39:42 PM]: Loaded 1 RS accounts! [INFO][10/25 04:40:44 PM]: Updated injection hooks for client revision : 192! [DEBUG][Bot #1][10/25 04:40:44 PM]: Initializing stealth injection bot... [INFO][Bot #1][10/25 04:40:44 PM]: Downloading latest RS2 old-school client parameters... [INFO][Bot #1][10/25 04:40:44 PM]: Downloading latest RS2 old-school client... [DEBUG][Bot #1][10/25 04:40:48 PM]: Injected bot reference into client! [DEBUG][Bot #1][10/25 04:40:49 PM]: Injected world accessors! [DEBUG][Bot #1][10/25 04:40:50 PM]: Injected 38 class and 339 field accessors! [DEBUG][Bot #1][10/25 04:40:50 PM]: Injected canvas! [ERROR][10/25 04:41:00 PM]: Uncaught exception! java.lang.NoClassDefFoundError: org/osbot/core/security/OSBotSecurityManager at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) at java.lang.Class.getConstructor0(Class.java:3075) at java.lang.Class.newInstance(Class.java:412) at org.osbot.rs07.Bot.initialize(eh:418) at org.osbot.FC.iiIIIiiIIIii(sw:104) at org.osbot.FC.iiIIIiiIIIii(sw:282) at org.osbot.lpt7.iiIIIiiIIIii(qab:587) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: org.osbot.core.security.OSBotSecurityManager at java.lang.ClassLoader.findClass(ClassLoader.java:523) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at org.osbot.We.loadClass(py:213) ... 11 more Nice update, I'll be playing around with it some more.
  3. I'm releasing a useful bash script of mine, update-osbot.sh to the OSBot community! This script makes updating OSBot something you never have to worry about. Features Downloads the latest jar from https://osbot.org/mvc/get Update a specific OSBot jar file, or default to ~/OSBot/osbot.jar which is created automatically. Backs up old versions of OSBot to ~/OSBot/osbot.jar-backups/, just in case. No-clutter logging makes it easy to stay up to date Usage It really couldn't be simpler. Just invoke it using bash before you run scripts via CLI! $ bash update-osbot.sh $ bash update-osbot.sh path/to/osbot.jar Protip: You can also set the executable permission using chmod lets you run it directly: $ chmod +x update-osbot.sh $ ./update-osbot.sh Portability Works on most Linux distributions, like Ubuntu, right out of the box! (Uses curl or wget) Works on Windows if you have a bash interpreter, such as Git BASH included in gitforwindows. Download update-osbot.sh from the GitHub repository Tip: Right-click, Save link as... will save it directly. Using a Linux VPS? Use wget to download it: wget https://raw.githubusercontent.com/OzzyCallooh/update-osbot.sh/master/update-osbot.sh -O update-osbot.sh Enjoy guys, let me know if this was useful in your botting workflow
  4. You should separate out the is-open and is-not-open logic so that when onLoop runs again your script can take appropriate action. if (depobox.isOpen()) { depobox.depositAllExcept("Bronze pickaxe"); } else { depobox.interact("Deposit"); }
  5. If I'm understanding you right, the EventExecutor will call the parent's execute AND also the child events execute one after the other? I'm not sure I really understand it. Or does the parent have to fail/finish BEFORE the first child begins executing? So for setFailed/setFinished, these don't transfer parent<->child nor affect execution of individual events? (Obviously once something fails/finishes it stops being executed)
  6. Question about Events, particularly Event.addChild: what is the use and significance, if any, of event children? How does the EventExecutor run child events? How do setFailed/setFinished calls affect this behavior? (I am familiar with the execution flow of Events with the EventExecutor, and generally how custom and built-in events work on OSBot.) Any help on this would be much appreciated. The docs are completely empty and nobody seems to know anything about this
  7. Update, been playing with this a bit more. Still working on a protocol, but in working with it I did find at least one issue. Should the server close immediately or not gracefully, this error will be repeatedly thrown from Client.onMessage as it is called regularly by the ScheduledExecutorService. I found a somewhat-OK fix through a StackOverflow answer. I pulled out the ByteBuffer operations and did a test of the exception message, which is quite messy but works. private void onMessage() { ByteBuffer inputBuffer = ByteBuffer.allocate(256); try { client.read(inputBuffer); } catch (IOException e) { // If the server was closed, the IOException will hint at this. // https://stackoverflow.com/questions/5638231 if (e.getMessage().contains("An existing connection was forcibly closed by the remote host")) { System.out.println("Server closed, stopping."); close(); return; } e.printStackTrace(); } consumer.accept(new String(inputBuffer.array()).trim()); }
  8. This is actually a really nice release, I'll try and make a muling protocol over Thanksgiving break.
  9. Hey all, this tutorial will teach you how to enable push notifications in your script using the Telegram platform. What is Telegram? Telegram (Wikipedia) is a massively popular, fast, secure and private messenger with 200 million monthly active users (as of March 2018). It provides a straightforward yet powerful chat bot API that rivals Discord and WhatsApp. (I'd argue it's way better than both -wink-) Oh, and it's free. Step 1: Telegram Client and Account Obviously, you'll need a Telegram to account to use it. Sign up for Telegram using your phone number (you cannot use email/password) via the Telegram Web client, or via the Android/iOS app (use the links on telegram.org). This should be a no-brainer. Concerned about privacy, or don't want to give out your actual phone number? That's good - you can use a Google Voice phone number instead of your own. They never call, text or sell your phone number - except once to verify ownership of the number. Other alternatives include freephonenum.com, but beware: if you lose a disposable number and get logged out it's game over. Here's a guide from TechJunkie on Telegram privacy and recommended settings you should use. Step 2: Getting a Telegram Bot Token and Your Chat ID The first thing you'll require is a Telegram chat bot. Every bot a single bot token used to control it. Start a conversation with the BotFather (@BotFather), who will guide you through the creation of your bot and provide you its token. First, type /start, then /newbot. The BotFather should guide you through the rest of the process of choosing a name and username. He'll end with providing the bot token. Optional: You can choose to upload a profile picture for your bot, or set the about text and description. Once you have this, you're ready to continue! Your bot token should look something like this: 1020719143:AAFy_Qq45y5bLmsZllUrsZ5yLkCvY6obNkk (FYI, this and all other tokens in this post have already been revoked, so they will not work) --> Open a chat with your bot the same way you did with BotFather - enter its username in the search bar. Type or tap /start to send your first message to your bot - don't miss this step! Nothing happens because there's no software listening on the other end. That's OK, we won't need any in order to send a message! --> Next, we're going to retrieve the chat ID between your Telegram account and the bot. By sending /start to your bot, you queue an update that contains the chat ID. To fetch this update, we'll use the getUpdates method of the bot API. Use your browser to visit the following URL and replace TOKEN with the entire bot token: The URL: https://api.telegram.org/botTOKEN/getUpdates Example: https://api.telegram.org/bot1020719143:AAGXuLpgav-feIwrQbJKYWGpwPXekeEcW0E/getUpdates The result should be a JSON object with an array of updates. One update should describe your /start message - and the chat it came from. I've highlighted mine below: 91741518. (Since this is a one-on-one chat between me and my bot, it's the same as my Telegram user ID. This similarity isn't guaranteed, though!) Don't see any updates? That means you need to send a message to your bot to produce one - see above. Once you have your Telegram bot token and the chat ID between you and your bot, continue on! Step 3: Sending a Message When you send a message on Telegram, you send it to a chat (not a user). The chat ID you got in the previous section is for a one-on-one chat between you and your bot. So how do we send a message to this chat? Good news: It's as easy as sending an HTTP request! (Baeldung has an OK-ish article on this topic) To keep the Java code simple, we send a POST to the sendMessage endpoint. Don't worry - I built a small Java class for you to use in your projects. No extra work necessary! Here it is: TelegramBot.java Below is an example script showing how to use the TelegramBot class. Be sure to open OSBot's Data directory (C:\Users\YOU\OSBot\Data or ~\OSBot\Data) and add two files - TelegramBotToken.txt and TelegramChatId.txt. Put your values from the previous section in these files. You could also paste your token and chat ID directly into your code, but this is highly discouraged. TelegramExample.java Run the script using OSBot. You should see... DING! A notification, and the message that triggered it in your Telegram client: --> Attention: NEVER put your bot token within your source code! EVER! This is a big security risk! Instead, you should load config info like this from a file located within OSBot's data directory (getDirectoryData). You can learn more at this other tutorial I wrote. The example bot script gives you a nice easy way of doing this - please use this. Bonus: Using a Telegram Channel or Group Chat If you're collaborating and would like your bot to post to a place where its messages are visible to more than just you, you can use the chat ID of a group chat or channel instead of a one-on-one conversation with the bot. In order to do this, first create a channel or group chat. Then add your bot to it via its username (Note: Make sure to add the bot as an admin if using a group chat) --> --> Using the same process as before: send a message to your group/channel. Then load /getUpdates and find the new "channel_post" or group chat message, then "chat": {"id": ... }. You might see the message from before (ignore it). This is the chat ID you want to use! Coming Soon: Uploading Screenshots If there is interest, I'll write about uploading OSBot screenshots to Telegram to view anywhere. This is more involved, so I'll only do it if there's significant interest! Conclusion Telegram is a great platform to use for messaging, even for automated scripts like OSBot's. If a bot gets a rare drop, gets PK'd or otherwise needs to get a hold of a human, this is a fantastic way to do it. Thanks for reading my guide!!
  10. If you've messed with OSBot's CLI, perhaps in creating a bot farm, you've probably messed with the -script CLI argument and using Script.getParameters() in your code. Or maybe you're just looking into automating your OSBot scripts; this guide will show you everything you need to know What are Script Parameters? Parameters are a single String sent to your script via the command line (shell) using the -script CLI argument. It is accessed using Script.getParameters, which may return null if no parameters were provided. You'll need to learn a little bit of String manipulation in Java in order to work with them effectively. Here's some basics to get you started: // To get multiple delimited parameters, use split: // (Warning: you cannot use the comma or pipe character!) String[] params = getParameters().split(";"); // To parse an integer or float from a String, use: int itemsToUse = Integer.parseInt(params[0]); float ratio = Float.parseFloat(params[1]); // Test string equality - use .equals() not == if (params[2].equals("foobar")) log("Foobar mode enabled"); Requirements In order to use -script you must: Provide your OSBot forum credentials via -login Specify an account to log in with via -bot. If your script logs in manually (i.e. you use -allow norandoms and/or disable the auto login random solver then implement your own login handler like Explv's LoginEvent) then you should provide dummy credentials here eg. -bot LOGIN:PASS:0000 Restrictions You cannot use a comma (,) or pipe (|) character within a script name or parameter at all. Doing so may cause various runtime errors like java.lang.NumberFormatException or java.lang.NullPointerException. Most shells have a length limit for commands. See the section below. Escaping Spaces, Double Quotes and Backslashes (with Example) If you are using either spaces ( ), double quotes (") or backslashes in your script name or parameters, you'll need to escape these, potentially twice: once for OSBot, and once for your shell. I'll give an example below for the a script named My "Test" Script with parameters My "Test" Parameters. The example content will be in blue and inserted content will be green. If your script name contains either spaces ( ), double quotes (") or backslashes (\): Insert a backslash (\) before all existing double quotes or backslashes. My \"Test\" Script Surround the whole thing with double quotes that are not escaped with a backslash. "My \"Test\" Script" Do the process above (1) for your script parameters if they contain spaces, double quotes, backslashes: "My \"Test\" Parameters" Combine the script name and parameters with a colon in the middle. "My \"Test\" Script":"My \"Test\" Parameters" This is the raw string to be passed via the command line. If you are using a shell utility or sub-process library that takes an array/list of CLI args, stop here! Such a utility or library should do the next escaping step for you. If you are writing your own .bat/.sh scripts manually, continue on. Before every double quote (") or backslash (\), insert another backslash. \"My \\\"Test\\\" Script\":\"My \\\"Test\\\" Parameters\" Surround the entire thing with double quotes again. "\"My \\\"Test\\\" Script\":\"My \\\"Test\\\" Parameters\"" You're done! Yes, it's ugly, but it should work! Put the result directly after -script in your shell and you're good to go. Here's a combined example: java -jar OSBot.jar -login username:password -bot login:password:bankpin -script "\"My \\\"Test\\\" Script\":\"My \\\"Test\\\" Parameters\"" Once again, this runs a script with the following ScriptManifest name My "Test" Script: @ScriptManifest(name = "My \"Test\" Script", ...) public class MyTestScript extends Script { // .. } Using Files Instead of Script Parameters Sometimes shells can have surprisingly low limits on command length. If you expect your script input to be long (such as JSON, CSV or XML), you should be loading these from file instead instead of stuffing them in script parameters! These data formats may also contain incompatible characters (comma and pipe). Here's a few short examples to get you started (this isn't a guide on reading text from files in Java...) String filePath = getDirectoryData() + File.separator + getParameters(); File fp = new File(filePath); BufferedReader in = new BufferedReader(new FileReader(fp)); String line; while ((line = in.readLine()) != null) { // Process one line of input. } in.close(); If you want the entire file contents read into a string, you can use Files.readAllBytes and Paths.get: String filePath = getDirectoryData() + File.separator + getParameters(); String fileContent = new String(Files.readAllBytes(Paths.get(filePath))); Finally, using files has an added benefit of being able to provide default input data when script parameters aren't available (ie. the script was run via the Script Selector window): String filePath = getDirectoryData() + File.separator + (getParameters() != null ? getParameters() : "myDefaultInput.txt")); // Use the filePath as above And as usual, catch FileNotFound and other IOExceptions as necessary. Using files is a much better way to load in data than a lengthy script parameter! Additional Tips If you're having trouble escaping things properly, perhaps it's better to question if including the escaped content is even necessary at all. In other words, if it's easier to not name scripts using spaces, quotes or backslashes, then do that instead of escaping. Simplicity is better than being smart. For a good user experience, provide sensible defaults if parameters aren't provided. If your script requires input and can't come up with defaults, try using the Java Swing framework to show a UI (see Explv's AIO if you need an example). DON'T USE COMMAS (,) OR PIPE CHARACTERS (|) AS DELIMITERS. They aren't allowed and will break OSBot! If you need to delimit a parameter string, try a healthy low-carb alternative of a semicolon.
  11. Hey, thanks for implementing my suggestion! ❤
  12. Update to this: I reached out to the developer explaining my situation. In a nutshell, this data should not have to be loaded in any other way other than through the boot UI. In other words, the "-You must update Web Walking through the Boot UI." message shouldn't be showing up when you launch with --allow nointerface through the CLI. For now, I'll have to stick with manually grabbing map.zip/map.bin from a manually opened version.
  13. Hi there, first post here I understand that the first time OSBot runs, it needs to download webwalking data before launching the OSBot client. I've noticed it places this data into map.zip under the Data directory, then unzips it into map.bin. My question is: from where does map.zip come from? I'd like to load+unzip it using a shell script. Is it packed in a JAR or downloaded, and if it is downloaded from what URL? Or is it something else? Thanks!
×
×
  • Create New...