{
do
{
//check to see if there is already a png
if (file_exists(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png"))
{
//if there is add one to the number until there isnt one
num += 1;
}
}
until (!file_exists(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png"))
}
if (!file_exists(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png"))
{
//save the png
screen_save(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png")
//add to the number for a future png
show_message("saved"+string(num))
num += 1;
}
I wonder who your alt account is...Thanks for sharin your views.
Its apart of the Do function as shown in the manual https://docs.yoyogames.com/source/dadiospice/002_reference/001_gml language overview/401_10_do.htmlEDIT: Yeah that first curly brace threw up an error in the code editor lol. I removed it and it LOOKS fine so far, haven't tested in game.
in a create event set num = 0; or in object variablesEDIT2: Just tested, threw up an error because "num" wasn't defined. Though setting it to 1 in the create event did fix this, but then when I went to take the screenshot it saved 2 of them for some reason, probably because I need to set it to 1. Is that right? Let me know if it's not.
make sure its on a key_release event, other then that it shouldnt make two of them unless youve pressed it twice before one png was done saving, it takes a second to save the actual png after the code runsEDIT3: Just set the value to 0 on NUM, still creates two screenshots per keypress.
No problem! I coded it myself because I wanted a screenshot function, and then realized without any special code it will just overwrite the same png over and over.EDIT4: Also just found the screenshots folder, it works really well, thank you!
{ //<-- apart of the do function as defined in the manual
do
{
//check to see if there is already a png, checks to see if theres a file named the value of num if there is up num until there isnt
if (file_exists(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png"))
{
//if there is add one to the number until there isnt one
num += 1;
}
}
until (!file_exists(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png"))
//it does this check until it can create a file with the value of num
}
//This is it acutally saving it
if (!file_exists(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png"))
{
//save the png
screen_save(working_directory + "\\ScreenShots\\Screen_"+string(num)+".png")
//add to the number for a future png
show_message("saved"+string(num))
num += 1;
}