Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • How do I retrieve information from RS?


    xaklon
     Share

    Recommended Posts

    How can I fetch data from the bot, like the output line when the action is taken to prospect an ore, or to examine an object? 

     

    I want to fetch this data, retrieve it as a String, and then simply create a check in my script with the output. 

    Link to comment
    Share on other sites

    are you talking about the game outputting messages to the chat when you do something?

    if so just implement MessageListener in the script

    That's what I was talking about, thank you so much! Super helpful as always! 

    Thanks so much Neffarion!

     

    Side q, not to start another thread: what is the actual code that I must write to actually code my JFrame rather than using WindowBuilder? I am familiar with AWT but not how it interacts with the external archives. 

    Edited by mw130
    Link to comment
    Share on other sites

     

     

    That's what I was talking about, thank you so much! Super helpful as always! 

    Thanks so much Neffarion!

     

    Side q, not to start another thread: what is the actual code that I must write to actually code my JFrame rather than using WindowBuilder? I am familiar with AWT but not how it interacts with the external archives. 

    Kinda confused on what you really want to know.

    Just create a normal JFrame (with any swing frame designer or by yourself) and onStart inside the script you just open it

    Link to comment
    Share on other sites

     

     

     

    Kinda confused on what you really want to know.

    Just create a normal JFrame (with any swing frame designer or by yourself) and onStart inside the script you just open it

     

    Right, the issue I was having was that in onStart() I cannot add the JFrame to the component, and i can't extend JComponent. Would you make it a completely separate GUI class and just have them interact as classes?

     

    Again, your help is amazing! Let me know if you need more clarity. Thanks Neffarion. 

    Link to comment
    Share on other sites

     

    Right, the issue I was having was that in onStart() I cannot add the JFrame to the component, and i can't extend JComponent. Would you make it a completely separate GUI class and just have them interact as classes?

     

    Again, your help is amazing! Let me know if you need more clarity. Thanks Neffarion. 

     

    What i usually do is have a class that is the JFrame itself (example: MyFrame.java)

    public class MyFrame extends JFrame {
    
    private main script;
    public MyFrame(main s){
       script = s;
       ....
    }
    
    // Your other gui stuff....
    
    }
    

    Then on your main method where you have the onLoop and onStart

    private MyFrame gui;
    
    
    ....
    
    
    
    public void onStart(){
    main m = this;
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {               
                        gui = new MyFrame(m);
                        gui.setVisible(true);
                    }
                });
                while (gui.isVisible()) {
                    sleep(500);
                }
            } catch (Exception ex) {
                MethodProvider.log(ex.toString());
            }
    }
    

    Now you can just access either from both sides for whatever you need

    There is probably other ways but this one works if you want to use it.

    Link to comment
    Share on other sites

     

     

     

    What i usually do is have a class that is the JFrame itself (example: MyFrame.java)

    public class MyFrame extends JFrame {
    
    private main script;
    public MyFrame(main s){
       script = s;
       ....
    }
    
    // Your other gui stuff....
    
    }
    

    Then on your main method where you have the onLoop and onStart

    private MyFrame gui;
    
    
    ....
    
    
    
    public void onStart(){
    main m = this;
    try {
        SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {               
                        gui = new MyFrame(m);
                        gui.setVisible(true);
                    }
                });
                while (gui.isVisible()) {
                    sleep(500);
                }
            } catch (Exception ex) {
                MethodProvider.log(ex.toString());
            }
    }
    

    Now you can just access either from both sides for whatever you need

    There is probably other ways but this one works if you want to use it.

     

    You're awesome man - you should post that as a tutorial for others! Yeah, got it perfectly now w/ your help. 

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.