• We see that you're not registered. Please read this thread and if you want, sign up on the forum.

Need help getting loader/bot to function for RSC

namdam

New member
Joined
Jul 30, 2020
Posts
9
Points
3
Reaction score
6
Quality Posts
I'm following Shenandoah's tutorial here, and at the moment I'm having issues getting the loader working. I was originally setting this up for a local version but now I'm trying to get it working for ORSC's vanilla 1x server as I didn't want to mess with trying to get a local server running and am only interested in the bot development stuff right now.

Here is a link to the server - Here's a link to their client, but as you can see they have a whole git repo with their code which frankly is awesome & I love how dedicated they are to RSC. I don't want to mess with their game at all, just use it as a platform for building my own bot, so anything I make will be kept local, private - and outside of testing - basically unused.

So here's where I'm at - I'm trying to get the loader working, but it seems like there are some complications I'm not noticing w/ the setup code. Using the java decompiler with the launcher, there are some parameters for the server that get set when you click on the OpenRSC option: (ButtonListener.class in OpenRSC.jar)

Code:
case "openrsc":
        ip = "game.openrsc.com";
        port = "43596";
        set(ip, port);
        launch();
        return;
The launch() function then checks if you are starting the dev version or not, we're not so it just launches the client:

Code:
  private void launch() {
    launch(false);
  }
 
  private void launch(boolean dev) {
    File f = new File("Cache" + File.separator + "client.properties");
    f.delete();
    File configFile = new File("Cache" + File.separator + "config.txt");
    configFile.delete();
    CheckCombo.store[] entries = AppFrame.get().getComboBoxState();
    if (entries.length != 1 || !(entries[0]).text.equalsIgnoreCase("none"))
      try {
        FileWriter write = new FileWriter(configFile, true);
        PrintWriter writer = new PrintWriter(write);
        for (CheckCombo.store entry : entries)
          writer.println(entry.text + ":" + (entry.state.booleanValue() ? 1 : 0));
        writer.close();
        write.close();
      } catch (IOException a) {
        a.printStackTrace();
      } 
    ClientLauncher.launchClient(dev);
  }

I'm not a great programmer and have no experience with RE, so this is around where I get lost. I'm not sure what I need to setup in my loader. The actual client is downloaded to /Cache/ and is named "Open_RSC_Client.jar" I'm not finding where it initiates the client, but if you open the actual client in the decompiler it looks like we want OpenRSC.class, which contains:

Code:
public class OpenRSC extends ORSCApplet {
  private static JFrame jframe;
 
  private static final long serialVersionUID = 1L;
 
  public static void main(String[] args) {
    SwingUtilities.invokeLater(OpenRSC::createAndShowGUI);
  }
 
  public static void createAndShowGUI() {
    try {
      jframe = new JFrame(Config.getServerNameWelcome());
      Applet applet = new OpenRSC();
      applet.setPreferredSize(new Dimension(512, 346));
      jframe.getContentPane().setLayout(new BorderLayout());
      jframe.setDefaultCloseOperation(3);
      jframe.setIconImage(Utils.getImage("icon.png").getImage());
      jframe.setTitle(Config.WINDOW_TITLE);
      jframe.getContentPane().add(applet);
      jframe.setResizable(true);
      jframe.setVisible(true);
      jframe.setBackground(Color.black);
      jframe.setMinimumSize(new Dimension(528, 385));
      jframe.pack();
      jframe.setLocationRelativeTo(null);
      applet.init();
      applet.start();
    } catch (HeadlessException e) {
      e.printStackTrace();
    }
  }
  ...
Then of course we have ORSCApplet.java which contains a lot of the required parameter info...

Code:
public class ORSCApplet extends Applet implements MouseListener, MouseMotionListener, KeyListener, MouseWheelListener, ComponentListener, ImageObserver, ImageProducer, ClientPort {
  private static final long serialVersionUID = 1L;
 
  public static int globalLoadingPercent = 0;
 
  public static String globalLoadingState = "";
 
  private static mudclient mudclient;
 
  static PacketHandler packetHandler;
 
  private final boolean m_hb = false;
 
  protected int resizeWidth;
 
