Jump to content
Sign in to follow this  

Recommended Posts

Is there any command or method out there to check if the GPS is visible?

I'm looking for something like visibleMap but for GPS, compass, binocs etc.

I couldn't find a direct command like that but is there any other means of finding if the GPS is currently visible (by CTRL-M)?

Share this post


Link to post
Share on other sites

I did a map about a year ago with a custom video that played in the GPS. You might be able to find something in this function file, I spent a few hours trying to force the GPS to display without the player having to press ctrl+M but didn't have any luck, not sure if it's any easier detecting if it's open either:

//called with:

//VID1 = compile preprocessFile "intros\GPSvid2.sqf";

//[] spawn VID1;

//GPSvid2.sqf:

//_script = ["video\arma2B.ogv",1.04] spawn bis_fnc_customGPSvideo; waitUntil {scriptDone _script};

scriptName "fn_customGPSvideo.sqf";

/*

Author: Karel Moricky

Description:

Plays in-game video in GPS frame.

Parameter(s):

_this select 0: STRING - Video

Returns:

True

*/

#define GPS_DISPLAY (uinamespace getvariable "BIS_RscMissionScreen_customGPSvideo")

#define GPS_CONTENT (GPS_DISPLAY displayctrl 1100)

#define GPS_FRAME (GPS_DISPLAY displayctrl 1101)

_this spawn {

_content = _this select 0;

_sizeCoef = if (count _this > 1) then {_this select 1} else {1};

19 cutrsc ["RscMissionScreen","plain"];

waituntil {!isnull (uinamespace getvariable "BIS_RscMissionScreen")};

uinamespace setvariable ["BIS_RscMissionScreen_customGPSvideo",uinamespace getvariable "BIS_RscMissionScreen"];

_contentConfig = configfile >> "RscMiniMap" >> "controlsBackground" >> "CA_MiniMap";

_contentX = getnumber (_contentConfig >> "x");

_contentY = getnumber (_contentConfig >> "y");

_contentW = getnumber (_contentConfig >> "w");

//_contentH = getnumber (_contentConfig >> "h");

_contentH = _contentW * (10/16) * (4/3); //--- Aspect ration fix

_frameConfig = configfile >> "RscMiniMap" >> "controls" >> "CA_MinimapFrame";

_frameX = getnumber (_frameConfig >> "x");

_frameY = getnumber (_frameConfig >> "y");

_frameW = getnumber (_frameConfig >> "w");

_frameH = getnumber (_frameConfig >> "h");

_frame = if (isnil "BIS_fnc_customGPS_Params") then {

//--- Default

gettext (_frameConfig >> "text");

} else {

//--- Modified by BIS_fnc_customGPS

_params = BIS_fnc_customGPS_Params;

if (count _params > 1) then {

_dX = _params select 1;

_contentX = _contentX + _dX;

_frameX = _frameX + _dX;

};

if (count _params > 2) then {

_dY = _params select 2;

_contentY = _contentY + _dY;

_frameY = _frameY + _dY;

};

_params select 0;

};

_posContent = [

_contentX,

_contentY,

_contentW * _sizeCoef,

_contentH * _sizeCoef

];

_posFrame = [

_frameX,

_frameY,

_frameW,

_frameH

];

//--- Set

bis_fnc_customGPSvideo_videoStopped = false;

GPS_CONTENT ctrladdeventhandler ["videoStopped","bis_fnc_customGPSvideo_videoStopped = true;"];

GPS_CONTENT ctrlsetposition _posContent;

GPS_CONTENT ctrlsettext _content;

GPS_CONTENT ctrlcommit 0;

GPS_FRAME ctrlsetposition _posFrame;

GPS_FRAME ctrlsettext _frame;

GPS_FRAME ctrlcommit 0;

waituntil {bis_fnc_customGPSvideo_videoStopped};

bis_fnc_customGPSvideo_videoStopped = nil;

19 cuttext ["","plain"];

};

Share this post


Link to post
Share on other sites

Here's the config entry for the GPS and it's parent (the map):

class RscDisplayMainMap {
access = ReadAndWrite;
idd = 12;
movingEnable = 0;
saveParams = 0;

class controlsBackground {
	class Map : RscMapControl {
		moveOnEdges = 1;
		x = -0.088;
		y = -0.088;
		w = 1.176;
		h = 1.176;

		class Command {
			icon = "#(argb,8,8,3)color(1,1,1,1)";
			color[] = {0, 0, 0, 1};
			size = 18;
			importance = 1;
			coefMin = 1;
			coefMax = 1;
		};

		class ActiveMarker {
			color[] = {0.3, 0.1, 0.9, 1};
			size = 50;
		};
	};
};


	class GPS : RscObject {
		idc = 106;
		type = 82;
		model = "\core\gps\gps.p3d";
		x = 0.3;
		xBack = 0.3;
		y = 0.08;
		yBack = 0.08;
		z = 0.22;
		zBack = 0.22;
		inBack = 0;
		enableZoom = 0;
		up[] = {0, 1, 0};
		direction[] = {0, 50, 1};
		zoomDuration = 1;
		scale = 1;
		waitForLoad = 0;

		class Areas {
			class Display {
				selection = "display";

				class controls {
					class GPSSquare : RscText {
						style = 2;
						idc = 75;
						x = 0;
						y = 0 * 0.660;
						w = 1;
						h = 1 * 0.660;
						color[] = {0, 0, 0, 1};
						sizeEx = 1 * 0.660;
						text = "";
					};
				};
			};
		};
	};

It should be one of those idc's (106 or 75). I'm assuming the idd would be 12 and then you would use findDisplay and displayCtrl to determine if the GPS was on screen. I haven't tried it but if you get stuck I'll have a go over the weekend to see if I can help (way too late to try now).

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×