Jump to content

liverare

Scripter II
  • Posts

    1296
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    0%

Everything posted by liverare

  1. Description: It's a non-English 'gamer' rap (I think?) of two people sitting at computers and rapping about pizza rolls (?) and RuneScape ("Runascapa"). I believe the language is Norwegian, and during the song, they get a call from their friend and he delivers a small line in the rap. God, I got that fucking beat in my head. Does anyone know what the fuck I'm talking about? One nerd is tall with glasses and the other...god I don't even remember the other. Two dudes at their computer, they briefly show you the RuneScape loader interface. It's popular on YouTube.
  2. public static boolean drinkPotion(Client client, Skill skill) throws InterruptedException { boolean success = false; int boostedLevel = client.getSkills().getCurrentLevel(skill); int baseLevel = client.getSkills().getLevel(skill); if (boostedLevel <= baseLevel) { /* * e.g., * ATTACK -> * -> (A) (ttack) -> * -> Attack */ String potionName = skill.name().charAt(0) + skill.name().substring(1).toLowerCase(); Item potion = client.getInventory().getItemForNameThatContains(potionName); if (potion != null && client.getInventory().interactWithId(potion.getId(), "Drink")) { success = true; } } return success; } Be liek public void someMethod() { // Drink attack potion if (drinkPotion(client, Skill.ATTACK)) { log("Successfully drank a sip of attack potion."); } // Drink strength potion if (drinkPotion(client, Skill.STRENGTH)) { log("Successfully drank a sip of strength potion."); } // Drink agility potion if (drinkPotion(client, Skill.AGILITY)) { log("Successfully drank a sip of agility potion."); } } Oh, forgot to mention: Untested. :\ ...Lol, just realised; don't be havin' no strength amulet on yo' purson! Mmmeh, just so long as getItemForNameThatContains is case sensitive, you should be fine because... Strength potion Amulet of strength
  3. Just a bunch of edgy faggots trying to look tough on the forums. From that link: Holy shit I can't even pick these guys up because of just how many edges there are.
  4. 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.
  5. 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.
  6. True. But still, goodluck with your script!
  7. 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
  8. 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.
  9. 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!
  10. 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.
  11. Stacking interfaces, wut?
  12. 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.
  13. Check your PMs, I sent you a message a few days ago.
  14. 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...).
  15. 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.
  16. 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.
  17. 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.
  18. 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.
  19. 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.
  20. I'm bad at setting ETA's, so "soon."
  21. 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.
  22. 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.
  23. 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.
  24. Thanks! I hope it serves well.
×
×
  • Create New...