event_perform_async

This function is used to perform any one of the Asynchronous Events provided in GameMaker. You supply the Async event constant (shown in the table below) and a DS map which will be available in the called Async event in the async_load variable.

Async Event Type Constant
ConstantDescription
ev_async_web_image_loadImage Loaded event
ev_async_webHTTP event
ev_async_dialogDialog event
ev_async_web_iapIn-App Purchase event
ev_async_web_cloudCloud event
ev_async_web_networkingNetworking event
ev_async_web_steamSteam event
ev_async_socialSocial event
ev_async_push_notificationPush Notification event
ev_async_save_loadSave/Load Event
ev_async_audio_recordingAudio Recording event
ev_async_audio_playbackAudio Playback event
ev_async_audio_playback_endedAudio Playback Ended event
ev_async_system_eventSystem event

Non-asynchronous events can be called using event_perform().

Note that the DS map specified in the second argument does not have to be destroyed manually as it will automatically be destroyed by the function after the Async event has been performed.

 

Syntax:

event_perform_async(type, ds_map);

ArgumentTypeDescription
typeAsync Event Type ConstantThe type of event to perform (see the table above).
ds_mapDS MapThe DS map to use as async_load in the called event.

 

Returns:

N/A

Example:

var _map = ds_map_create();

_map[? "id"] = "custom_async_event";
_map[? "result"] = true;
_map[? "data"] = { a: 13, b: 16 };

event_perform_async(ev_async_social, _map);

The above code creates a DS map and populates it with custom entries to be read in the Async event. It then performs the Async Social event with the newly created map passed in as async_load for the called event.