Results 1 to 4 of 4

Thread: Editing Brandon's tutorial on create your own bot interface to work for RSPS

  1. #1
    Join Date
    Jul 2013
    Posts
    45
    Mentioned
    1 Post(s)
    Quoted
    16 Post(s)

    Question Editing Brandon's tutorial on create your own bot interface to work for RSPS

    I recently did Brandon's tutorial on creating your own bot interface.
    I got it working for the RS3 client, but now I want to be able to make it work for an RSPS too
    I downloaded their jar file and I tried making a new ClientApplet constructor:
    Code:
    public ClientApplet(int width, int height) {
            try {
                this.setLayout(new BorderLayout(0, 0));
                loader = new URLClassLoader(new URL[]{new File(Configuration.PATH_TO_CLIENT).toURI().toURL()});
                applet = (Applet)loader.loadClass(Configuration.MAIN_CLASS.replace(".class", "")).newInstance();
                applet.setStub(this);
                applet.setPreferredSize(new Dimension(width, height));
                this.add(applet, BorderLayout.CENTER);
            } catch(Exception e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(null, "Error Loading.. Please Check Your Internet Connection.", "Error Loading..", JOptionPane.ERROR_MESSAGE);
            }
    
        }
    And this is the configuration file:
    Code:
    public static final boolean RUNESCAPE_CLIENT = false;
        public static final String PATH_TO_CLIENT = "C:/Users/Ruud/Arandar Client/Arandar.jar";
        public static final String MAIN_CLASS = "Client.class";
    and I changed the displayFrame method to this:
    Code:
    private static void displayFrame(String world, int width, int height) {
            JFrame frame = new JFrame("Eos");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setResizable(false);
    
            if (splash != null && Configuration.RUNESCAPE_CLIENT) {
                frame.add(splash);
                frame.pack();
                frame.setVisible(true);
            }
    
            centerFrame(frame);
            ClientApplet applet;
            if (Configuration.RUNESCAPE_CLIENT)
                applet = new ClientApplet(world, width, height);
            else
                applet = new ClientApplet(width, height);
            frame.add(applet);
            applet.start();
            if (splash != null && Configuration.RUNESCAPE_CLIENT) {
                frame.remove(splash);
            }
            frame.revalidate();
            frame.pack();
    
            centerFrame(frame);
    
            frame.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    frame.setVisible(false);
                    applet.stop();
                    frame.dispose();
                    super.windowClosed(e);
                }
            });
        }
    When I run it like this I get just a very small screen with nothing on it, I don't get an error either.

    I hope someone can tell me what I am doing wrong

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    ...

    Try setting your Frame's dimensions to 800x600 and see if your applet displays. If it does, then you need to size properly:

    Java Code:
    //ClientApplet.java:
    //applet = (Applet) loader.loadClass(...).newInstance()
    applet.setStub(this);
    applet.setPreferredSize(new Dimension(width, height));
    applet.setSize(width, height);
    this.add(applet, BorderLayout.CENTER);


    @Override
    public void appletResize(int width, int height) {
        applet.setSize(width, height);
    }


    Not sure how you managed RS3 but can't do a private client or OSRS.. Weird..
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    ...

    Try setting your Frame's dimensions to 800x600 and see if your applet displays. If it does, then you need to size properly:

    Java Code:
    //ClientApplet.java:
    //applet = (Applet) loader.loadClass(...).newInstance()
    applet.setStub(this);
    applet.setPreferredSize(new Dimension(width, height));
    applet.setSize(width, height);
    this.add(applet, BorderLayout.CENTER);


    @Override
    public void appletResize(int width, int height) {
        applet.setSize(width, height);
    }


    Not sure how you managed RS3 but can't do a private client or OSRS.. Weird..
    Can confirm this works...
    y

  4. #4
    Join Date
    Jul 2013
    Posts
    45
    Mentioned
    1 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    ...

    Try setting your Frame's dimensions to 800x600 and see if your applet displays. If it does, then you need to size properly:

    Java Code:
    //ClientApplet.java:
    //applet = (Applet) loader.loadClass(...).newInstance()
    applet.setStub(this);
    applet.setPreferredSize(new Dimension(width, height));
    applet.setSize(width, height);
    this.add(applet, BorderLayout.CENTER);


    @Override
    public void appletResize(int width, int height) {
        applet.setSize(width, height);
    }


    Not sure how you managed RS3 but can't do a private client or OSRS.. Weird..
    Ah thank you, I'll try this out. I managed to do RS3, because your tutorial is just that good

    Quote Originally Posted by jstemper View Post
    Can confirm this works...
    y
    Thank you for trying it out and confirming it works!

    EDIT:
    I tried this and got it to work! Thank you two.
    I now did it another way without using the splash screen.
    This is my displayFrame method:
    Code:
    private static void displayFrame(int width, int height) {
            JFrame frame = new JFrame("Eos");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setResizable(false);
    
            centerFrame(frame);
    
            ClientApplet applet = new ClientApplet(width, height);
            frame.add(applet);
    
            applet.start();
    
            frame.revalidate();
            frame.pack();
    
            centerFrame(frame);
    
            frame.addWindowListener(new WindowAdapter() {
                @Override
                public void windowClosing(WindowEvent e) {
                    frame.setVisible(false);
                    applet.stop();
                    frame.dispose();
                    super.windowClosed(e);
                }
            });
        }
    and this is my applet.start method:
    Code:
    public void start() {
            if (applet != null) {
                applet.init();
                applet.start();
    
                while(applet.getComponentCount() < 1 && Configuration.RUNESCAPE_CLIENT) {
                    try {
                        Thread.sleep(10);
                    } catch(Exception e) {
    
                    }
                }
            }
        }
    The only aesthetic problem I currently have is that there is first this small window being shown and after that it transforms to the 800x600 window

    And for some reason I can't login to the server, because I get this error:
    Code:
    Exception in thread "Thread-3" java.lang.NullPointerException
    	at Client.openSocket(Client.java:869)
    	at Client.login(Client.java:8115)
    	at Client.processLoginScreenInput(Client.java:12871)
    	at Client.processGameLoop(Client.java:3407)
    	at RSApplet.run(RSApplet.java:197)
    	at Client.run(Client.java:5894)
    	at java.lang.Thread.run(Thread.java:745)
    I hope someone could tell me why I get this error. When I use the original client.jar it just works fine.

    It sometimes also gives this error:
    Code:
    Error:(97, 15) java: cannot find symbol
      symbol:   method addPaintListener(eos.listeners.PaintListener)
      location: variable canvas of type java.awt.Canvas
    That is on the second line of this code:
    Code:
    public static void notifyCanvasReady(Canvas canvas) {
            canvas.addPaintListener((PaintListener) g -> {
                g.setColor(Color.white);
                g.drawString("HELLO WORLD", 50, 50);
            });
        }
    While I got this code in my Canvas class (in my java.awt package):
    Code:
    public void addPaintListener(PaintListener listener) {
            paintListener = (PaintListener)AWTEventMulticaster.addInternal(paintListener, listener);
        }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •