Skip to content

Event Handlers

Amaury edited this page Feb 16, 2018 · 2 revisions

You can subscribe to an event handler using BIS_fnc_addScriptedEventHandler , it'll execute to given code every time an event is raised by the GPS.

⚠️ Remember to subscribe to an event handler BEFORE it is triggered.

gps_functions_compiled

Description :

This event triggers when the functions of the gps has finished to compile.

⚠️ This EH is asynchronous

You can just use the basic functions here.

Arguments

None

Example

[missionNameSpace,"gps_functions_compiled",{hint "Functions finished to compile"}] call bis_fnc_addScriptedEventHandler;

gps_loaded

Description :

This event triggers when the route computation is done.

You can call any function from the gps after that.

Arguments

None

Example

[missionNamespace,"gps_loaded",{
	[
		"Navigate to marker_1",
		{
		      ["marker_1"] spawn gps_fnc_main;
		}
	] call gps_menu_fnc_addQuickNavOption;
}] call bis_fnc_addScriptedEventHandler;

gps_menu_opening

Description

Triggers BEFORE any menu (quicknav,gps main menu,gps nav menu,gps options menu) is opened.

You can override if the menu can be opened by returning true or false in the EH code.

Arguments

(STRING) _this select 0 : name of the current menu.

Example

/* 
   Here we authorize opening all the menu elements if player has a GPS item on him. 
   And we always authorize the quick nav menu.
*/
[missionNamespace,"gps_menu_opening",{
        params ["_menuType"];
        _return = switch(_menuType) do {
             case "menu_main" : {
                  "ItemGPS" in assignedItems player
             };
             case "menu_nav": {
                  "ItemGPS" in assignedItems player
             };
             case "menu_options": {
                  "ItemGPS" in assignedItems player
             };
             case "menu_controls": {
                  "ItemGPS" in assignedItems player
             };
             case "quick_nav" : {
                   true
             };
        };
        _return;
}] call bis_fnc_addScriptedEventHandler;

gps_menu_opened

Description

Same as above but you can't override anything and the created display is passed as argument AFTER the menu is created.

⚠️ This EH is asynchronous

Arguments

(DISPLAY) _this select 0 : opened menu.

Example

None

gps_main_start

Description

Triggers when the main gps function (fn_main.sqf) is launched

You can override if the function can start by returning true or false in the EH code.

Arguments

(OBJECT) _this select 0 : Start road.

(OBJECT) _this select 1 : Goal road.

Example

None