Since I couldn’t take screenshots of my game through regular methods, I tried using the built-in functions in the Primitive Drawing behavior to do it, which I just recently discovered. I’ve been playing around with it for a while now and couldn’t find any documentation in the wiki on it, and I still can’t make it work.
I setup a variable to return the current time, and it should create a screenshot, but it’s not. Can someone tell me what I’m doing wrong? I’ve tried not saving in a folder, naming the image instead of using the Time variable, with and without using: + “.png” on the image name, but I just can’t get it to create a screenshot, unless they are going to somewhere else that I couldn’t find.
Regarding the capture screen action, The first option “File where save capture” also works for me if I’m including the file name extension like so: “screenshot.jpg” or “screenshot.bmp” or “screenshot.png”.
It create the screenshot and save it as an image with specified name and extension.
So it could be the problem in your project as you did not include the extension.
I’m not too sure what the second option “Name of the image where capture must be saved” does. It does nothing on my side. It does not create an image, does not overwrite an existing image or extend it name or anything.
But I don’t really know how it supposed to work.
Anyway, by using only the first option and also include the extension with the file name it does works for me.
If you want to include also the date and time in you screenshot name I suggest to do something like this:
It only doesn’t work if I try it in fullscreen. It could be something with my NVidia 3D rendering or something.
The description for the behavior made me think the first one was the folder it’s stored in and the second would be the image name. I guess I was understanding it wrong because I just tried what you said and it works perfectly. Thank you very much.
Is there a way to make it save the screenshots to a different folder? I’d rather they go to somewhere like “~\Pictures\Screenshots” instead of the working directory.
Just create a folder anywhere inside the project folder and put the folder name before the file name using “”:
“Folder\file_name.jpg”
I’m not sure if you can save outside the project folder.
EDIT:\
I have just tried and you can save outside the project folder by using “C:\Folder\file_name.jpg” for example, but I’m not sure how could you dynamically access the Pictures folder of the user and also, screen capture seems like unable to make a folder in case it doesn’t exists, so even if you can access somehow the Pictures folder, you need to create a folder there to store screenshots, but I’m not sure how could you do that using GDevelop
Creating a folder could be done with an install script, creating a directory for settings and game save files along with a folder for screenshots. It’s just a matter of reading and writing to the files in a dynamic path. I tried making my game work with “%AppData%\Digitalhead Games\settings.xml”, but it didn’t work. I figure the same would happen with %UserProfile% or %Pictures%.
Does GDevelop not work with environment variables for file paths?
Do you mean portable between operating systems? If so, it could just be changed to “~/.local/share” for Linux and whatever OSX uses for Mac before compiling under them.
Any chance it could be a new feature for 5.0? It would only need a couple environment variables to be ported, %UserProfile% and %AppData% would be great, but just being able to work with the home directory would be enough for a start.