Jump to content

empathy

Trade With Caution
  • Posts

    110
  • Joined

  • Last visited

  • Feedback

    66.7%

Posts posted by empathy

  1. So I just can't figure it out!

     

    I have tired many different ways and it just keeps crashing osbot!

     

    I create a list of ground items and it does fetch what I'm looking for and the list become populated. how can I take the items from this list and interact with them?

     

    getGroundItems().closest("name").interact("Take")

     

    ??????? I am on my phone so this may not be accurate.

    • Like 1
  2. I made this for fun and I really don't plan on using it. I'm gonna release it. Feel free to use it or don't. I don't care doge.png

     

    Also the code isn't that clean.

     

    What it does:

     

    https://gyazo.com/442cf002eb683ed0343f6f62f79e2d15

     

     

    Code (Note* the first item search may lag a tiny bit due to loading the text document from online. An easy fix is to load the text document locally):

     

    package org.empathy.combat.equipment.gui;
    
    import java.awt.EventQueue;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.image.BufferedImage;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    
    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.border.EmptyBorder;
    
    public class Gui extends JFrame {
    
        private JPanel contentPane;
        private JTextField textField;
        private int itemId;
        String path = "http://cdn.rsbuddy.com/items/" + itemId + ".png";
        JLabel lblNewLabel;
        BufferedImage image;
        private JLabel lblTypeAnItem;
        
        
        /**
         * Launch the application.
         */
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        Gui frame = new Gui();
                        frame.setVisible(true);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    
        /**
         * Create the frame.
         */
        public Gui() {
            //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setBounds(100, 100, 340, 382);
            contentPane = new JPanel();
            contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
            setContentPane(contentPane);
            contentPane.setLayout(null);
            
            textField = new JTextField();
            textField.addActionListener(new ActionListener() {
    
                @Override
                public void actionPerformed(ActionEvent arg0) {
                    checkText();                
                    
                }
                
            });
            textField.setBounds(118, 49, 86, 20);
            contentPane.add(textField);
            textField.setColumns(10);
            
            try {
    
            image = ImageIO.read(new URL(path));
            lblNewLabel = new JLabel();
            lblNewLabel.setBounds(118, 92, 86, 73);
            contentPane.add(lblNewLabel);
            
            lblTypeAnItem = new JLabel("Type an item name and hit Enter");
            lblTypeAnItem.setBounds(80, 28, 208, 14);
            contentPane.add(lblTypeAnItem);
    
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        
        public void checkText() {
            if (textField.getText() != null) {
                try {
                    URL url = new URL("https://gist.githubusercontent.com/anonymous/a1aa9894c1acc0c1c201/raw/b8bd35ed57a9cedfb1dc2379212ac79faa979136/IDs.txt");
                    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                    String line;
                    while ((line = in.readLine()) != null) {
                        if (line.toLowerCase().contains(textField.getText().toLowerCase())) {
                            String[] x = line.toLowerCase().split(textField.getText().toLowerCase() + " - ");
                            int i = Integer.parseInt(x[1]);
                            image = ImageIO.read(new URL("http://cdn.rsbuddy.com/items/" + i + ".png"));
                            lblNewLabel.setIcon(new ImageIcon(image));
                            break;
                            }
                        }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    • Like 4
  3. private final int[] DEADMAN_WORLDS = {317, 319, 321, 345, 352, 357, 360, 374};
    private boolean isDeadman(){
    	for(int i : DEADMAN_WORLDS){
    		if(getBot().getWorld() == i){
    			return true;
    		}
    	}
    		
    	return false;
    }
    

    Pretty simple, probs forgetting a world or new worlds will be added. Change the modifiers if necessary.

     

     

    Nice convention naming :doge:

     

    private final int[] deadmanWorlds
     
  4.  

    Hey! It does click the bank 1 time now! Thanks for that. Only problem is. It doesn't deposit the logs anymore. 

     

    EDIT: Trying it with the !myPlayer().isMoving()). Will let you know in a sec.

    			if (bankbooth != null && !getBank().isOpen()) {
    						if (inventory.isFull()) {
    							camera.toEntity(bankbooth);
    							bankbooth.interact("Bank");
    							bank.depositAll("Willow logs");
    							sleep(random(500,700));
    						}
    				}
    

     

    There's no sleep time between opening the bank and depositing willow logs. Try adding a conditional sleep after interacting like this:

     

    bankbooth.interact("Bank");
    new ConditionalSleep(5000) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return getBank().isOpen();
                        }
    
                    }.sleep();
    

     

    This means that the bot will sleep for 5000 milliseconds or until the bank is open. Whichever comes first.

     

     

     

    You should generally avoid doing multiple interactions in 1 loop cycle, and always evaluate the success of your actions (never assume success).

    In this particular case tho, I think you can solve it by adding a check to the case for opening the bank

     

     

    You can evaluate the success by adding conditional sleeps.

    • Like 1
  5. My bro got banned on deadman boting in safe zone. He probably got reported or a p/mod j/mod walked by. IDK he was boting for 4 hours only with breaks so very unlucky.

     

    Breaks dont work on deadman mode since the 10 second timer doesn't let you log out.

    • Like 4
×
×
  • Create New...