BIS fnc GUImessage: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Changed the formatting to better match with the rest of the wiki and added function information)
Line 8: Line 8:
____________________________________________________________________________________________
____________________________________________________________________________________________


| <pre>/*
| Creates a fully dynamic GUI message box in the center of the player's screen. |= Description
____________________________________________________________________________________________
 
| [body, header, OKbutton, Cancelbutton, display, inheritClass, pauseGame] call '''BIS_fnc_GUImessage''' |= Syntax
 
|p1= [''body'', ''header'', ''OKbutton'', ''Cancelbutton'', ''display'', ''inheritClass'', ''pauseGame'']: [[Array]]  |= PARAMETER1
 
|p2= body: [[String]] or [[Structured_Text|Structured Text]] (optional) - Default: "".  |= PARAMETER2


Description:
|p3= header: [[String]] (optional) - Default: "". |= PARAMETER3
Displays message window


Parameter(s):
|p4= OKbutton: [[Boolean]] or [[String]] (optional) - True/False to enable/disable button with default string of "OK", or enable the button with the input string. Default: true. |= PARAMETER4
0: STRING or STRUCTURED TEXT - message body
1: STRING - message header
2:
BOOL - enable/disable "OK" button
TEXT - set "OK" button's text (enabling it automatically)
3:
BOOL - enable/disable "Cancel" button
TEXT - set "Cancel" button's text (enabling it automatically)
4: DISPLAY - parent display
5: BOOL - when true, function will try to use control inherited from 'RscMessageBox' in display instead of creating a new one
6: BOOL - true to pause the game, false to let it running


Returns:
|p5= Cancelbutton: [[Boolean]] or [[String]] (optional) - True/False to enable/disable button with default string of "CANCEL", or enable the button with the input string. Default: false. |= PARAMETER5
BOOL - true if "OK" button was activated, false if "Cancel" was activated or user pressed "Escape" key.
 
*/
|p6= display: [[Display]] (optional) - Default: Main display of current mission/intro/outro. |= PARAMETER6
</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_GUImessage]]; --> |= Syntax
|p7= inheritClass: [[Boolean]] (optional) - True to use "RscMessageBox" class from the current display, false to use BIS-created "RscMessageBox" class. Default: false. |= PARAMETER7


|p1= |= Parameter 1
|p8= pauseGame: [[Boolean]] (optional) - Default: true. |= PARAMETER8


| |= Return value
| [[Boolean]] - true if "OK" button was activated, false if "Cancel" was activated or user pressed "Escape" key. |= RETURNVALUE
____________________________________________________________________________________________
____________________________________________________________________________________________


|x1= <code></code> |=  
|x1= <code>["Example Body", "Example Header", [[true]], [[true]], [[findDisplay]] 46, [[false]], [[true]]] [[call]] [[BIS_fnc_GUImessage]];</code> |=
|x2= <code>[<nowiki></nowiki>[[composeText]] ["Example", [[lineBreak]], "Body"], "Example Header", [[true]], [[true]], [[findDisplay]] 46, [[false]], [[true]]] [[call]] [[BIS_fnc_GUImessage]];</code> |=  
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 72: Line 66:
[[if]] (_forEachIndex < (([[count]] [[playableUnits]]) - 1)) [[then]]
[[if]] (_forEachIndex < (([[count]] [[playableUnits]]) - 1)) [[then]]
{
{
_allPlayers = [[format]] ["%1,linebreak,", _allPlayers];
_allPlayers = [[format]] ["%1,lineBreak,", _allPlayers];
};
};
};
};

Revision as of 05:29, 24 December 2014


Hover & click on the images for description

Description

Description:
Creates a fully dynamic GUI message box in the center of the player's screen.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[body, header, OKbutton, Cancelbutton, display, inheritClass, pauseGame] call BIS_fnc_GUImessage
Parameters:
[body, header, OKbutton, Cancelbutton, display, inheritClass, pauseGame]: Array
body: String or Structured Text (optional) - Default: "".
header: String (optional) - Default: "".
OKbutton: Boolean or String (optional) - True/False to enable/disable button with default string of "OK", or enable the button with the input string. Default: true.
Cancelbutton: Boolean or String (optional) - True/False to enable/disable button with default string of "CANCEL", or enable the button with the input string. Default: false.
display: Display (optional) - Default: Main display of current mission/intro/outro.
inheritClass: Boolean (optional) - True to use "RscMessageBox" class from the current display, false to use BIS-created "RscMessageBox" class. Default: false.
pauseGame: Boolean (optional) - Default: true.
Return Value:
Boolean - true if "OK" button was activated, false if "Cancel" was activated or user pressed "Escape" key.

Examples

Example 1:
["Example Body", "Example Header", true, true, findDisplay 46, false, true] call BIS_fnc_GUImessage;
Example 2:
[composeText ["Example", lineBreak, "Body"], "Example Header", true, true, findDisplay 46, false, true] call BIS_fnc_GUImessage;

Additional Information

See also:
BIS_fnc_GUIhint

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section

Posted on December 24, 2014 - 03:52 (UTC)
DreadedEntity
Some code that should produce a "Mission Credits" GUI (tested with a sample array, not actual MP). Lists all connected players. _allPlayers = "composeText ["; { if (isPlayer _x) then { _allPlayers = format ["%1'%2'", _allPlayers, name _x]; if (_forEachIndex < ((count playableUnits) - 1)) then { _allPlayers = format ["%1,lineBreak,", _allPlayers]; }; }; }forEach playableUnits; _allPlayers = format ["%1];", _allPlayers]; _structuredText = call compile _allPlayers; [_structuredText, "Mission Credits", "THANK YOU", "THANK YOU", findDisplay 46, false, true] spawn BIS_fnc_GUImessage;