Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Jython Wrapper for Dreambot API


    klorox
     Share

    Recommended Posts

    Hello, I am trying to access the dreambot API using Jython. I much prefer the python syntax and I would like to create a python script that accesses the dreambot API but allows me to use python. So far I have successfully imported the API but nothing seems to be working as planned. I'm wondering if this is even possible. When trying to make the API tell me what world I'm in I get a null pointer exception presumably because it isn't finding the client. If this is the problem, how can I make my script find the client?

    Here's my current code:
     

    import os,glob,sys
            
    from org.dreambot.api import Client
    from org.dreambot.core import Instance
    
    directories=['C:\\Users\\klorox\\Desktop\\jython-test\\'] # Other directories can be added
    
    for directory in directories:
        for jar in glob.glob(os.path.join(directory,'*.jar')):
            sys.path.append(jar)
    
    
    currentClient = Client.getClient() 
    
    currentinstance = Instance.getInstance()
    print(currentinstance)
    print(currentClient)
    print(Client.getCurrentWorld(currentClient))

    The current instance and current client methods return "None" so I am assuming it's not finding the client I am running that is logged in (All I did was execute dreambot.jar and hope that it would find the process or something but apparently not). I'm guessing I need to import the client in my script and somehow execute the client then point that instance of the client at whatever methods I am using. Is this correct or can someone please help me clarify what exactly the problem is? I plan on releasing the python wrapper if I can get it working as I have not seen anything like it written yet which really just adds to the difficulty here as there are no examples to build upon.
     

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.