Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

liverare

Java Lifetime Sponsor
  • Joined

  • Last visited

Everything posted by liverare

  1. I suppose that would be a fine substitute. But I'd still want the Item class to store the item's slot index and have interaction method.
  2. Yeah, inefficient too. I hate the idea of needing to iterate twice to validate and interact, but there seems to be no other way because Item and ItemDefinition hold neither the index of the item or any methods that return the widget child the item belongs to. And that's why I like how I structured my shop api.
  3. True. But still, goodluck with your script!
  4. I am opposed to premium scripts that incorporate my shop API. Why wouldn't I be when I stand to gain nothing? GL with yours
  5. Sure, but first you'd have to remove the whole onExit code block to prevent the exiting of the script to remove the listeners and prevent the disposal of the GUI. @Override public void onExit() throws InterruptedException { EventQueue.invokeLater(new Runnable() { @Override public void run() { view.dispose(); if (bc != null) { bc.removeMouseWheelListener(Main.this); bc.removeKeyListener(Main.this); } } }); } EDIT: However I'd advise against it. If the cooking script uses the keyboard, there might be keyboard input conflict.
  6. Looky what I found - forgot about this script! import java.awt.EventQueue; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.osbot.engine.Bot; import org.osbot.engine.canvas.BotCanvas; import org.osbot.script.MethodProvider; import org.osbot.script.Script; import org.osbot.script.ScriptManifest; @ScriptManifest(name = "Keyboard Macro", info = "Allows for easy keyboard entry.", version = 1.0, author = "LiveRare") public class Main extends Script implements MouseWheelListener, KeyListener { public static final String[] DEFAULT_TEXT = { "Hi, I'm a placeholder example text!", "Yo dude, same here!"}; View view; boolean typing; BotCanvas bc; private volatile String curString; private final Runnable runSentence = new Runnable() { @Override public void run() { try { for (char next : curString.toCharArray()) typeChar(next); } catch (InterruptedException e) { e.printStackTrace(); } } }; @Override public void onStart() { EventQueue.invokeLater(new Runnable() { @Override public void run() { view = new View() { private static final long serialVersionUID = 1L; @Override public void submitRequest(final String text) { Main.this.typeText(text); } }; view.addText(DEFAULT_TEXT); } }); useDefaultPaint(false); bc = getBotCanvas(); if (bc != null) { bc.addMouseWheelListener(this); bc.addKeyListener(this); } } @Override public void onExit() throws InterruptedException { EventQueue.invokeLater(new Runnable() { @Override public void run() { view.dispose(); if (bc != null) { bc.removeMouseWheelListener(Main.this); bc.removeKeyListener(Main.this); } } }); } @Override public void mouseWheelMoved(final MouseWheelEvent e) { EventQueue.invokeLater(new Runnable() { @Override public void run() { switch(e.getWheelRotation()) { case -1: // up if (view != null) view.moveSelectionUp(); break; case 1: // down if (view != null) view.moveSelectionDown(); break; } } }); } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { switch (e.getKeyChar()) { case KeyEvent.VK_TAB: if (view != null) view.forceSubmit(); break; } } public void typeText(String text) { curString = text + "\n\n\n"; new Thread(runSentence).start(); } public synchronized void typeChar(char c) throws InterruptedException { try { bot.getKeyboard().typeKeyEvent(c, KeyEvent.KEY_TYPED); } finally { Thread.sleep(MethodProvider.random(10, 30)); } } public synchronized void typeSpecialChar(int charCode) { try { Thread.sleep(50); bot.getKeyboard().typeKeyEvent((char)charCode, KeyEvent.KEY_PRESSED); Thread.sleep(50); bot.getKeyboard().typeKeyEvent((char)charCode, KeyEvent.KEY_RELEASED); } catch (InterruptedException e) { e.printStackTrace(); } } public BotCanvas getBotCanvas() { try { for (Method next : Bot.class.getMethods()) { next.setAccessible(true); if (next.getReturnType().equals(BotCanvas.class)) return (BotCanvas) next.invoke(client.getBot()); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); } return null; } } Main.java import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.Box; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.ListSelectionModel; public abstract class View extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private DefaultListModel<String> model; private JList<String> lstText; private JButton btnAdd, btnRemove, btnSubmit; private JToolBar tlbButtonBar; private Object lock = new Object(); public View() { initComponents(); } public abstract void submitRequest(String text); @Override public void actionPerformed(ActionEvent e) { final String command = e.getActionCommand(); if (command == null || command.isEmpty()) return; final String selectedText = lstText.getSelectedValue(); switch (command) { case "ADD": final String input = JOptionPane.showInputDialog(this, "Enter in text to add"); if (input != null && !input.isEmpty() && !model.contains(input)) model.addElement(input); else JOptionPane.showMessageDialog(this, "No valid text selected!"); break; case "REMOVE": if (selectedText != null && !selectedText.isEmpty()) model.removeElement(selectedText); else JOptionPane.showMessageDialog(this, "Select the text to remove!"); break; case "SUBMIT": if (selectedText != null && !selectedText.isEmpty()) submitRequest(selectedText); else JOptionPane.showMessageDialog(this, "Select the text to enter!"); break; } } public void initComponents() { { // Components { // List model = new DefaultListModel<>(); lstText = new JList<>(model); lstText.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } { // Buttons btnAdd = new JButton("Add text"); btnRemove = new JButton("Remove text"); btnSubmit = new JButton("Submit text"); btnAdd.setActionCommand("ADD"); btnRemove.setActionCommand("REMOVE"); btnSubmit.setActionCommand("SUBMIT"); btnAdd.addActionListener(this); btnRemove.addActionListener(this); btnSubmit.addActionListener(this); } { // Tool bar tlbButtonBar = new JToolBar(); tlbButtonBar.setFloatable(false); tlbButtonBar.setRollover(true); tlbButtonBar.add(btnAdd); tlbButtonBar.add(btnRemove); tlbButtonBar.add(Box.createGlue()); tlbButtonBar.add(btnSubmit); } } { // This setSize(450, 335); setLayout(new BorderLayout()); setTitle("Easy Keyboard Input"); setAlwaysOnTop(true); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setLocationRelativeTo(getOwner()); setVisible(true); } { // This (ADD) add(new JScrollPane(lstText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); add(tlbButtonBar, BorderLayout.SOUTH); } } public boolean addText(String... arg0) { if (arg0 != null && arg0.length > 0) { for (String next : arg0) if (next != null && !next.isEmpty() && !model.contains(next)) model.addElement(next); return true; } return false; } public void moveSelectionUp() { synchronized (lock) { int curSelect = lstText.getSelectedIndex(); lstText.setSelectedIndex(curSelect <= 0 ? model.getSize() - 1 : curSelect - 1); } } public void moveSelectionDown() { synchronized (lock) { int curSelect = lstText.getSelectedIndex(), max = model.getSize(); lstText.setSelectedIndex(curSelect >= max - 1 ? 0 : curSelect + 1); } } public void forceSubmit() { EventQueue.invokeLater(new Runnable() { @Override public void run() { View.this.actionPerformed(new ActionEvent(btnSubmit, 0, btnSubmit.getActionCommand())); } }); } } View.java Dropbox download! Just an old script I made to spam my forum thread on RuneScape. And no I won't link you to it! St00f: TAB submits text to type in game. Use mouse wheel to navigate the texts in the list. (Can do this while focused on the bot client.) Add text, remove text, and submit text - all buttons on the GUI Have fun! [Posted this in snippets on purpose. Mods, feel free to add script to SDN - I don't really care.] FORGOT TO MENTION: The built in #sendText method was really fucking slow, so I made mah own!
  7. liverare replied to liverare's topic in Snippets
    Cool. I was thinking about making a generalised wrapper for any/all interfaces containing clickable item widgets. (bank, inventory, shops, duel arena [ty for reminder], etc.) It would be nice to keep my structural design.
  8. liverare replied to liverare's topic in Snippets
    Stacking interfaces, wut?
  9. liverare replied to liverare's topic in Snippets
    BBBAAACCCKKK May get back around to updating this API. And also, if you've used this API for your scripts - especially premium scripts - credits + phree script pl0x.
  10. Check your PMs, I sent you a message a few days ago.
  11. liverare replied to liverare's topic in Snippets
    I've edited the code to include the ability to sell items. But I don't like it. The inventory class doesn't operate in the same manner as my ShopItem. As far as flawlessness is concerned, I don't think it's the greatest, but it should suffice. And I also quickly included two additional methods: getAmount(int...) and getAmount(String...).
  12. liverare replied to liverare's topic in Snippets
    Wow, I completely forgot about this! I'm so sorry about that! OK I'll get to work on it right away! It shouldn't be too hard to implement.
  13. Nope. Everybody lies. Toddlers and drunks are no exceptions! As for my quote: "Eat a sack of baby dicks, motherfucker!" —The Boondocks, Mactastic.
  14. You should inherit the Area class and override most/all of its methods to make it functional for a polygon-based region. This will ensure your PolygonArea instances can be applied to methods within the MethodProvider class that accept Area parameters.
  15. Attention seeking much... Here's a non/less-attention seeking resignation: GL anyways...
  16. liverare replied to liverare's topic in Snippets
    if (shop.isOpen() && shop.validate()) { //Validate method is required to launch at least once before item profiling Perhaps my choice of words were bad. Would you prefer Shop#validate() to be renamed to Shop#update() ? It actual does read rather nicely compared to the current. And also I may take into consideration the ability to declare a ShopItem as a field variable, but to then validate it later on. Hmm...I think it can already be done (to an extent), but for more dev-friendly I may remove the abstract modifier and implement a new interface that links through to Shop. AKA: I think I've got a nice idea - inspired by you.
  17. Need help with some data collection - updated main thread! My agility level is too high to fail on courses at Seers' Village or below. They will remain "unfinished" until I have them. If you can help with this, please PM me.
  18. Couldn't help myself with another paint ss: Forget the crap hourly XP and the incorrect spelling of "Gained", I have just restarted the script after finally cleaning up the bottom part of the paint. ...DAT PROGRESS BAR.
  19. I'm bad at setting ETA's, so "soon."
  20. Thank you for your input, but I think the community would benefit from having open script examples available. I have noticed a premium rooftop agility script that's £7. ...That's a little too pricey. I will also be updating my first post later - I've finished adding in some skill trackers that include XPTNL, TTL, XP/Hour, etc.
  21. Currently in the works! I'm tweaking my framework to try and improve performance and reduce wastefulness wherever possible! Statuses: Completed. Track completed, but fail positions still needed. Track completed, but problems with obstacle(s) + Fail positions needed. Incomplete (don't have the sufficient agility level to access. Current courses supported: Level 10: Draynor Village Level 20: Al Kharid Level 30: Varrock Level 40: Canifis Level 50: Falador Level 60: Seers' Village Level 70: Pollnivneach Level 80: Relekka Level 90: Ardougne (will need assistance attaining values) My agility level is too high to fail on courses at Seers' Village or below. They will remain "unfinished" until I have them. If you can help with this, please PM me. Current features: Course completing framework (still in development). Eating at health percentile. Grace token acquiring. Future features: GUI for food, mouse speed, ignore tokens, etc. configuration. More informative and aesthetically appealing paint. Additional features that may be included: Banking (possibly, though not strictly needed - you rarely take any damage). Multithreaded camera. More accurate interaction method. ...Am I missing anything? And finally, for the benefit of the community, I may release this script open-source.
  22. liverare replied to liverare's topic in Snippets
    I should really get around to updating this class. There are a few tweaks I need to adjust. While I'm at it I'll import through features from the inventory class to allow for the selling of stock.
  23. liverare replied to liverare's topic in Snippets
    Thanks! I hope it serves well.
  24. Nice, but computing the required XP on each call (especially on paint) will only result in performance issues. I'd suggest just caching the values into a giant 2D array.
  25. liverare replied to liverare's topic in Snippets
    Last-second update push. I added in a fail-safe to prevent the continued purchasing of items for slots that were previously holding your original required item. It was a logical error I spotted.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.