Difference between revisions of "CreateScreenshot"
From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: | Line 1: | ||
− | + | ==createScreenshot== | |
− | |||
− | |||
− | |||
− | |||
+ | <div class="command-min-version-info">Available since: <span class="command-min-version">v3.7</span></div> | ||
− | + | <div class="command-doc">Creates a new screenshot which is either used for a savegame or stored to a file.</div> | |
+ | Lua Syntax: | ||
+ | <pre class="command-syntax">createScreenshot( [saveTo], {flags=1, | ||
+ | clear = true|false})</pre> | ||
+ | ===Arguments=== | ||
+ | ====saveTo==== | ||
+ | :'''"string"''' - If specified the screenshot will be saved to the given path. Otherwise the screenshot will be used for the next savegame(s), as long as a new screenshot is created or the current screenshot is cleared. If a screenshot for a savegame was created before it will be overwritten by the new screenshot. | ||
+ | ===Flags=== | ||
+ | ====clr/clear==== | ||
− | + | :If true the screenshot will be cleared. Default value is false. If the screenshot is cleared it will be generated automatically by the engine again, everytime the scene is changed from a playable scene to a menu. | |
+ | ===Return Values=== | ||
+ | None. | ||
+ | ===Examples=== | ||
+ | Example 1: basic save screenshot (if a file with the same name exists it will be automatically overwritten) | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | createScreenshot("filename" | + | -- save to "screenshots" folder as "filename.png" |
− | + | createScreenshot("screenshots/filename.png") | |
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Example 2: save screenshot with both file name + time stamp | |
− | Example 2: save screenshot | ||
<syntaxhighlight> | <syntaxhighlight> | ||
− | -- add this as an execute script action inside of a key input; change | + | -- add this as an execute script action inside of a key input; change filename to whatever you like |
− | -- save to "screenshots" folder as "filename_(date)_(time).png | + | -- save to "screenshots" folder as "filename_(date)_(time).png |
local time = os.date("%Y-%m-%d_%Hh-%Mm-%Ss") | local time = os.date("%Y-%m-%d_%Hh-%Mm-%Ss") | ||
createScreenshot("screenshots/filename_" .. time .. ".png") | createScreenshot("screenshots/filename_" .. time .. ".png") | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 17:11, 22 November 2013
Contents
createScreenshot
Available since: v3.7
Creates a new screenshot which is either used for a savegame or stored to a file.
Lua Syntax:
createScreenshot( [saveTo], {flags=1, clear = true|false})
Arguments
saveTo
- "string" - If specified the screenshot will be saved to the given path. Otherwise the screenshot will be used for the next savegame(s), as long as a new screenshot is created or the current screenshot is cleared. If a screenshot for a savegame was created before it will be overwritten by the new screenshot.
Flags
clr/clear
- If true the screenshot will be cleared. Default value is false. If the screenshot is cleared it will be generated automatically by the engine again, everytime the scene is changed from a playable scene to a menu.
Return Values
None.
Examples
Example 1: basic save screenshot (if a file with the same name exists it will be automatically overwritten)
-- save to "screenshots" folder as "filename.png"
createScreenshot("screenshots/filename.png")
Example 2: save screenshot with both file name + time stamp
-- add this as an execute script action inside of a key input; change filename to whatever you like
-- save to "screenshots" folder as "filename_(date)_(time).png
local time = os.date("%Y-%m-%d_%Hh-%Mm-%Ss")
createScreenshot("screenshots/filename_" .. time .. ".png")