  protected int resizeHeight;
  ...
So I believe that is most of the immediately relevant code, but I need help piecing this info together to get a working loader. I'm sure some of my issues are probably simple, I don't have a ton of programming experience beyond some relatively simple JS and Java stuff. This version of the game is a little different from the main tutorial of course, so the first thing I need to figure out is the extent of what needs to be included in the loader as far as what needs to be instantiated (I believe) - This is about where my brain turns to mush so any insight would be super helpful. Here is where I'm at with the code. (Roughly at Part 2 of the loader portion of Shenandoah's guide)

Madbot.java:
Code:
public class Madbot {
    File file = new File("C:/Users/Jared/Desktop/rsc/Cache/Open_RSC_Client.jar");
    ClassLoader cl = new URLClassLoader(new URL[] { file.toURI().toURL() });

    Class<?> clazz = cl.loadClass("OpenRSC");
    Constructor<?> init = clazz.getDeclaredConstructor();
            init.setAccessible(true);
    Applet applet = (Applet) init.newInstance();
}
Sorry for the disorganized request help thread, I'm just uncertain of what my next steps should be. I know I need to get all of the required parameters setup now, but there's so much here and I'm just unsure what is actually required. How do I know what I need to load?
 

Shenandoah

Access Write Violation
Admin
Legend
Joined
Nov 1, 2019
Posts
93
Points
18
Reaction score
52
Quality Posts
1
I'm following Shenandoah's tutorial here, and at the moment I'm having issues getting the loader working. I was originally setting this up for a local version but now I'm trying to get it working for ORSC's vanilla 1x server as I didn't want to mess with trying to get a local server running and am only interested in the bot development stuff right now.

Here is a link to the server - Here's a link to their client, but as you can see they have a whole git repo with their code which frankly is awesome & I love how dedicated they are to RSC. I don't want to mess with their game at all, just use it as a platform for building my own bot, so anything I make will be kept local, private - and outside of testing - basically unused.

So here's where I'm at - I'm trying to get the loader working, but it seems like there are some complications I'm not noticing w/ the setup code. Using the java decompiler with the launcher, there are some parameters for the server that get set when you click on the OpenRSC option: (ButtonListener.class in OpenRSC.jar)

Code:
case "openrsc":
        ip = "game.openrsc.com";
        port = "43596";
        set(ip, port);
        launch();
        return;
The launch() function then checks if you are starting the dev version or not, we're not so it just launches the client:

Code:
  private void launch() {
    launch(false);
  }

  private void launch(boolean dev) {
    File f = new File("Cache" + File.separator + "client.properties");
    f.delete();
    File configFile = new File("Cache" + File.separator + "config.txt");
    configFile.delete();
    CheckCombo.store[] entries = AppFrame.get().getComboBoxState();
    if (entries.length != 1 || !(entries[0]).text.equalsIgnoreCase("none"))
      try {
        FileWriter write = new FileWriter(configFile, true);
        PrintWriter writer = new PrintWriter(write);
        for (CheckCombo.store entry : entries)
          writer.println(entry.text + ":" + (entry.state.booleanValue() ? 1 : 0));
        writer.close();
        write.close();
      } catch (IOException a) {
        a.printStackTrace();
      }
    ClientLauncher.launchClient(dev);
  }

I'm not a great programmer and have no experience with RE, so this is around where I get lost. I'm not sure what I need to setup in my loader. The actual client is downloaded to /Cache/ and is named "Open_RSC_Client.jar" I'm not finding where it initiates the client, but if you open the actual client in the decompiler it looks like we want OpenRSC.class, which contains:

Code:
public class OpenRSC extends ORSCApplet {
  private static JFrame jframe;

  private static final long serialVersionUID = 1L;

  public static void main(String[] args) {
    SwingUtilities.invokeLater(OpenRSC::createAndShowGUI);
  }

  public static void createAndShowGUI() {
    try {
      jframe = new JFrame(Config.getServerNameWelcome());
      Applet applet = new OpenRSC();
      applet.setPreferredSize(new Dimension(512, 346));
      jframe.getContentPane().setLayout(new BorderLayout());
      jframe.setDefaultCloseOperation(3);
      jframe.setIconImage(Utils.getImage("icon.png").getImage());
      jframe.setTitle(Config.WINDOW_TITLE);
      jframe.getContentPane().add(applet);
      jframe.setResizable(true);
      jframe.setVisible(true);
      jframe.setBackground(Color.black);
      jframe.setMinimumSize(new Dimension(528, 385));
      jframe.pack();
      jframe.setLocationRelativeTo(null);
      applet.init();
      applet.start();
    } catch (HeadlessException e) {
      e.printStackTrace();
    }
  }
  ...
Then of course we have ORSCApplet.java which contains a lot of the required parameter info...

Code:
public class ORSCApplet extends Applet implements MouseListener, MouseMotionListener, KeyListener, MouseWheelListener, ComponentListener, ImageObserver, ImageProducer, ClientPort {
  private static final long serialVersionUID = 1L;

