Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- [screenie] (name given to the definition script)
- -- saves a png screenshot if a path is specified else saves screenshot to be used for next save game image!
- -- checks if file exists before saving - loops check until file doesn't exist![better method]
- -- syntax: "createScreenshot(path)" or "createScreenshot(path, {flags=1, clear = true|false})"
- -- ref: http://wiki.visionaire2d.net/index.php?title=CreateScreenshot
- -- declare an incrementing variable (increment the variable by 1 with "count = count +1")
- local count = 0
- -- saves a png screenshot to the screenshot folder with a numer amended to the end based on current count value!
- function save_screenie_to_path()
- local filename = 'screen_' .. count .. '.png'
- local f = io.open('screenshots/' .. filename, 'r')
- -- * --
- if f then
- print('-- * --') -- comment this out if you don't want it!
- print(filename .. ' already exists!') -- comment this out if you don't want it!
- count = count +1
- f:close()
- check_save_screenie()
- else
- createScreenshot('screenshots/' .. filename)
- print('-- * --')
- print(filename .. ' has been saved to the screenshots folder!')
- count = count +1
- end
- end
- -- loops to check if next screenshot_x.png exists else save screenshot to folder!
- function check_save_screenie()
- save_screenie_to_path()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement