Skip to main content

The "vngen_file_load_map" Function

Syntax#

vngen_file_load_map(filename/ds_map);
ArgumentTypeDescription
filename/ds_mapstring/ds_mapThe complete filename of the target save file, including path and extension, OR a ds_map generated by vngen_file_save_map

Description#

Reads basic VNgen data from the target file or ds_map (if it exists), then returns a ds_map populated with all saved properties, or undefined if saved properties do not exist. Encryption is automatically detected and decrypted if found.

The returned map will contain the following key/value pairs which can be accessed using either the built-in ds_map_find_value function or the ds_map[? "key"] accessor:

KeyValue Description
"room"The active room index (not name) when the save file was created
"object"The object index (not name) of the saved VNgen object
"x"The saved object horizontal room position
"y"The saved object vertical room position
"event"The saved VNgen event index (not label)
"halign_text"The saved global VNgen text alignment setting
"halign_label"The saved global VNgen label alignment setting
"lineheight_text"The saved global VNgen text lineheight setting
"lineheight_label"The saved global VNgen label lineheight setting
"auto_type"The saved auto mode behavior setting
"lang_text"The saved VNgen text language setting
"lang_audio"The saved VNgen audio language setting

Note that not all saved data is user-accessible and will be restored immediately upon loading, such as global option choices, text and label style data, and event read logs. Any existing data of this kind will be overwritten. Other data (listed above) must be applied manually to take effect.

Also note that data structures are volatile and may become inaccessible if the variables referencing them are redefined. As such, it is highly recommended to always destroy the data structure when it no longer needed.

To automatically apply all loaded data, see the vngen_file_load function.

Example#

var map_load = vngen_file_load_map(working_directory + "save.dat");
if (!is_undefined(map_load)) {
vngen_room_goto(map_load[? "room"], map_load[? "event"], map_load[? "object]);
ds_map_destroy(map_load);
}