SHOW:
|
|
- or go back to the newest paste.
| 1 | -- [screenie] (name given to the definition script) | |
| 2 | -- saves a png screenshot if a path is specified else saves screenshot to be used for next save game image! | |
| 3 | -- checks if file exists before saving - loops check until file doesn't exist![better method] | |
| 4 | -- syntax: "createScreenshot(path)" or "createScreenshot(path, {flags=1, clear = true|false})"
| |
| 5 | -- ref: http://wiki.visionaire2d.net/index.php?title=CreateScreenshot | |
| 6 | ||
| 7 | -- declare an incrementing variable (increment the variable by 1 with "count = count +1") | |
| 8 | local count = 0 | |
| 9 | - | -- check if any screenshots already exist + set count value |
| 9 | + | |
| 10 | - | function get_screen_amt() |
| 10 | + | |
| 11 | function save_screenie_to_path() | |
| 12 | local filename = 'screen_' .. count .. '.png' | |
| 13 | local f = io.open('screenshots/' .. filename, 'r')
| |
| 14 | -- * -- | |
| 15 | if f then | |
| 16 | - | check_cond() -- loops the query until file does not exist! |
| 16 | + | print('-- * --') -- comment this out if you don't want it!
|
| 17 | print(filename .. ' already exists!') -- comment this out if you don't want it! | |
| 18 | - | else |
| 18 | + | |
| 19 | - | if count == 1 then local screen_amt = count -1 |
| 19 | + | |
| 20 | - | print('-- * --')
|
| 20 | + | check_save_screenie() |
| 21 | - | print('there are currently ' .. screen_amt .. ' saved screenshots!')
|
| 21 | + | else |
| 22 | - | print('next screenshot will be screen_' .. count .. '.png')
|
| 22 | + | |
| 23 | - | end |
| 23 | + | print('-- * --')
|
| 24 | - | if count > 1 then local screen_amt = count +1 |
| 24 | + | |
| 25 | - | print('-- * --')
|
| 25 | + | |
| 26 | - | print('there are currently ' .. screen_amt .. ' saved screenshots!')
|
| 26 | + | |
| 27 | - | print('next screenshot will be screen_' .. count .. '.png')
|
| 27 | + | |
| 28 | - | end |
| 28 | + | |
| 29 | -- loops to check if next screenshot_x.png exists else save screenshot to folder! | |
| 30 | function check_save_screenie() | |
| 31 | save_screenie_to_path() | |
| 32 | - | -- execute this in "Game properties" > "At begin start following action" > "Start Action" -- starts loop to check if any screenshots exist & returns amount! |
| 32 | + |