BIS fnc createMenu: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "*/ {{placeholder}}" to "*/</pre> {{placeholder}}")
(Page filling)
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{RV|type=function
{{RV|type=function


| arma2
|game1= arma2
|version1= 1.00


|1.00
|game2= arma2oa
|version2= 1.50


|gr1 = Communication Menu
|game3= tkoh
|version3= 1.00


| <pre>
|game4= arma3
/*
|version4= 0.50
File: fn_createMenu.sqf


Description:
|gr1= Communication Menu
Create custom commanding menu (with multiple pages if necessary).


Parameter(s):
|descr= Create custom commanding menu (with multiple pages if necessary).
_this select 0 - STRING or ARRAY - Name of menu or [Name, Context sensitive]
_this select 1 - STRING - Variable in which will be menu params stored (as variable_0, variable_1, ...)
_this select 2 - ARRAY - Array with menu items (can be either [items] or [[items],[itemNames],[itemEnable]] if you want to set custom params (names, enable values))
_this select 3 - STRING - Name of submenu which will open when item is activated. Name of selected item is passed to string as %1
_this select 4 - STRING - Expression which is executed when item is activated. Name of selected item is passed to string as %1, ID is %2.
_this select 5 - ANYTHING (Optional) - params passed to expression. Whole argument is passed as %3
_this select 6 - BOOLEAN - False to hide number shortcuts


Returned value(s):
|s1= [namePath, variable, itemDetails, subMenu, codeStr, parameters, showKey] call [[BIS_fnc_createmenu]]
True
Example:
  c = ["first","second"]; ["Menu", "b", c, "","hint 'ahoj'"] call BIS_FNC_createmenu; showCommandingMenu "#USER:b_0" 
  c = [["firstData","secondData"],["First","Second"]]; ["Menu", "b", c, "","hint (str '%1' + str '%2' + str '%3')"] call BIS_FNC_createmenu;  showCommandingMenu "#USER:b_0"; 
  see news:g7p3po$gik$1@new-server.localdomain
*/</pre>


{{placeholder}}
|p1= namePath: [[String]] or [[Array]] - can be one of:
* [[String]] - menu name
* [[Array]] - format [menuName, context]


| <!-- [] call [[BIS_fnc_createmenu]]; -->
|p2= variable: [[String]] - variable in which will be menu params stored (as {{hl|''variable''_0}}, {{hl|''variable''_1}} etc)


|p1=
|p3= itemDetails: [[Array]] - menu items, format can be one of:
* [items]
* [<nowiki/>[items], [itemNames], [itemEnable]] if custom parameters are to be set(names, enable values)


|x1=
|p4= subMenu: [[String]] - name of the submenu which will open when item is activated. Name of the selected item is passed to string as {{hl|%1}}
}}
 
|p5= codeStr: [[String]] - expression which is executed when ''item'' is activated; item's name is passed to string as {{hl|%1}}, ID as {{hl|%2}}, ''parameters'' (below) as {{hl|%3}}
 
|p6= parameters: [[Anything]] - (Optional) passed to ''codeStr'' as {{hl|%3}}
 
|p7= showKey: [[Boolean]] - (Optional, default [[true]]) [[false]] to hide number shortcuts
 
|r1= [[Boolean]] - always [[true]]


|x1= <sqf>
["Menu", "b", ["first", "second"], "","hint 'ahoj'"] call BIS_fnc_createMenu;
showCommandingMenu "#USER:b_0";
</sqf>


|x2= <sqf>
private _itemDetails = [["firstData", "secondData"], ["First", "Second"]];
["Menu", "b", _itemDetails, "", "hint (str '%1' + str '%2' + str '%3')"] call BIS_fnc_createMenu;
showCommandingMenu "#USER:b_0";
</sqf>


[[Category:{{Name|arma2}}: Functions|{{uc:createmenu}}]]
|seealso= [[Conversations]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:createmenu}}]]
}}
[[Category:{{Name|tkoh}}: Functions|{{uc:createmenu}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:createmenu}}]]

Latest revision as of 00:49, 9 November 2024

Hover & click on the images for description

Description

Description:
Create custom commanding menu (with multiple pages if necessary).
Execution:
call
Groups:
Communication Menu

Syntax

Syntax:
[namePath, variable, itemDetails, subMenu, codeStr, parameters, showKey] call BIS_fnc_createmenu
Parameters:
namePath: String or Array - can be one of:
variable: String - variable in which will be menu params stored (as variable_0, variable_1 etc)
itemDetails: Array - menu items, format can be one of:
  • [items]
  • [[items], [itemNames], [itemEnable]] if custom parameters are to be set(names, enable values)
subMenu: String - name of the submenu which will open when item is activated. Name of the selected item is passed to string as %1
codeStr: String - expression which is executed when item is activated; item's name is passed to string as %1, ID as %2, parameters (below) as %3
parameters: Anything - (Optional) passed to codeStr as %3
showKey: Boolean - (Optional, default true) false to hide number shortcuts
Return Value:
Boolean - always true

Examples

Example 1:
["Menu", "b", ["first", "second"], "","hint 'ahoj'"] call BIS_fnc_createMenu; showCommandingMenu "#USER:b_0";
Example 2:
private _itemDetails = [["firstData", "secondData"], ["First", "Second"]]; ["Menu", "b", _itemDetails, "", "hint (str '%1' + str '%2' + str '%3')"] call BIS_fnc_createMenu; showCommandingMenu "#USER:b_0";

Additional Information

See also:
Conversations

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