Results 1 to 14 of 14

Thread: [py] Python, anyone? SMART dll wrappers

  1. #1
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default [py] Python, anyone? SMART dll wrappers

    I got (re)interested in learning some python recently.

    I put together some rough wrappers around the smart DLL so you can play runescape from python. Well... you can launch it anyway!

    I don't know if anyone else is interested in messing with it but I figured I would post the code.

    USAGE:
    • Install python 3.4
    • Put the two python files somewhere
    • Edit SMARTJAVAPATH and SMARTPLUGINPATH in smart.py.
    • SMARTPLUGINPATH can point at your simba plugins folder or a copy of the DLLs and smart.jar
    • Use something to launch smart.py

    Something's up with the structure stuff since you can't use the width, etc, from the smartclient pointer. I think most of the functions will work ok though.

    I made no attempt so far at unpeeling the screen data from the pointers returned.



    smartpy.zip

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

    Default

    Were you aware that Ben has these tests on git?

  3. #3
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    Were you aware that Ben has these tests on git?
    I am, and his are old and broken and don't match the dll.

  4. #4
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

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

    Default

    Good stuff..

    As for:

    Something's up with the structure stuff since you can't use the width, etc, from the smartclient pointer
    It's mapped memory.. You cannot access it like regular memory. You need to map it (mmap) to access it and a good reason to do so (because if SMART's internals change, your mapped model would be invalid)..


    Slight modifications to the script on SMART's github works (just add the plugins parameter to spawn, use the proper quotes, and add the target parameter to every function).
    Last edited by Brandon; 08-19-2015 at 03:32 AM.
    I am Ggzz..
    Hackintosher

  6. #6
    Join Date
    Jan 2013
    Posts
    146
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    This is awesome, I've been trying to learn python, but also like to script bots. with this I could use python to write scripts?

    I'm really interested in learning about this.

    Im Back... Previously known as Megaleech
    [Herbalife]

  7. #7
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by Saint//+ View Post
    This is awesome, I've been trying to learn python, but also like to script bots. with this I could use python to write scripts?

    I'm really interested in learning about this.
    If this were finished up and working you could control the SMART mouse, keyboard, and screen from your python script.

    The posted code is a rough first pass at being able to talk to the dll. I only tested a little of it so far. I didn't want to spend a lot of time on it if no one cared.

    A lot of the base type and color functionality we're used to is in simba. You would have to write your own findcolorXXX(). Or try to link up to the ogl dlls and use that sort of functionality.

  8. #8
    Join Date
    Jan 2013
    Posts
    146
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    If this were finished up and working you could control the SMART mouse, keyboard, and screen from your python script.

    The posted code is a rough first pass at being able to talk to the dll. I only tested a little of it so far. I didn't want to spend a lot of time on it if no one cared.

    A lot of the base type and color functionality we're used to is in simba. You would have to write your own findcolorXXX(). Or try to link up to the ogl dlls and use that sort of functionality.
    Im way into this! anything i can do to help let me know.

    Code:
    client cannot be launched
    SMART: Located 0 clients
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    SMART: Failed to pair - No client by that ID
    Traceback (most recent call last):
      File "smart.py", line 160, in <module>
        s.launchRunescape()
      File "smart.py", line 31, in launchRunescape
        print("spawnClient returned ", self.smartCli.contents.width, " ", self.smartCli.contents.height)
    ValueError: NULL pointer access

    This is what I keep running into trying to launch?

    It looks like it tries to spawn the clent, but as soon as its starting its crashing.

    Im Back... Previously known as Megaleech
    [Herbalife]

  9. #9
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by Saint//+ View Post
    Traceback (most recent call last):
    File "smart.py", line 160, in <module>
    s.launchRunescape()
    File "smart.py", line 31, in launchRunescape
    print("spawnClient returned ", self.smartCli.contents.width, " ", self.smartCli.contents.height)
    ValueError: NULL pointer access
    [/code]


    This is what I keep running into trying to launch?

    It looks like it tries to spawn the clent, but as soon as its starting its crashing.
    Launching smart failed, and I was printing the results without checking them on line 30.

    Did smart open up? Did runescape load?

    Check all the constants at the top of smart.py. My plugin folder has all the dlls in it (d3d9, dxi, glx, opengl32, libsmartXXX and smart.jar.

  10. #10
    Join Date
    Mar 2014
    Posts
    205
    Mentioned
    4 Post(s)
    Quoted
    116 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    A lot of the base type and color functionality we're used to is in simba. You would have to write your own findcolorXXX(). Or try to link up to the ogl dlls and use that sort of functionality.
    This wouldn't be too complex though, would it? As long as we have the ability to pull the same information Simba does (which, while I'm not particularly well versed in Python, seems like it should definitely be possible) we already have all the logic set up. It would be as simple as porting everything over. Not a small task by any means, but far simpler than rewriting everything.

  11. #11
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    pyMML and CMML were attempts at using libmml(https://github.com/MerlijnWajer/Simb...rojects/libmml)
    Check them out.

  12. #12
    Join Date
    Jan 2013
    Posts
    146
    Mentioned
    0 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    Launching smart failed, and I was printing the results without checking them on line 30.

    Did smart open up? Did runescape load?

    Check all the constants at the top of smart.py. My plugin folder has all the dlls in it (d3d9, dxi, glx, opengl32, libsmartXXX and smart.jar.
    I have all of them except dxi and glx.

    It doesn't launch anything. a command prompt pops up for a split second but exits out very quickly.

    also, I'm not running this on native windows if that makes a difference. I've tried running through a VM with windows 10 and also through a bootcamp partition running windows 7.

    edit:
    I figured it out. I was trying to run it with 64bit java instead of 32bit.

    Im Back... Previously known as Megaleech
    [Herbalife]

  13. #13
    Join Date
    Feb 2012
    Location
    Portugal
    Posts
    91
    Mentioned
    3 Post(s)
    Quoted
    41 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    python 3.4? no plss
    Why is that?

  14. #14
    Join Date
    Dec 2015
    Location
    Toronto, Ontario
    Posts
    85
    Mentioned
    2 Post(s)
    Quoted
    21 Post(s)

    Default

    Nice post. I was thinking about getting into python rs coding. Is there any other information about it?

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
  •