  public static int globalLoadingPercent = 0;

  public static String globalLoadingState = "";

  private static mudclient mudclient;

  static PacketHandler packetHandler;

  private final boolean m_hb = false;

  protected int resizeWidth;

  protected int resizeHeight;
  ...
So I believe that is most of the immediately relevant code, but I need help piecing this info together to get a working loader. I'm sure some of my issues are probably simple, I don't have a ton of programming experience beyond some relatively simple JS and Java stuff. This version of the game is a little different from the main tutorial of course, so the first thing I need to figure out is the extent of what needs to be included in the loader as far as what needs to be instantiated (I believe) - This is about where my brain turns to mush so any insight would be super helpful. Here is where I'm at with the code. (Roughly at Part 2 of the loader portion of Shenandoah's guide)

Madbot.java:
Code:
public class Madbot {
    File file = new File("C:/Users/Jared/Desktop/rsc/Cache/Open_RSC_Client.jar");
    ClassLoader cl = new URLClassLoader(new URL[] { file.toURI().toURL() });

    Class<?> clazz = cl.loadClass("OpenRSC");
    Constructor<?> init = clazz.getDeclaredConstructor();
            init.setAccessible(true);
    Applet applet = (Applet) init.newInstance();
}
Sorry for the disorganized request help thread, I'm just uncertain of what my next steps should be. I know I need to get all of the required parameters setup now, but there's so much here and I'm just unsure what is actually required. How do I know what I need to load?
Because I'm unfamiliar with the code of the particular client you're using, I can't promise that my advice will be very helpful; I'll try my best though!

So, from looking at the code you posted, your client might actually be less complicated than the one used in the tutorial. You might not actually have to do any of the parameter work that I did in the tutorial because I don't really see any parameters initialized here. What happens if you try to run MadBot.java as is?

If it doesn't work, try creating a JFrame and add the applet instance you created to the ContentPane, very much like the code in the createAndShowGUI() method. So, something like this:


Java:
jframe = new JFrame("Your bot name here");
      applet.setPreferredSize(new Dimension(512, 346));
      jframe.getContentPane().setLayout(new BorderLayout());
      jframe.setDefaultCloseOperation(3);
      jframe.getContentPane().add(applet);
      jframe.setResizable(true);
      jframe.setVisible(true);
      jframe.setBackground(Color.black);
      jframe.setMinimumSize(new Dimension(528, 385));
      jframe.pack();
      jframe.setLocationRelativeTo(null);
      applet.init();
      applet.start();
 

namdam

New member
Joined
Jul 30, 2020
Posts
9
Points
3
Reaction score
6
Quality Posts
Because I'm unfamiliar with the code of the particular client you're using, I can't promise that my advice will be very helpful; I'll try my best though!

So, from looking at the code you posted, your client might actually be less complicated than the one used in the tutorial. You might not actually have to do any of the parameter work that I did in the tutorial because I don't really see any parameters initialized here. What happens if you try to run MadBot.java as is?

If it doesn't work, try creating a JFrame and add the applet instance you created to the ContentPane, very much like the code in the createAndShowGUI() method. So, something like this:


Java:
jframe = new JFrame("Your bot name here");
      applet.setPreferredSize(new Dimension(512, 346));
      jframe.getContentPane().setLayout(new BorderLayout());
      jframe.setDefaultCloseOperation(3);
      jframe.getContentPane().add(applet);
      jframe.setResizable(true);
      jframe.setVisible(true);
      jframe.setBackground(Color.black);
      jframe.setMinimumSize(new Dimension(528, 385));
      jframe.pack();
      jframe.setLocationRelativeTo(null);
      applet.init();
      applet.start();
I appreciate any help at all! It might be better if you assume I'm an idiot when it comes to programming lmao, so don't assume I have everything setup correctly, although it should be at least based on what your tutorial contains up to that point. I have asm and asm-tree setup (I grabbed the newest versions of these, 9.0, let me know if that would be a problem) as external libraries on the project, and am using IntelliJ for the IDE.

If I run as-is, I get an error on the line containing "init.setAccessible(true);" ...

Error:(7, 31) java: <identifier> expected
Error:(7, 32) java: illegal start of type

Does that mean setAccessible would be something that needs to get defined?

Edit: And yes this should be quite a bit less complex than the RS2 client as RSC is comparatively basic in terms of features/graphics/gameplay. Overall it seems like it would follow the same general guidelines though.
 
Last edited:

Shenandoah

Access Write Violation
Admin
Legend
Joined
Nov 1, 2019
Posts
93
Points
18
Reaction score
52
Quality Posts
1
Try removing the setAccesible line, and also the getDeclaredConstructor line. Replace it with this and see if it works:

Applet applet = (Applet) clazz.newInstance();

If it doesn't work, please post the entire code of your MadBot class, and I'll have a closer look. :)
 

namdam

New member
Joined
Jul 30, 2020
Posts
9
Points
3
Reaction score
6
Quality Posts
Try removing the setAccesible line, and also the getDeclaredConstructor line. Replace it with this and see if it works:

Applet applet = (Applet) clazz.newInstance();

If it doesn't work, please post the entire code of your MadBot class, and I'll have a closer look. :)
Getting some more errors, after the code block...
Code:
public class Madbot {
    File file = new File("C:/Users/Jared/Desktop/rsc/Cache/Open_RSC_Client.jar");
    ClassLoader cl = new URLClassLoader(new URL[]{file.toURI().toURL()});

