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
  • Jython Wrapper for Dreambot API


    klorox

    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.