Jump to content

Recommended Posts

Hi all,

 

I'm in a spot of bother with trying to return the mini-map control (whilst in multiplayer). I have looked at this topic but am unable to get the script working. Here is what I have so far:

// add group draw handler to mini-map
_nul = [] spawn {
  disableSerialization;
  _ctrlMiniMap = controlNull;

  // search loop to return mini-map map control
  while {isNull _ctrlMiniMap} do {
	{
      _ctrlMiniMap = _x displayCtrl 101;
      if !(isNull _ctrlMiniMap) exitWith {true;};
    } count (uiNamespace getVariable ["IGUI_Displays",[]]);
	sleep 0.1;
  };

  // adds draw handler
  _ctrlMiniMap ctrlAddEventHandler ["Draw",{_nul = _this call RAD_fnc_groupMarkersMapDraw;}];
};

I have run both the script from the topic (see above) and my modified version. Both offer no success, any ideas or examples for how to get this working would be greatly appreciated?

 

Thanks,

Bull

Share this post


Link to post
Share on other sites

This is what I use ... Only difference I see is that I use an isNil check inside the loop.

 

	[_QS_ST_X] spawn {
		scriptName 'Soldier Tracker (GPS Icons) by Quiksilver - Waiting for GPS display';
		private ['_gps','_QS_ST_X'];
		_QS_ST_X = _this select 0;
		disableSerialization;
		_gps = controlNull;
		for '_x' from 0 to 1 step 0 do {
			{
				if !(isNil {_x displayCtrl 101}) then {
					_gps = _x displayCtrl 101;
				};
			} count (uiNamespace getVariable 'IGUI_Displays');
			uiSleep 1;
			if (!isNull _gps) exitWith {
				_gps ctrlAddEventHandler ['Draw',(_QS_ST_X select 50)];
			};
			uiSleep 0.25;
		};
	};

 

and adapted for yours

 

// add group draw handler to mini-map
0 spawn {
	disableSerialization;
	private _ctrlMiniMap = controlNull;
	// search loop to return mini-map map control
	while {TRUE} do {
		{
			if !(isNil {_x displayCtrl 101}) then {
				_ctrlMiniMap = _x displayCtrl 101;
			};
		} count (uiNamespace getVariable 'IGUI_Displays');
		if (!isNull _ctrlMiniMap) exitWith {
			_ctrlMiniMap ctrlAddEventHandler ["Draw",{_this call RAD_fnc_groupMarkersMapDraw;}];
		};
		uiSleep 0.25;
	};
};

 

Share this post


Link to post
Share on other sites

Hi all,

 

I have found the problem. @fn_Quiksilver thank you for the code example. However, I have been running this through on the 'Dev-Branch' and found out that the 'new' mini-map cannot be hooked into using the above methods. The code from the first post was found to have worked on the 'release' branch but not on the 'Dev-Branch'. I am currently investigating why this is not possible and will update this topic with any findings

 

Bull

Share this post


Link to post
Share on other sites
Guest

Maybe it's just the Control ID or the display that changed. Well I'm basicaly quite sure of that since they wont delete the old one (debug purposes or compatibility or dependency)

You can loop through allDisplays and then loop through the controls with allControls and then just display debug info about the control with diag_log format blablabla with ctrlText ctrlType etc... you probably now it already 

 

:)

Share this post


Link to post
Share on other sites

Ok so no joy from my end:

_controlRtn = "";
_lineBreak = toString [13,10];
_displays = uiNamespace getVariable "IGUI_Displays";
_displays = _displays + allDisplays;
{
  _controlRtn = _controlRtn + "========================================";
  _controlRtn = _controlRtn + _lineBreak + (str _x) + _lineBreak;
  _controls = allControls _x;
  for "_i" from 0 to ((count _controls) - 1) do {
    _control = _controls select _i;
    _controlRtn = _controlRtn + (format ["Control: %1   Type: %2",_control,(ctrlType _control)]) + _lineBreak;
  };
} forEach _displays;
copyToClipboard _controlRtn;

Output:

  Reveal hidden contents


I thought that it was maybe this control: "RscCustomInfoMiniMap" but that display did not appear in the list. So I tried running a loop in the mission to see whether Display #317 is ever loaded:

_nul = [] spawn {
  while {true} do {
    _displaysUnique = [];
    _displays = allDisplays + (uiNamespace getVariable ["IGUI_Displays",[]]);
    { _displaysUnique pushBackUnique _x } forEach _displays;
    {
      systemChat format ["%2 Display: %1",(ctrlIDD _x),diag_tickTime];
    } forEach _displaysUnique;
    systemChat "========================================";
    sleep 5;
  };
};

It does not ever appear in the list. Not going to give up, but going to concede this round 

Share this post


Link to post
Share on other sites
  On 3/8/2017 at 7:18 PM, harmdhast said:

Maybe it's just the Control ID or the display that changed. Well I'm basicaly quite sure of that since they wont delete the old one (debug purposes or compatibility or dependency)

You can loop through allDisplays and then loop through the controls with allControls and then just display debug info about the control with diag_log format blablabla with ctrlText ctrlType etc... you probably now it already 

 

:)

 

IGUI displays do not appear in allDisplays return

Share this post


Link to post
Share on other sites
Guest
  On 3/8/2017 at 11:48 PM, fn_Quiksilver said:

 

IGUI displays do not appear in allDisplays return

Still they probably made a new one instead of overwriting the existing one which is pure non sense.

Share this post


Link to post
Share on other sites

On dev you can have 2 GPSs now at the same time. I assume this has something to do with the Jets and UAV sensors. If you press [ or ] you get GPS appear on the left or right or both. I guess the old control is not used any more, this is why you cannot use it.

Share this post


Link to post
Share on other sites

Finally found it on my own LAN server; I local exec the code below to find maplike display controls based on their control type or class name:

player groupChat "Maplike display controls";
{
 _disp = _x;
 {
  _ctrl = _x; 
  if (ctrlType _ctrl in[100,101] or toUpper(ctrlClassName _ctrl) find "MAP" > -1) then
  {
   systemChat (str(ctrlIDD _disp) + " " + str(ctrlIDC _ctrl) + " " + ctrlClassName _ctrl);
  };
 } forEach allControls _x;
} forEach allDisplays + (uiNamespace getVariable "IGUI_Displays");

One of them listed "311 101 CA_MiniMap" so I picked that one for ctrlAddEventHandler draw calls. It seems after version 1.70 the GPS minimap is now in allDisplays list as Display #311 and Control #101.

My script above does not show in which of the two lists it found the minimap; before ArmA 3 version 1.70 the GPS minimap used to be in the IGUI_Displays list instead, as Display #133 and Control #101.

 

Below are the four most common map variants you can hook into; idx 0 is from allDisplays and idx 1 is from IGUI_Displays. Please let us know their display/control/list if you discover further map variants.

case "UAVMAP": {_idd = 160; _idc = 51; _idx = 0};
case "ARTYMAP": {_idd = -1; _idc = 500; _idx = 0};
case "BIGMAP": {_idd = 12; _idc = 51; _idx = 0};
case "MINIMAP": {_idd = 311; _idc = 101; _idx = 0};

PS: Adding draw calls to one GPS minimap will show them on the second MFD as well. Perhaps after additional content updates more of the IGUI_Displays list will be consolidated into the allDisplays list.

  • Like 2

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

×