visibleMap: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Take[ _]On[ _]Helicopters(\|.*)?\]\]" to "{{GameCategory|tkoh|Scripting Commands}}")
m (Text replacement - "_{10,} " to "")
Line 1: Line 1:
{{Command|Comments=
{{Command|Comments=
____________________________________________________________________________________________


| arma2 |Game name=
| arma2 |Game name=
Line 9: Line 8:


|gr2= Interaction |GROUP2=
|gr2= Interaction |GROUP2=
____________________________________________________________________________________________


| Return true if the main map is shown (active). |DESCRIPTION=
| Return true if the main map is shown (active). |DESCRIPTION=
____________________________________________________________________________________________


| '''visibleMap''' |SYNTAX=
| '''visibleMap''' |SYNTAX=
Line 27: Line 24:
|x1= <code>if (visibleMap) then {hint "You're showing the map !"}</code>|EXAMPLE1=  
|x1= <code>if (visibleMap) then {hint "You're showing the map !"}</code>|EXAMPLE1=  


____________________________________________________________________________________________


| [[forceMap]], [[openMap]] |SEEALSO=  
| [[forceMap]], [[openMap]] |SEEALSO=  


|  |MPBEHAVIOUR=  
|  |MPBEHAVIOUR=  
____________________________________________________________________________________________
}}
}}



Revision as of 05:15, 17 January 2021

Hover & click on the images for description

Description

Description:
Return true if the main map is shown (active).
Groups:
MapInteraction

Syntax

Syntax:
visibleMap
Return Value:
Boolean

Examples

Example 1:
if (visibleMap) then {hint "You're showing the map !"}

Additional Information

See also:
forceMapopenMap

Notes

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

Notes

Posted on 13 November 2017
James
visibleMap does not work in all cases where a map might be part of a dialog like in a uav terminal or in a artillery computer dialog. Some of these cases can be covered with an addMissionEventHandler of type "Map". Just use the two magic variables 'mapIsOpened' and 'mapIsForced'. Skeleton might look something like
// update marker as long as map is open (works for uav stations as well)
J_myGPSEH = addMissionEventHandler ["Map", {
  params ["_mapIsOpened", "_mapIsForced"];

  if (_mapIsOpened) then {
    systemChat "GPS aktiv";
    J_var_GPSOn = true;
    
    // no sheduled environment -> create one
    /* Triggered when map is opened or closed either by user action or script command openMap. */
    [] spawn {
      waitUntil{ 
        ... // do something as long as map is open; 
        not J_var_GPSOn
      };
    };
  } else {
    J_var_GPSOn = false;
    systemChat "GPS inaktiv";
  };
}];


Bottom Section