In this current project I have it set up so F11 takes a screen shot. My SAVEDIR is set to "data" and all screen shots are automatically saved in there as that's how 3DGS works. Since I have other things in the data folder (settings files, etc.) that are also saved there by the engine, I want to have the screen shots in their own folder, like "screenshots".
I am using the following code. Basically it takes a sequentially numbered screen shot, puts it in the data folder, then copies it into the screenshots folder (I haven't written the part to delete the original yet; that's coming).
It all works great except that the resulting file in the screenshots folder is only 0k in file size. Something is going wrong somewhere and I can't seem to figure out where.
Can anyone spot the problem?
Thanks!
var shotfilehandle;
var shotfilehandle1;
var theShotNum;
STRING theScreenShot = "#64";
STRING theNewShot = "#64";
STRING theShotNumString ;
action take_shot(){
str_cpy(theScreenShot, "image_");
str_cpy(theNewShot, "screenshots\\");
shotfilehandle1 = file_open_read("shots.num");
theShotNum = file_var_read(shotfilehandle1);
file_close(shotfilehandle1);
theShotNum += 1;
wait(1);
snd_play(camera_click,100,0);
wait(1);
str_for_num(theShotNumString,theShotNum);
str_cat(theScreenShot, theShotNumString);
str_cat(theScreenShot, ".bmp");
str_cat(theNewShot, theScreenShot);
file_for_screen("image_.bmp",theShotNum); // saves a screenshot with a sequential suffix
shotfilehandle = file_open_write("shots.num");
file_var_write (shotfilehandle, theShotNum);
file_close(shotfilehandle);
file_cpy (theNewShot, theScreenShot);
str_cpy(theScreenShot, "image_");
str_cpy(theNewShot, "screenshots\\");
wait(1);
}