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
  • Is there a screenshot method in the api?


    RetroBot
     Share

    Recommended Posts

    I browsed the api quick and couldn't find if theres a screenshot method in the api. Does anyone know if there's one available or is it not in the current api?

    Link to comment
    Share on other sites

    I browsed the api quick and couldn't find if theres a screenshot method in the api. Does anyone know if there's one available or is it not in the current api?

     

    Not one built into the api, just use native  java way of screenshotting. Here's my method -- it will create the folder with script name

    	/**
    	 * Takes a screenshot and writes the image as PNG to the dreambot folder
    	 * inside of a folder as the name of the script
    	 */
    	public void screenshot() {
    		File file = new File(getManifest().name());
    		BufferedImage image = getClient().getCanvasImage();
    		try {
    			if (!file.exists() || !file.isDirectory()) {
    				log("Creating script folder");
    				file.mkdir();
    			}
    			log("Saving screenshot...");
    			ImageIO.write(image, "png",
    					new File(String.format("%s/%s.png", getManifest().name(), System.currentTimeMillis())));
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    Link to comment
    Share on other sites

     

    Not one built into the api, just use native  java way of screenshotting. Here's my method -- it will create the folder with script name

    	/**
    	 * Takes a screenshot and writes the image as PNG to the dreambot folder
    	 * inside of a folder as the name of the script
    	 */
    	public void screenshot() {
    		File file = new File(getManifest().name());
    		BufferedImage image = getClient().getCanvasImage();
    		try {
    			if (!file.exists() || !file.isDirectory()) {
    				log("Creating script folder");
    				file.mkdir();
    			}
    			log("Saving screenshot...");
    			ImageIO.write(image, "png",
    					new File(String.format("%s/%s.png", getManifest().name(), System.currentTimeMillis())));
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    

    Thanks!

    Link to comment
    Share on other sites

    • 7 months later...
    • 2 years later...

    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.