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!
- -- 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
- -- check if any screenshots already exist + set count value
- function get_screen_amt()
- local filename = 'screen_' .. count .. '.png'
- local f = io.open('screenshots/' .. filename, 'r')
- -- * --
- if f then
- count = count +1
- check_cond() -- loops the query until file does not exist!
- f:close()
- else
- if count == 1 then local screen_amt = count -1
- print('-- * --')
- print('there are currently ' .. screen_amt .. ' saved screenshots!')
- print('next screenshot will be screen_' .. count .. '.png')
- end
- if count > 1 then local screen_amt = count +1
- print('-- * --')
- print('there are currently ' .. screen_amt .. ' saved screenshots!')
- print('next screenshot will be screen_' .. count .. '.png')
- end
- end
- end
- -- execute this in "Game properties" > "At begin start following action" > "Start Action" -- starts loop to check if any screenshots exist & returns amount!
- function check_cond()
- get_screen_amt()
- end
- -- 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'
- createScreenshot('screenshots/' .. filename)
- print(filename .. ' has been saved to the screenshots folder!')
- count = count +1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement