visibleMap: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "[[Category:Scripting_Commands_Take_On_Helicopters" to "[[Category:Scripting Commands Take On Helicopters")
m (Some wiki formatting)
 
(47 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma2 |Game name=
|game1= arma2
|version1= 1.00


|1.00|Game version=
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


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


| '''visibleMap''' |SYNTAX=
|game4= arma3
|version4= 0.50


|p1= |PARAMETER1=  
|gr1= Map


|p2= |PARAMETER2=  
|gr2= Interaction


|p3= |PARAMETER3=  
|descr= Return true if the main map is shown (active). In {{arma3}} it also returns true if the respawn screen map is visible.


| [[Boolean]] |RETURNVALUE=
|s1= [[visibleMap]]


|r1= [[Boolean]]


|x1= <code>if (visibleMap) then {hint "You're showing the map !"}</code>|EXAMPLE1=
|x1= <sqf>if (visibleMap) then { hint "You're showing the map !" };</sqf>


____________________________________________________________________________________________
|seealso= [[forceMap]] [[openMap]]
 
| [[forceMap]], [[openMap]] |SEEALSO=
 
|  |MPBEHAVIOUR=
____________________________________________________________________________________________
}}
}}


<h3 style='display:none'>Notes</h3>
{{Note
<dl class='command_description'>
|user = 3.JgKp James
<!-- Note Section BEGIN -->
|timestamp= 20171113151400
 
|text= [[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.
<dd class="notedate">Posted on 13 November 2017
Some of these cases can be covered with an [[addMissionEventHandler]] of type [[Arma 3: Mission Event Handlers#Map|"Map"]].
<dt class="note>'''[[User:Jamesadamar|James]]'''
Just use the two magic variables 'mapIsOpened' and 'mapIsForced'. Skeleton might look something like:
<dd class="note">
<sqf>
[[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)
<pre>
// update marker as long as map is open (works for uav stations as well)
J_myGPSEH = addMissionEventHandler ["Map", {
J_myGPSEH = addMissionEventHandler ["Map", {
  params ["_mapIsOpened", "_mapIsForced"];


  if (_mapIsOpened) then {
params ["_mapIsOpened", "_mapIsForced"];
    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";
  };
}];
</pre>


if (_mapIsOpened) then
{
systemChat "GPS active";
J_var_GPSOn = true;


 
// no sheduled environment -> create one
<!-- Note Section END -->
/* Triggered when map is opened or closed either by user action or script command openMap. */
</dl>
0 spawn {
 
waitUntil {
<h3 style='display:none'>Bottom Section</h3>
// ... // do something as long as map is open
 
not J_var_GPSOn;
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
};
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
};
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
}
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
else
{
J_var_GPSOn = false;
systemChat "GPS inactive";
};
}];
</sqf>
}}

Latest revision as of 19:58, 30 August 2025

Hover & click on the images for description

Description

Description:
Return true if the main map is shown (active). In Arma 3 it also returns true if the respawn screen map is visible.
Groups:
MapInteraction

Syntax

Syntax:
visibleMap
Return Value:
Boolean

Examples

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

Additional Information

See also:
forceMap openMap

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
3.JgKp James - c
Posted on Nov 13, 2017 - 15:14 (UTC)
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 active"; J_var_GPSOn = true; // no sheduled environment -> create one /* Triggered when map is opened or closed either by user action or script command openMap. */ 0 spawn { waitUntil { // ... // do something as long as map is open not J_var_GPSOn; }; }; } else { J_var_GPSOn = false; systemChat "GPS inactive"; }; }];