    Class<?> clazz = cl.loadClass("OpenRSC");
    Applet applet = (Applet) clazz.newInstance();
}
Code:
Error:(2, 5) java: cannot find symbol
  symbol:   class File
  location: class Madbot
Error:(6, 5) java: cannot find symbol
  symbol:   class Applet
  location: class Madbot
Error:(2, 21) java: cannot find symbol
  symbol:   class File
  location: class Madbot
Error:(3, 26) java: cannot find symbol
  symbol:   class URLClassLoader
  location: class Madbot
Error:(3, 45) java: cannot find symbol
  symbol:   class URL
  location: class Madbot
Error:(6, 22) java: cannot find symbol
  symbol:   class Applet
  location: class Madbot
Edit: btw I think something is up with your website's JS load order, sometimes the rich text editor doesn't show up.
 

Shenandoah

Access Write Violation
Admin
Legend
Joined
Nov 1, 2019
Posts
93
Points
18
Reaction score
52
Quality Posts
1
Getting some more errors, after the code block...
Code:
public class Madbot {
    File file = new File("C:/Users/Jared/Desktop/rsc/Cache/Open_RSC_Client.jar");
    ClassLoader cl = new URLClassLoader(new URL[]{file.toURI().toURL()});

    Class<?> clazz = cl.loadClass("OpenRSC");
    Applet applet = (Applet) clazz.newInstance();
}
Code:
Error:(2, 5) java: cannot find symbol
  symbol:   class File
  location: class Madbot
Error:(6, 5) java: cannot find symbol
  symbol:   class Applet
  location: class Madbot
Error:(2, 21) java: cannot find symbol
  symbol:   class File
  location: class Madbot
Error:(3, 26) java: cannot find symbol
  symbol:   class URLClassLoader
  location: class Madbot
Error:(3, 45) java: cannot find symbol
  symbol:   class URL
  location: class Madbot
Error:(6, 22) java: cannot find symbol
  symbol:   class Applet
  location: class Madbot
Edit: btw I think something is up with your website's JS load order, sometimes the rich text editor doesn't show up.
You didn't put the code in a method. xD

I'm sorry if this comes across as rude, but are you new to coding? Because if you don't know the basics yet, then I highly doubt you'll be able to finish your project as it's quite advanced. It might be a better idea to make sure you master the language itself first before you tackle this project. :p
 

namdam

New member
Joined
Jul 30, 2020
Posts
9
Points
3
Reaction score
6
Quality Posts
You didn't put the code in a method. xD

I'm sorry if this comes across as rude, but are you new to coding? Because if you don't know the basics yet, then I highly doubt you'll be able to finish your project as it's quite advanced. It might be a better idea to make sure you master the language itself first before you tackle this project. :p
Like I said I'm a terrible programmer lmao! I took a COBOL class in high school but this was years ago, and I work on websites but I don't consider what I do programming. It might help if I knew Java's syntax a little better - My only previous experience with Java was with some scripting a long time ago, and that was mostly just me copy+pasting things. I'll take some time to get better at the basics and try again. :p

How's this? I'm getting the same errors

