visibleMap: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " <dl class="command_description"> <dt><dt>" to " <dl class="command_description"> <dt><dt>")
m (Some wiki formatting)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| arma2
|game1= arma2
|1.00
|version1= 1.00


|game2= arma2oa
|game2= arma2oa
Line 17: Line 17:
|gr2= Interaction
|gr2= Interaction


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


| '''visibleMap'''
|s1= [[visibleMap]]


|r1= [[Boolean]]
|r1= [[Boolean]]
Line 32: Line 32:
<dt><dt>
<dt><dt>
<dd class="notedate">Posted on 13 November 2017</dd>
<dd class="notedate">Posted on 13 November 2017</dd>
<dt class="note>'''[[User:Jamesadamar|James]]'''
<dt class="note">[[User:Jamesadamar|James]]</dt>
<dd class="note">
<dd class="note">
[[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
[[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.
<pre>
Some of these cases can be covered with an [[addMissionEventHandler]] of type "Map".
// update marker as long as map is open (works for uav stations as well)
Just use the two magic variables 'mapIsOpened' and 'mapIsForced'. Skeleton might look something like:
J_myGPSEH = addMissionEventHandler ["Map", {
<code>{{cc|update marker as long as map is open (works for uav stations as well)}}
  params ["_mapIsOpened", "_mapIsForced"];
J_myGPSEH = [[addMissionEventHandler]] ["Map", {


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


</dl>
</dl>
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}

Revision as of 19:41, 12 June 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 or on the Forums.
Only post proven facts here! Add Note
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 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. */ [] spawn { waitUntil { // ... // do something as long as map is open not J_var_GPSOn }; }; } else { J_var_GPSOn = false; systemChat "GPS inactive"; }; }];