Results 1 to 7 of 7

Thread: Botting with Python

  1. #1
    Join Date
    Feb 2006
    Location
    Berkeley, CA
    Posts
    1,839
    Mentioned
    52 Post(s)
    Quoted
    60 Post(s)

    Default Botting with Python

    Backstory
    I've been botting a bit on a private server that aims to remake pre-osrs runescape just for the sake of nostalgia. I could have gone a very traditional route and setup SMART and Simba the gone through the sheer joy of writing pascal scripts, but for various reasons (including utilizing a similar setup for my real job) I decided to switch things up and use python for automation inside a headless X11 server. I'm sharing here because the techniques should be applicable to OSRS and may benefit someone by having a mostly complete reference.

    Requirements
    • Headless x11 server (or similar for windows)
    • Python3+
    • Jupyter
    • numpy
    • pyautogui
    • pytesseract (and Tesseract itself)

    I'd suggest installing Anaconda and using pip to install the python packages unless they're all in your system package manager.

    Details
    In principle the code is not linux specific, though you'll have to find some way to deal with mouse take over. Virtual machines, RDP, whatever. On linux I use TigreVNC to start a headless x11 server (vncserver) which I can then vnc into or run totally in the background. Inside of your VNC-like-thing, spin up your runescape client of choice along with a Jupyter notebook. You could reorganize the code in my notebook (below) into python scripts and run them manually, but I like to connect to the Jupyter notebook from my primary workspace and control the macros that way as Jupyter is a pretty nice notebook-IDE complete with code hints.

    And that's basically it, you're now ready to run some code.

    Design Choices
    • All images are numpy arrays, no wrappers.
    • Colors are tuples of RGB values (even in images) for clarity.
    • Object finding is done by finding colors in proximity to other colors combined with finding clusters of certain counts.
    • Didn't use opencv for anything - though this would be easy! (I wanted to implement the search algorithms)
    • There is traditional bitmap finding and a homebrew search algorithm similar to opencv template matching (more tailored to RS but a bit slower than the fastest opencv options).
    • Scripts are setup as decision trees that are repeatedly called and expected to take the correct action at any point with no/minimal previous state. This is not a requirement but I find it to be quite robust.



    The Code
    Disclaimer: This is just a teaser not a final product, however for my personal use it's worked quite well. See https://benland.us/files/python-rsps-macros.html for the code and how it looks inside a Jupyter notebook. To run it you'll need to create creds.py in the same directory containing the variables `username` and `password` of the account to login. That won't help you much though because I am not providing the .pngs loaded by the scripts because they're probably useless to anyone else.

    If people have questions I might answer here, otherwise catch me on IRC/Discord.

  2. #2
    Join Date
    Feb 2013
    Location
    The Boonies
    Posts
    201
    Mentioned
    9 Post(s)
    Quoted
    70 Post(s)

    Default

    Hey this is pretty neato! I don't know if I will ever find myself using this, but it's nice to see more ideas coming to the table, and the plethora of activities you've already scripted for. Nice!

  3. #3
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,729
    Mentioned
    192 Post(s)
    Quoted
    1461 Post(s)

    Default

    @BenLand100; can you post some pictures please?

  4. #4
    Join Date
    Feb 2006
    Location
    Berkeley, CA
    Posts
    1,839
    Mentioned
    52 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Hoodz View Post
    @BenLand100; can you post some pictures please?
    Pictures of what? Jupyter looks basically like the the .html in the OP (Jupyter opens in a browser and can export the notebook to a static file)

    Ia7D6zzS.png

    and the client in a vnc windows looks like a client in a vnc window.

  5. #5
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,197
    Mentioned
    112 Post(s)
    Quoted
    1857 Post(s)

    Default

    Seen a lot of this in IRC very nice
    GitLab projects | Simba for Linux | Find me on IRC or Discord | OSRS scripts | Come play ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  6. #6
    Join Date
    Oct 2012
    Posts
    1,242
    Mentioned
    40 Post(s)
    Quoted
    583 Post(s)

    Default

    Thanks for taking the time to write up a thread on this.
    I'm personally not botting rs anymore but you can still get in touch with me via discord. I'm "acow" in the srl discord.

  7. #7
    Join Date
    Mar 2017
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I browsed through your code, and it looks like you've written a ton of functionality! Awesome job!

    Would you be willing to share some of the assets that you've created (screenshots and so forth)?

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
  •