|fname||The filename for the screenshot to save|
With this function you can save a screenshot of the game as it currently appears in the game window or browser. The file will be saved to the working directory of the game, which in windows is located at "C:\Users\YOURUSERNAME\AppData\Local\YOURGAMENAME\" This is an image of the whole display region and not just a specific section or view and your are saving out what is being drawn to the back buffer at the time, meaning that depending on where you call the function the results will differ. If you don't want the GUI layer, then you can save the screen before rendering the GUI (ie: in the Draw event), but if you do want GUI elements to be included, then you save after the Draw GUI event. Should you need more control, you should use the function screen_save_part.
screen_save(working_directory + "\Screens\Screen_"+string(num)+".png")
num += 1;
The above code takes a screenshot of the game when the user presses the "S" key. This screen shot is saved to a specific directory and numbered using a variable which is then incremented.