visibleMap: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
m (Some wiki formatting)
 
Line 23: Line 23:
|r1= [[Boolean]]
|r1= [[Boolean]]


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


|seealso= [[forceMap]] [[openMap]]
|seealso= [[forceMap]] [[openMap]]
}}
}}


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


Line 51: Line 48:
/* Triggered when map is opened or closed either by user action or script command openMap. */
/* Triggered when map is opened or closed either by user action or script command openMap. */
0 spawn {
0 spawn {
waitUntil {  
waitUntil {  
// ... // do something as long as map is open
// ... // do something as long as map is open
not J_var_GPSOn
not J_var_GPSOn;
};
};
};
};
}
} else {
else
{
J_var_GPSOn = false;
J_var_GPSOn = false;
systemChat "GPS inactive";
systemChat "GPS inactive";
Line 62: Line 61:
}];
}];
</sqf>
</sqf>
</dd>
}}
 
</dl>

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"; }; }];