BIS fnc missionSelector: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (infobox to template)
m (Text replacement - "(Optional, default {{hl|[]}})" to "(Optional, default <sqf inline>[]</sqf>)")
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|= Comments
{{RV|type=function


| arma3 |Game name=
|game1= arma3
|version1= 1.78


|1.78|Game version=
|gr1= Systems


<!---|arg= local |Multiplayer Arguments=--->
|eff= local


<!---|eff= local |Multiplayer Effects=--->
|descr= Function that draws clickable, hoverable and animated icons on the map that execute a user-defined code when pressed.


| <pre>/*
|s1= [area, mapCenter, missionsArray] call [[BIS_fnc_missionSelector]]
Author: Riccardo Argiolas


Description:
|p1= area: [[Array]] of [[Number]] - (Optional, default [100,100]) used to determine map's zoom, format [width, height]
Function that draws clickable, hoverable and animated icons on the map that execute a user-defined code when pressed.


Parameters:
|p2= mapCenter: [[Position#Introduction|Position2D]] - (Optional, default [0,0]) center position where the map camera will be positioned
Select 0 - ARRAY: center position of where the camera will be positioned.
Select 1 - ARRAY: list of selectable missions and their parameters.
Select X - Array element
Select 0 - ARRAY: where the clickable marker will be placed.
Select 1 - STRING: text that should be displayed next to the icon.
Select 2 - STRING: text to be displayed in the tooltip (on mouse over).
Select 3 - STRING: directory of the picture to be displayed in the tooltip.
Select 4 - CODE: code spawned when the icon is clicked.


|p3= missionsArray: [[Array]] - (Optional, default <sqf inline>[]</sqf>) list of selectable missions and their parameters, to format [pos, text, tooltip, picture, code]:
* pos: [[Array]] - where the clickable marker will be placed
* text: [[String]] - text that should be displayed next to the icon
* tooltip: [[String]] - text to be displayed in the tooltip (on mouse over)
* picture: [[String]] - location of the picture to be displayed in the tooltip
* code: [[Code]] - code spawned when the icon is clicked


Returns:
|r1= [[Number]] - index of the chosen mission
NUMBER: chosen mission (index of the list of selectable missions)


Examples:
|x1= <sqf>
 
private _area = [750, 400];
_listOfMissions =
private _missionsList =
[
[
getMarkerPos "BIS_briefMarkerINFANTRY",
"Infantry",
"Your mission is to do stuff",
"AnimBriefing\intro_stage1a_CA.paa",
{ hint "infantry mission selected" }
],
[
[
[
getMarkerPos "BIS_briefMarkerSPECIALFORCES",
getmarkerPos "BIS_briefMarkerINFANTRY",
"Special Forces",
"Infantry",
"Your mission is to do stuff but in a more special way",
"Your mission is to do stuff",
"AnimBriefing\intro_stage1a_CA.paa",
"AnimBriefing\intro_stage1a_CA.paa",
{ hint "special forces mission selected" }
{hint "infantry mission selected"}
]
],
];
[
getmarkerPos "BIS_briefMarkerSPECIALFORCES",
"Special Forces",
"Your mission is to do stuff but in a more special way",
"AnimBriefing\intro_stage1a_CA.paa",
{hint "special forces mission selected"}
]
];
_selectedMissionIndex = [getMarkerPos "BIS_cameraCenter", _listOfMissions] call BIS_fnc_missionSelector;
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=
 
|[] call [[BIS_fnc_missionSelector]]|Syntax=


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
private _index = [_area, getMarkerPos "BIS_cameraCenter", _missionsList] call BIS_fnc_missionSelector;
private _missionDetails = _missionsList select _index;
</sqf>


|Datatype - description|Return value=
|seealso= [[playMission]]
 
|x1= <code></code>|Example 1=
 
|exec= call |Execution=
 
| |See also=
}}
}}
[[Category:Function Group: Systems|{{uc:missionSelector}}]]
[[Category:Functions|{{uc:missionSelector}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:missionSelector}}]]

Latest revision as of 18:09, 8 November 2023

Hover & click on the images for description

Description

Description:
Function that draws clickable, hoverable and animated icons on the map that execute a user-defined code when pressed.
Execution:
call
Groups:
Systems

Syntax

Syntax:
[area, mapCenter, missionsArray] call BIS_fnc_missionSelector
Parameters:
area: Array of Number - (Optional, default [100,100]) used to determine map's zoom, format [width, height]
mapCenter: Position2D - (Optional, default [0,0]) center position where the map camera will be positioned
missionsArray: Array - (Optional, default []) list of selectable missions and their parameters, to format [pos, text, tooltip, picture, code]:
  • pos: Array - where the clickable marker will be placed
  • text: String - text that should be displayed next to the icon
  • tooltip: String - text to be displayed in the tooltip (on mouse over)
  • picture: String - location of the picture to be displayed in the tooltip
  • code: Code - code spawned when the icon is clicked
Return Value:
Number - index of the chosen mission

Examples

Example 1:
private _area = [750, 400]; private _missionsList = [ [ getMarkerPos "BIS_briefMarkerINFANTRY", "Infantry", "Your mission is to do stuff", "AnimBriefing\intro_stage1a_CA.paa", { hint "infantry mission selected" } ], [ getMarkerPos "BIS_briefMarkerSPECIALFORCES", "Special Forces", "Your mission is to do stuff but in a more special way", "AnimBriefing\intro_stage1a_CA.paa", { hint "special forces mission selected" } ] ]; private _index = [_area, getMarkerPos "BIS_cameraCenter", _missionsList] call BIS_fnc_missionSelector; private _missionDetails = _missionsList select _index;

Additional Information

See also:
playMission

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