Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.19

Description

Description:

Takes a screenshot of the current scene.

If VBS is started with the -forceSimul parameter, then screenshots can be taken with the VBS window minimized.

In VBS4 20.1+, since the 2D map is part of the UI, pressing RShift + PrtScn results in a screenshot that is a black screen.

Syntax

Syntax:vbs_screenshot [fileName, fileType, width, height]
Parameters:
  • fileName: String - Name of file to be saved. Can include path, or be left empty for automatic name. Has the following considerations:
    • If illegal characters (see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx) are used in the file name, then no file is created.
    • If the file name is an empty string ("") or ends with "\" or "/", then the folder %USERPROFILE%\My Documents\VBS2\Screenshots (plus, any specified sub-folders) is created, if nonexistent, and a file name is generated from the date information (for example, 2008_4_18_18_0_15_250.tga).
    • If file name starts with "\" or "/", the file is written to %USERPROFILE%\My Documents\VBS2\Screenshots (screenshots folder, or any referred sub-folders, must exist already).
    • If the file name is present and does not end with "\" or "/", then it is considered an absolute file path, and is written to that location (destination folder must already).
    • The file extension is automatically added to the file name, according to the specified fileType.
  • fileType: String - One of the following:
    • In VBS3: Can be: BMP, JPG, TGA, PNG, DDS, PPM, DIB, HDR, PFM. If not present or unknown, then JPG is used.
    • In VBS4 20.1+: Can be: BMP, JPG, PNG, DDS, TIFF, WMP. If not present or unknown, then JPG is used.
  • width (VBS 1.30+) (ignored in VBS4 20.1): Number - Width of saved screenshot (optional, default: 0 == current resolution). If width size definitions are used, be aware that the screenshot is only resized. It is not possible to increase the precision beyond the current screen resolution.
  • height (VBS 1.30+) (ignored in VBS4 20.1): Number - Height of saved screenshot (optional, default: 0 == current resolution). If height size definitions are used, be aware that the screenshot is only resized. It is not possible to increase the precision beyond the current screen resolution.
Return Value:Nothing

Examples

Examples:
vbs_screenshot ["","jpg",256,256]
Saves screenshot with default name to %USERPROFILE%\My Documents\VBS2\Screenshots

vbs_screenshot ["file","jpg",256,256]
Saves "file.jpg" to the VBS2 installation folder

vbs_screenshot ["\file","jpg",256,256]
Saves "file.jpg" to %USERPROFILE%\My Documents\VBS2\Screenshots

vbs_screenshot ["\folderName\file","jpg",256,256]
Saves "file.jpg" to %USERPROFILE%\My Documents\VBS2\Screenshots\folderName

vbs_screenshot ["\folderName\","jpg",256,256]
Saves screenshot with default name to %USERPROFILE%\My Documents\VBS2\Screenshots\folderName

Additional Information

See also: captureStart
Multiplayer:
Problems:

Notes