Difference between revisions of "Global Command: createScreenshot"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m (Text replacement - "{{toc}}" to "") |
|||
Line 7: | Line 7: | ||
− | + | Create a screenshot to be used for the next savegame or to save into an external folder as a .png file. | |
− | Syntax | + | == Syntax == |
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
− | createScreenshot( | + | createScreenshot(filename, {flags=1, clear}) |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | == Parameters == | |
− | |||
− | |||
− | |||
− | |||
− | + | {| class="ts" | |
− | + | |- | |
− | - | + | ! style="width:15%" | Parameter |
+ | ! style="width:15%" colspan="2" | Type/Structure | ||
+ | ! Description | ||
+ | |- | ||
+ | | filename | ||
+ | | colspan="2" | string | ||
+ | | If specified the screenshot will be saved to the given path. If not specified the screenshot will be used for the next savegame(s), until 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. | ||
+ | |- | ||
+ | | rowspan="2" | flags | ||
+ | | rowspan="2" | table | ||
+ | | flags = 1 | ||
+ | | indicates flags table | ||
+ | |- | ||
+ | | clear (bool) | ||
+ | | If true the screenshot will be cleared. Default value is false. If the screenshot is cleared, savegame screenshots 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:''' Save a screenshot to a folder (if a file with the same name exists, it will be overwritten) | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | -- save to "screenshots" folder as "filename.png" | ||
+ | createScreenshot("screenshots/filename.png") | ||
− | + | -- save to "screenshots" folder with current timestamp as "filename_(date)_(time).png" | |
+ | local time = os.date("%Y-%m-%d_%Hh-%Mm-%Ss") | ||
+ | createScreenshot("screenshots/filename_" .. time .. ".png") | ||
+ | </syntaxhighlight> | ||
− | |||
− | |||
+ | '''Example 2:''' Save a screenshot to use for the next savegame | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | createScreenshot() | ||
+ | </syntaxhighlight> | ||
− | |||
− | + | '''Example 3:''' Clear the previously saved savegame screenshot | |
− | + | <syntaxhighlight lang="lua"> | |
− | + | createScreenshot("", {flags=1, clear = true}) | |
− | + | </syntaxhighlight> | |
− | < | + | {{toc}} |
− | |||
− |
Revision as of 11:34, 2 May 2023
Function History |
---|
Available since v3.7 |
Create a screenshot to be used for the next savegame or to save into an external folder as a .png file.
Syntax
createScreenshot(filename, {flags=1, clear})
Parameters
Parameter | Type/Structure | Description | |
---|---|---|---|
filename | string | If specified the screenshot will be saved to the given path. If not specified the screenshot will be used for the next savegame(s), until 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 | table | flags = 1 | indicates flags table |
clear (bool) | If true the screenshot will be cleared. Default value is false. If the screenshot is cleared, savegame screenshots 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: Save a screenshot to a folder (if a file with the same name exists, it will be overwritten)
-- save to "screenshots" folder as "filename.png"
createScreenshot("screenshots/filename.png")
-- save to "screenshots" folder with current timestamp as "filename_(date)_(time).png"
local time = os.date("%Y-%m-%d_%Hh-%Mm-%Ss")
createScreenshot("screenshots/filename_" .. time .. ".png")
Example 2: Save a screenshot to use for the next savegame
createScreenshot()
Example 3: Clear the previously saved savegame screenshot
createScreenshot("", {flags=1, clear = true})