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
  • Programmatically Switch Tabs or Take Screenshots


    Bot Tom Frag
     Share

    Recommended Posts

    Currently working on a large scale farm deployment. Keep in mind there will be no manual input to the Dreambot client.

    I'm at the point where I need to make a decision as to whether I want to have each client have multiple tabs with accounts (1-3 tabs max due to proxy being on a per-client basis), or if I should launch a separate Dreambot client for each account. I'm trying to maximize the efficiency of each host, and in my mind it's way more efficient to run multiple tabs per client since the client only has to render 1 screen (whichever tab is active), and also the dreambot UI only has to be loaded once per few accounts.

    The issue with having multiple tabs per account is that you can't programmatically switch tabs (or atleast I haven't found a way in the Dreambot CLI). I need to be able to see each account's screen for logging, screenshot and monitoring functionality. But I don't need to see both at the same time, so that resources aren't being wasted.

    Is there any way to interact with the client programmatically to switch tabs or take screenshots? If not, is there any way to remap each tab's rendering to our own source? (like an X11 display server).

    Also in general is there any way to interact with the running Java client? I know we can launch the client from command-line, but can we in any way interact with it once it's launched?

    Thanks.

    Link to comment
    Share on other sites

    Hey,

    It's usually adviced to use one tab per client. But whatever fits your needs the best.

    I just happen to have a function that gets the tab a script is running in. You can then programmatically click the tab button whenever you need to:

    @Override
    public void onStart() {
        final JButton tabButton = TabUtil.getActiveTab();
        new java.util.Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                // Open the tab
                tabButton.doClick();
            }
        }, 5000);
    }

    However, I don't see a reason for you to switch tabs programmatically to capture screenshots. You should be able to use 

    getClient().getCanvasImage()

    to capture the game screen.

    Link to comment
    Share on other sites

    This is awesome thanks, solved both my problems and lets me output to both a VNC server for live viewing as well as logging and taking screenshots!

    Do you know if there's a way to actually access the raw data being rendered of the client itself? Like instead of an getClient().getCanvasImage, have something like getClient().getRenderedOutput() which would be a stream of data sent to the Host OS to be displayed? Would make things even a bit easier and more flexible. I looked in the docs but didn't see anything

    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.