Skip to main content

The "vngen_file_save" Function

Syntax#

vngen_file_save(filename, [encrypt]);
ArgumentTypeDescription
filenamestringThe complete filename of the target save file, including path and extension
[encrypt]booleanOptional: Enables or disables encrypting save data to prevent external modification (Default: enabled)

Description#

Saves the current room, VNgen object, room coordinates, Quantum event, option choices, style inheritance, paragraph alignment, and language data to a file with optional encryption (enabled by default). The resulting file will be located in the current working directory (on Windows, %localappdata% by default). This script will also return 'true' or 'false' depending on whether the save operation was successful.

Note that due to GameMaker Studio being sandboxed, save files cannot be written to an external location on the hard drive by default. In GameMaker Studio 2, this behavior can be disabled in Game Settings, allowing files to be written anywhere (applies to desktop platforms only).

To save data without automatically writing it to a file, see the vngen_file_save_map function.

Example#

vngen_file_save(working_directory + "save.dat");
vngen_file_save(working_directory + "save.dat", false);