<- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#screen_commands|Screen Commands]] ===== ShowMessageDialog ===== ^Arguments^Result^Notation^ |Message, OKButton, CancelButton| |''s1 s2 s3 --''| === Description === Displays a "System Communique" message dialog box in the middle of the screen. ''s1'' is displayed as the text of the dialog, ''s2'' is the text in the OK button and ''s3'' is the text in the Cancel button. If ''s2'' or ''s3'' is an empty string, that button will not be displayed. Unlike [[crpl:docs:ShowMessage]], ShowMessageDialog should only be called one time. You can also call [[crpl:docs:PauseGame]] after ShowMessageDialog to pause the game and allow the player time to respond. The game automatically unpauses after the player clicks one of the buttons. There is an associated callback function [[crpl:docs:func_showmessagedialogcallback|:ShowMessageDialogCallback]] that is called, if present, when the player clicks on one of the dialog buttons. The result on top of the stack. 0 is OK, 1 is Cancel. Although an X is visible in the upper right corner, it cannot be clicked for crpl generated dialogs. === Examples === This example throws up a dialog box with a message, and disappears when the user clicks OK. # Display a message to the player "Something important just happened!" "OK" "" ShowMessageDialog This dialog gives the user a choice. The user's choice affects the popup text of the CRPL Core using this script. # Ask an important question once # Initialize state to not yet shown false ->shown endonce # if we have not shown the dialog yet <-shown not if true ->shown # set to true so we don't try to display it again "Cake or Pie?" "Cake" "Pie" ShowMessageDialog PauseGame endif :ShowMessageDialogCallback # 0/FALSE = OK (Cake), 1/TRUE = Cancel (Pie) if PI SetPopupText else "The cake is a lie!" SetPopupText endif TRUE SetPopupTextAlwaysVisible return