Page 4 of 6 FirstFirst ... 23456 LastLast
Results 76 to 100 of 128

Thread: Java: How To Create Your Own Bot Interface

  1. #76
    Join Date
    May 2013
    Posts
    46
    Mentioned
    0 Post(s)
    Quoted
    24 Post(s)

    Default

    i some how cant get JDK says the folder does not have JDK so i cant do any of this creating of a bot interface with iam very interested in

  2. #77
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    @Brandon

    Been messing around with simple communication without sockets or anything just shared memory, seems to work quite well. Could all be done in Lape with a simple plugin exporting (CreateFileMapping, MapViewOfFile).

    First time I've ever really messed with java too!

    video
    Last edited by Olly; 12-06-2015 at 02:54 AM.

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

    Default

    Quote Originally Posted by Olly View Post
    @Brandon

    Been messing around with simple communication without sockets or anything just shared memory, seems to work quite well. Could all be done in Lape with a simple plugin exporting (CreateFileMapping, MapViewOfFile).

    First time I've ever really messed with java too!

    video


    NICE! Question, how did you get it to synchronize? What mechanism did you use to ensure that it doesn't miss any events? SharedMutex?
    I am Ggzz..
    Hackintosher

  4. #79
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    NICE! Question, how did you get it to synchronize? What mechanism did you use to ensure that it doesn't miss any events? SharedMutex?
    I'm not sure about the details of what could happen yet, it's extremely simple.

    Java Code:
    public static void communicate(final Bot bot) {
            try {
              AcidCommunication coms = new AcidCommunication();
              AcidCommunication.MessageType msg;
              while (true) {
                 msg = coms.getMessage(); // Waits until message received (fixed offset in shared memory is different than 0)
                 if (msg == AcidCommunication.MessageType.MOVE_MOUSE) {  
                   int x = coms.getParamInt(AcidCommunication.PARAM_ONE);
                   int y = coms.getParamInt(AcidCommunication.PARAM_TWO);
                   bot.getInputManager().moveMouse(x, y);
                   coms.reset(); // Reset all vars in shared mem to zero, simba waits for this reset, and then can write another message
                 }
              }
            } catch (Exception e) { System.out.println("NO!"); }
        }

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

    Default

    Updated the tutorial. Completely brand new. Massive overhaul of programming patterns.


    New:
    Loads the game like the Official RS client (Both OSRS and RS3).
    HTTPSocket class simplifies the loader.
    ClientApplet is MUCH simpler.
    Uses Observer Pattern (PaintListener) for drawing.
    Uses BootLoader to override the Canvas.
    Uses Event Multi-Casting/Chaining.
    Uses IntelliJ IDE.
    Better drawing.
    Fixed canvas notifications.
    Code is better over-all.
    Last edited by Brandon; 12-21-2015 at 01:57 AM.
    I am Ggzz..
    Hackintosher

  6. #81
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Updated the tutorial. Completely brand new. Massive overhaul of programming patterns.


    New:
    Loads the game like the Official RS client (Both OSRS and RS3).
    HTTPSocket class simplifies the loader.
    ClientApplet is MUCH simpler.
    Uses Observer Pattern (PaintListener) for drawing.
    Uses BootLoader to override the Canvas.
    Uses IntelliJ IDE.
    Code is better over-all.
    boss.

  7. #82
    Join Date
    Dec 2010
    Posts
    483
    Mentioned
    30 Post(s)
    Quoted
    328 Post(s)

    Default

    Hahaha great to see info like this making an appearance on this side of the scene. Brings me back to when I was putting out these tutorials - not much has changed it seems.

    Great job @Brandon !

  8. #83
    Join Date
    Jun 2015
    Location
    New Zealand
    Posts
    322
    Mentioned
    2 Post(s)
    Quoted
    131 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Updated the tutorial. Completely brand new. Massive overhaul of programming patterns.


    New:
    Loads the game like the Official RS client (Both OSRS and RS3).
    HTTPSocket class simplifies the loader.
    ClientApplet is MUCH simpler.
    Uses Observer Pattern (PaintListener) for drawing.
    Uses BootLoader to override the Canvas.
    Uses Event Multi-Casting/Chaining.
    Uses IntelliJ IDE.
    Better drawing.
    Fixed canvas notifications.
    Code is better over-all.
    Cheers Brandon! +rep

  9. #84
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    Updated the tutorial. Completely brand new. Massive overhaul of programming patterns.


    New:
    Loads the game like the Official RS client (Both OSRS and RS3).
    HTTPSocket class simplifies the loader.
    ClientApplet is MUCH simpler.
    Uses Observer Pattern (PaintListener) for drawing.
    Uses BootLoader to override the Canvas.
    Uses Event Multi-Casting/Chaining.
    Uses IntelliJ IDE.
    Better drawing.
    Fixed canvas notifications.
    Code is better over-all.
    Nice one. You helped out a lot of people already.

  10. #85
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    @Brandon;

    Code:
     application = runtime.exec(new String[]{ "/bin/sh", "-c", commands.toString() });
    Doesn't seem to work on my pc (mac) it says that bin/sh -c or something isn't found. How ever when i run the windows exec, it will work fine.
    Last edited by Hoodz; 12-30-2015 at 08:17 AM.

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

    Default

    Quote Originally Posted by hoodz View Post
    @Brandon;

    Code:
     application = runtime.exec(new String[]{ "/bin/sh", "-c", commands.toString() });
    Doesn't seem to work on my pc (mac) it says that bin/sh -c or something isn't find. How ever when i run the windows exec, it will work fine.
    I use OSX as well. El Capitan 10.11.2. You could always use the same one from your current bot.
    I am Ggzz..
    Hackintosher

  12. #87
    Join Date
    Dec 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Quoted
    44 Post(s)

    Default

    I don't understand, I can load the rs3 client fine, but I can't load the osrs client. The program just runs and nothing starts, the ClientApplet Constructor was taking in (String root, String params, int Width, int Height), but the object created in Main.Java only use 3 parameters, (doesn't have anything for String params), so I just added "" as the input for params.

    edit: also i am running this in eclipse. I am not sure displayFrame ever runs.

    OK it works now,
    //new ClientApplet("http://oldschool1.runescape.com", 765, 503);
    displayFrame("http://oldschool1.runescape.com", 765, 503);
    Instead of new client, change to displayFrame
    Last edited by Grunt; 01-01-2016 at 07:23 PM.

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

    Default

    Quote Originally Posted by Grunt View Post
    I don't understand, I can load the rs3 client fine, but I can't load the osrs client. The program just runs and nothing starts, the ClientApplet Constructor was taking in (String root, String params, int Width, int Height), but the object created in Main.Java only use 3 parameters, (doesn't have anything for String params), so I just added "" as the input for params.

    edit: also i am running this in eclipse. I am not sure displayFrame ever runs.

    OK it works now,


    Instead of new client, change to displayFrame


    The ClientApplet class has the constructor: ClientApplet(String world, int width, int height);


    OSRS: new ClientApplet("http://oldschool.runescape.com", 765, 553);
    RS3: new ClientApplet("http://runescape.com", 800, 600);
    I am Ggzz..
    Hackintosher

  14. #89
    Join Date
    Dec 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Quoted
    44 Post(s)

    Default

    Not on the original post, but scrolling down there is some code for old school. params is set to null when the object client is instanced in displayFrame method, although the original code instanced a clientApplet object instead of calling displayFrame.

    public ClientApplet(String root, String params, int Width, int Height) {
    It's great to see you still taking an interest, thanks for helping out.
    Last edited by Grunt; 01-01-2016 at 08:19 PM.

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

    Default

    Quote Originally Posted by Grunt View Post
    Not on the original post, but scrolling down there is some code for old school. params is set to null when the object client is instanced in displayFrame method, although the original code instanced a clientApplet object instead of calling displayFrame.

    It's great to see you still taking an interest, thanks for helping out.
    Thanks



    Yeah ShatterHand's post is from the old tutorial that parses the HTML file (like SMART). That requires root + params. It's not just for old school but for RS3 as well. However, the code on the OP does not require that as it loads the client like the official client instead of like the browser.
    I am Ggzz..
    Hackintosher

  16. #91
    Join Date
    Mar 2012
    Posts
    107
    Mentioned
    2 Post(s)
    Quoted
    49 Post(s)

    Default

    I went through this whole thing, everything worked out, of course. I'll be honest though I've got a lot to learn. Great tutorial!

  17. #92
    Join Date
    Dec 2008
    Posts
    135
    Mentioned
    0 Post(s)
    Quoted
    44 Post(s)

    Default

    Sorry my knowledge of java is pretty basic. But I am really curious how is the canvas objected created? And why not create a new class that inherits from the canvas class, rather than using xboot?

  18. #93
    Join Date
    Jan 2016
    Posts
    10
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default How to add a screenshot functionality to my applet?

    Quote Originally Posted by Brandon View Post
    Updated the tutorial. Completely brand new. Massive overhaul of programming patterns.


    New:
    Loads the game like the Official RS client (Both OSRS and RS3).
    HTTPSocket class simplifies the loader.
    ClientApplet is MUCH simpler.
    Uses Observer Pattern (PaintListener) for drawing.
    Uses BootLoader to override the Canvas.
    Uses Event Multi-Casting/Chaining.
    Uses IntelliJ IDE.
    Better drawing.
    Fixed canvas notifications.
    Code is better over-all.

    Noticed that you updated the tutorial when I had a problem implementing a screenshotting feature in my loader that was based off of your old tutorial. I'm working on making my own color-bot. I don't want to take the time to learn ASM so I wrote my own OSRS-dedicated text recognition library (very fast, and lightweight as the RS characters are only like 5 pixels tall) and send mouse input events directly to the applet instead of reflection and code injection.

    I want to run multiple accounts at once in tabs, so instead of Java Robot (which grabs the screen pixels) I was trying to grab the applet's screen by calling the paint() method on a buffered image via Graphics2D. Obviously, like you say in the comment I'm replying to, the applet doesn't draw like a regular applet does and I figured that out the hard way.

    How can I screenshot the applet without java Robot so I can run my color based scripts on a JTabbedPane with multiple accounts? In other words, how does the applet draw? BTW thanks for all your work so far, I love it!

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

    Default

    Quote Originally Posted by Grunt View Post
    Sorry my knowledge of java is pretty basic. But I am really curious how is the canvas objected created? And why not create a new class that inherits from the canvas class, rather than using xboot?
    Because RS has no idea about the class inheriting from the Canvas class. If you do that, then you have to use reflection or injection to manually set the Canvas in the client.

    However, if you just boot the Canvas class, the client loads it. The rule is that the system can only have one definition of such a class. If you tell the system, hey, use my class, any time the game creates a Canvas, it will use the one you have provided instead.

    ----

    @prest0g; You have a Canvas and you have getGraphics. You also have a paintListener. You can just have the canvas draw onto your bufferedImage. OR you can add a Listener to it and have the listener call some function with the GraphicsContext and do the screenshot through that.

    I don't understand what issue you are having. As for how the applet draws, it double buffers but this doesn't matter, unless you're drawing ON the applet. If it's just a screenshot then just snapshot the graphics context when the applet attempts to draw.
    I am Ggzz..
    Hackintosher

  20. #95
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Been messing around with simple communication without sockets or anything just shared memory, seems to work quite well. Could all be done in Lape with a simple plugin exporting (CreateFileMapping, MapViewOfFile).
    Uhh... hopefully without coming across snarky... what's the point in this?
    If I understand what's going on I think it's really neat, but I doubt I do as I can't really think of any benefits this has aside from being a cool project...

  21. #96
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by honeyhoney View Post
    Uhh... hopefully without coming across snarky... what's the point in this?
    If I understand what's going on I think it's really neat, but I doubt I do as I can't really think of any benefits this has aside from being a cool project...
    Sure I did it for fun / didn't want to look up socket/jni shit, but it's still a legit communication method.

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

    Default

    Quote Originally Posted by honeyhoney View Post
    Uhh... hopefully without coming across snarky... what's the point in this?
    If I understand what's going on I think it's really neat, but I doubt I do as I can't really think of any benefits this has aside from being a cool project...

    That's how SMART works. He was messing around with making Simba able to communicate with his bot.
    I am Ggzz..
    Hackintosher

  23. #98
    Join Date
    Dec 2007
    Posts
    289
    Mentioned
    4 Post(s)
    Quoted
    86 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Sure I did it for fun / didn't want to look up socket/jni shit, but it's still a legit communication method.
    Haha awesome!

    Quote Originally Posted by Brandon View Post
    That's how SMART works. He was messing around with making Simba able to communicate with his bot.
    Had no idea that was how SMART worked. Sweet
    I've never actually looked at how SMART does anything for that matter. I don't personally use it so I've always stuck to trawling the Simba and SRL repos. I'll surely check out the SMART repo now

    ---

    Cheers for the swift responses lads!

  24. #99
    Join Date
    Jan 2016
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Nice guide, had fun messing around with it while I was bored. It got me interested a little bit.

    What would technically be the next step in customizing your client? Say for instance I wanted to display usernames above heads, what sort of process would that take?

    Sort of a noob, sorry if thats asking alot.

  25. #100
    Join Date
    Jan 2016
    Posts
    10
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Thanks, I think I figured it out. It was the stupidest mistake ever. I migrated my project to NetBeans just because that's what i'm used to using, and then I just cut and pasted the configuration for the -Xbootclasspath JVM arg and ist was still set to the old IntelliJ Eos.jar. So basically every time I ran my project it was starting the same old loader that I had made in IntelliJ with no features. I was about ready to rip my hair out because nothing was working and I thought it had to do with the BootLoader (I've never done anything with a bootloader before). But now it's pretty simple! Thanks.

Page 4 of 6 FirstFirst ... 23456 LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 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
  •