buffer_load_async(buffer, filename, offset, size);
|buffer||The index of the buffer to save.|
|filename||The name of the file to save as.|
|offset||The offset within the buffer to save from (in bytes).|
|size||The size of the buffer area to load (in bytes).|
With this function you can load a file that you have created
previously using the buffer_save function (or any of the
other functions for saving buffers) into a buffer. The "offset"
defines the start position within the buffer for loading (in
bytes), and the "size" is the size of the buffer area to be loaded
from that offset onwards (also in bytes).
The function returns a unique ID value which can then be used to check the asynchronous event async_load ID value, as shown in the extended example below. The async_load map in the event will have the following two key/value pairs:
- "id": the ID of the async function as returned by the save function.
- "status": will return true if the data was saved/loaded correctly, and false otherwise.
The buffer_save_async() function can be called from any event, and since it is asynchronous the callback can be almost instantaneous or could take several seconds. Calling the function is simple and would look something like this:
loadid = buffer_load_async(buff, "Player_Save.sav",
The above code loads the contents of the file "Player_Save.sav" to the given buffer, storing the ID of the function call in the variable "loadid". When the load is complete, the asynchronous Save/Load event will be triggered and you can parse the async_load map for the correct ID of the function, like this:
if ds_map_find_value(async_load, "id") ==
if ds_map_find_value(async_load, "status") == false
The above code will first check the id of the ds_map that has been created, then check the status of the callback, posting a debug message if there has been any issues.