Celestia/Celx Scripting/CELX Lua Methods/CEL command capture
capture
editcapture { type <jpg|png> filename <name> }
Take a screenshot and save it to disk (if allowed by your system).
Notes:
- To avoid overwriting other files (i.e. non-screenshots), the filename is always something like "screenshot-000001.png" or "screenshot-<name>-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.
- 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.
- The limitations which were put in place for security reasons in Celestia version 1.3.2 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 :-(
- 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.
Arguments:
- type <jpg|png>
- Define the filetype (extension) of the screenshot, default is "png"
- Must be one of:
- "png"
- "jpg"
- filename <name>
- A required string which will be used in the entire filename of this screenshot, including the extension.
- This name is restricted to A-z, 0-9 and _ (underscore) with a maximum length of many chars.
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", <name>)
-- OR --
screenshot = celestia:takescreenshot("png", <name>)
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")