Scorpius 144 Share Posted March 6, 2018 Since the only snippet I found on the forums was faulty and bugged, I made a few tweaks to make it work as intended. use zScreenshot() function anywhere in your code and it will create a screenshot inside your Dreambot's folder. Look for a folder with your script's name and you should find your screenshot inside it. Note: @Dinh is demi-god (Not anymore, his solution doesn't work with fresh start) Edit: just in case that lovely color is gone Edit again: jk @Dinh is demi-god Edit: one more time for rainbow @Dinh NOTE: This will not work if you run Dreambot using your root user in linux... probably if you have DBLauncher.jar in your downloads folder on windows as well (Not entirely sure) Original screenshot code taken from: https://dreambot.org/forums/index.php/topic/10870-is-there-a-screenshot-method-in-the-api/?do=findComment&comment=102126 public void zScreenshot() { Path dreambot_folder = Paths.get(System.getProperty("scripts.path")).getParent(); String file_name = getManifest().name().replace(' ', '_'); String script_save_directory = dreambot_folder.toString() + file_name; File file = new File(script_save_directory); 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", script_save_directory, System.currentTimeMillis()))); } catch (Exception e) { zLogError(e); } } public void zLogError(Throwable e) { String error_string = ""; if (e.toString() != null) { error_string += "[ERROR]: " + e.toString() + "\n"; } if (e.getStackTrace() != null) { for (StackTraceElement element : e.getStackTrace()) { error_string += "[StackTrace]: " + element.toString() + "\n"; } } log(error_string); } Link to comment Share on other sites More sharing options...
hexagon 18 Share Posted March 6, 2018 L O L Link to comment Share on other sites More sharing options...
Eclipseop 194 Share Posted March 6, 2018 L O L L L Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted March 6, 2018 L O LL L String dreambot_folder = System.getProperty("user.home") + System.lineSeparator() + "Dreambot" Link to comment Share on other sites More sharing options...
Scorpius 144 Author Share Posted March 6, 2018 String dreambot_folder = System.getProperty("user.home") + System.lineSeparator() + "Dreambot" Updated Link to comment Share on other sites More sharing options...
Banker 175 Share Posted March 6, 2018 this is zUseless Link to comment Share on other sites More sharing options...
Neffarion 486 Share Posted March 6, 2018 wont work correctly with fresh start Link to comment Share on other sites More sharing options...
LogicSoup 92 Share Posted March 6, 2018 pls make it wokr with zFreshStart Link to comment Share on other sites More sharing options...
dQw4w9WgXcQ 184 Share Posted March 6, 2018 what the fuck Link to comment Share on other sites More sharing options...
Scorpius 144 Author Share Posted March 6, 2018 wont work correctly with fresh start elaborate? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.