Code:
public class Madbot {
    static void myMethod() {

    File file = new File("C:/Users/Me/Desktop/rsc/Cache/Open_RSC_Client.jar");
    ClassLoader cl = new URLClassLoader(new URL[]{file.toURI().toURL()});

    Class<?> clazz = cl.loadClass("OpenRSC");
    Applet applet = (Applet) clazz.newInstance();
}

    public static void main(String[] args) {
        myMethod();
    }
}
 

Shenandoah

Access Write Violation
Admin
Legend
Joined
Nov 1, 2019
Posts
93
Points
18
Reaction score
52
Quality Posts
1
Like I said I'm a terrible programmer lmao! I took a COBOL class in high school but this was years ago, and I work on websites but I don't consider what I do programming. It might help if I knew Java's syntax a little better - My only previous experience with Java was with some scripting a long time ago, and that was mostly just me copy+pasting things. I'll take some time to get better at the basics and try again. :p

How's this? I'm getting the same errors

Code:
public class Madbot {
    static void myMethod() {

    File file = new File("C:/Users/Me/Desktop/rsc/Cache/Open_RSC_Client.jar");
    ClassLoader cl = new URLClassLoader(new URL[]{file.toURI().toURL()});

    Class<?> clazz = cl.loadClass("OpenRSC");
    Applet applet = (Applet) clazz.newInstance();
}

    public static void main(String[] args) {
        myMethod();
    }
}
Did you import the classes that you're using?

And I think you might be underestimating the difficulty of your project. :p

Writing a bot from scratch requires pretty deep knowledge not only of the Java programming language, but also of the internals of the JVM itself. Try and familiarize yourself with the basics, and OOP principles, and then maybe move on to bytecode injection which I wrote a little about in my tutorial.
 

namdam

New member
Joined
Jul 30, 2020
Posts
9
Points
3
Reaction score
6
Quality Posts
Did you import the classes that you're using?

And I think you might be underestimating the difficulty of your project. :p

Writing a bot from scratch requires pretty deep knowledge not only of the Java programming language, but also of the internals of the JVM itself. Try and familiarize yourself with the basics, and OOP principles, and then maybe move on to bytecode injection which I wrote a little about in my tutorial.
You right Shenandoah, you right. We'll circle back on this in a while then haha
 

Logg

New member
Joined
Nov 23, 2020
Posts
2
Points
3
Reaction score
1
Quality Posts
You right Shenandoah, you right. We'll circle back on this in a while then haha
Heyo, Logg here, one of the admins at Open RSC. I know it's been a couple months since this topic was active, but I figure it's worth chiming in.

The Open RSC server is not unmoderated unlike how the authentic RSC server was & any botters will be found and banned pretty quickly on that particular server.

However, we plan to host a "botting allowed" server in the near future. Botting was a huge part of RSC for a majority of its lifespan, and although I never botted personally, I understand the appeal. Get in contact with us on discord (linked below) & I can give you some pointers. Reflection/Injection knowledge is not necessary due to our open source nature, and due to our commitment to being 100% authentic, you don't even need to use our client as the base.

Resources:
openrsc website: https://runescapeclassic.dev/
openrsc discord: https://discord.gg/94vVKND
 

Shenandoah

Access Write Violation
Admin
Legend
Joined
Nov 1, 2019
Posts
93
Points
18
Reaction score
52
Quality Posts
1
Heyo, Logg here, one of the admins at Open RSC. I know it's been a couple months since this topic was active, but I figure it's worth chiming in.

The Open RSC server is not unmoderated unlike how the authentic RSC server was & any botters will be found and banned pretty quickly on that particular server.

However, we plan to host a "botting allowed" server in the near future. Botting was a huge part of RSC for a majority of its lifespan, and although I never botted personally, I understand the appeal. Get in contact with us on discord (linked below) & I can give you some pointers. Reflection/Injection knowledge is not necessary due to our open source nature, and due to our commitment to being 100% authentic, you don't even need to use our client as the base.

Resources:
openrsc website: https://runescapeclassic.dev/
openrsc discord: https://discord.gg/94vVKND
Thanks for your input. I should've added a disclaimer to my tutorial informing people that what they do with the knowledge I give them is their responsibility alone, and that the tutorial is solely for educational purposes only. We don't want any beef. :p
 

Logg

New member
Joined
Nov 23, 2020
Posts
2
Points
3
Reaction score
1
Quality Posts
No beef. :) Or any reason to claim "it's for educational purposes only". :p

Botters will be allowed to bot on our "Botting Allowed" server. Botters will be found and banned on our other servers.
 
Top