Celestia/Celx Scripting/CELX Lua Methods/CEL command capture

capture
capture { type  filename  } 

Take a screenshot and save it to disk (if allowed by your system).

Notes:
 * 1) To avoid overwriting other files (i.e. non-screenshots), the filename is always something like "screenshot-000001.png" or "screenshot--000001.png", where the number is counting from 1 on for each time you start a script, and name can be chosen by the script - see above.
 * 2) Taking screenshots takes some time, but any flash, print, goto or center command in progress won't wait. This may change in future, but OTOH nobody has complained yet.
 * 3) The limitations which were put in place for security reasons in Celestia version  have been somewhat lifted in Celestia version 1.4.0, because CEL-scripting also offers less secure screenshot taking. This means that security can be circumvented by using a CEL script anyway :-(
 * 4) However screenshots still are written to the directory set by the config option "ScriptScreenshotDirectory" in the celestia.cfg file, defaulting to the main celestia directory (typically something like C:\Program Files\Celestia\), depending on your system, Celestia might not be allowed to write files there.

CELX equivalent:

Based on the celestia:takescreenshot method.


 * Take a screenshot and save it to disk (if allowed by your system). Return boolean true if successful.

screenshot = celestia:takescreenshot("jpg", )

-- OR --

screenshot = celestia:takescreenshot("png", )

Example: Take a screenshot of the actual scene and store it in filename: "screenshot-test-000001.jpg". If this filename already exist, the number-part will be incremented until the first free number.

CEL:

capture { type "jpg" filename "test" }

CELX:

screenshot = celestia:takescreenshot("jpg", "test")

Back to CEL command index