Problem solved
If someone ever should've trouble with something like this:
...
file_delete("temp0.jpg");
file_for_screen("temp.jpg",0);
wait(1);
...
str_cpy(preview,"prev_");
str_for_num(sstate, save_state);
str_cat(preview,sstate);
str_cat(preview,".jpg");
file_delete(preview);
file_rename("temp0.jpg",preview);
file_delete("temp0.jpg");
...
if there is a temp0.jpg file in the save directory i delete it first than i save a screenshot of the current screen into the save folder called temp0.jpg.
... this is where the save menu will be called and where the player can choose where he wants to save his game.
now i build a string which starts with "prev_"
then i add a number which depends on the savestate which was chosen. and then the extension .jpg
"prev_1.jpg" for example.
first, if there is such a file in the savedir, it will be deleted. then i rename my newly captured temp0.jpg file to prev_[savestate].jpg and if the engine should do a mistake with the temp0.jpg file i delet it again at the end.
all what should be left is a screenshot called "prev_[number of the savestate].jpg" which could be used in the game.
cheers
Roxas