Shows a message to the user.


GML Code Example


Argument Description
String The message to show to the user.

Returns: Real


This function opens a window and displays the message you define in the function to the user. This is an asynchronous function, and as such GameMaker: Studio does not block the device it is being run on while waiting for answer, but rather keeps on running events as normal. Once the user has pressed the "Okay" button, an asynchronous Dialog event is triggered which, for the duration of that event only, will have a ds_map stored in the variable async_load.

This map will contain the two keys, "id" and "status", with "id" being the value that was returned by the function when called, and the "status" being either true for the "Okay" button being pressed, or false if the message was cancelled (where available as not all target platforms permit the cancelation of dialogues).

Extended Example:

The left mouse press event (for example) of the object that is showing the message would have the following code:

GML Code Example

msg = show_message_async("You will now be taken to the store");

The above will show a message with the given string. The message id is stored in the variable "msg" and will be used in the asynchronous Dialogs event as shown below:

GML Code Example

var i_d, stat;
 i_d = ds_map_find_value(async_load, "id");
 if i_d == msg
    if ds_map_find_value(async_load, "status")

The above code checks the "id" key of the returned ds_map against the value stored in the variable "msg". If they are the same, it then checks to see if the "Okay" button was pressed (rather than the window being closed/cancelled) and if it returns true it opens a url.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here