HazJ 1289 Posted July 21, 2019 Hi all, I am trying to draw icons on the GPS panel. Currently having issues with it though, not sure where I am going wrong exactly. I have a feeling the control/IDC is wrong? The function (fn_playerIcons.sqf) works fine, it works on the normal map control #51. Code is quite messy, needs a cleanup/rewrite but for now just trying to get it working. _miniMapKey = []; { _miniMapKey append _x; } forEach [ actionKeys "MiniMap", actionKeys "MiniMapToggle", actionKeys "ListLeftVehicleDisplay", actionKeys "ListPrevLeftVehicleDisplay", actionKeys "CloseLeftVehicleDisplay", actionKeys "ListRightVehicleDisplay", actionKeys "ListPrevRightVehicleDisplay", actionKeys "CloseRightVehicleDisplay", actionKeys "User20" ]; case (_key in _miniMapKey) : { systemChat "Mini Map Key Pressed"; _handled = false; [] spawn { if !("ItemGPS" in assignedItems player) exitWith { systemChat "No GPS"; }; sleep 1.15; waitUntil {visibleGPS}; sleep 1.15; if (!visibleGPS) then { ((uiNamespace getVariable "RscCustomInfoMiniMap") displayCtrl 101) ctrlRemoveEventHandler ["Draw", miniMapEH]; systemChat "GPS Not Visible"; miniMapEH = nil; if (DEBUG_MODE isEqualTo 1) then { systemChat "[DEBUG] :: MINI MAP EH REMOVED"; }; } else { miniMapEH = ((uiNamespace getVariable "RscCustomInfoMiniMap") displayCtrl 101) ctrlAddEventHandler ["Draw", tky_fnc_playerIcons]; systemChat "GPS Visible"; if (DEBUG_MODE isEqualTo 1) then { systemChat "[DEBUG] :: MINI MAP EH ADDED"; }; }; }; }; Even tried all of these: { ((uiNamespace getVariable "RscCustomInfoMiniMap") displayCtrl _x) ctrlAddEventHandler ["Draw", tky_fnc_playerIcons]; } forEach [ 15110, 102, 15112, 199, 198, 197, 13301, 101 ]; Any ideas? Cheers, Haz Share this post Link to post Share on other sites
beno_83au 1369 Posted July 22, 2019 Sorry to be of literally, absolutely, inarguably ZERO help, but I spent way too much time over the weekend trying to determine controls/idcs or anything else along those lines to get me started on something, and got nowhere....... So I went a different and much more logical direction with things. Just a thought though. Are you trying to add stuff to the gps map? Because any markers on the main map will show on the gps. Share this post Link to post Share on other sites
HazJ 1289 Posted July 22, 2019 I am using drawIcon not createMarker therefore they have to be drawn on all. Main map, GPS, and any custom displays with map control. 1 Share this post Link to post Share on other sites
NumbNutsJunior 65 Posted July 23, 2019 Hello HazJ, The mini-map control is held within a controls group and so you need to access it via the command controlsGroupCtrl. I did not go as far as to actually draw icons but I am assuming from the hint of params that the rest should work as you said it already does, hopefully this info helps. For future work on these IGUI displays you can loop through them and use the command ctrlType in order to figure out what controls are what so that you are not just staring at the control ids. // Wait for display waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; // Controls private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; // Event handler _miniMap ctrlAddEventHandler ["Draw", {hintSilent (format [":: %1", _this])}]; 1 Share this post Link to post Share on other sites
NumbNutsJunior 65 Posted July 23, 2019 Update: The control does draw icons as intended. // Wait for display waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; // Controls private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; // Event handler _miniMap ctrlAddEventHandler ["Draw", { // Wiki example (_this select 0) drawIcon [ "iconStaticMG", [1,0,0,1], getPos player, 24, 24, getDir player, "Player Vehicle", 1, 0.03, "TahomaB", "right" ] }]; 6 Share this post Link to post Share on other sites
HazJ 1289 Posted July 23, 2019 Damn! Thanks, knew it was something simple. Didn't bother to check type, just assumed. Always a bad idea to do so haha. Thanks. 2 Share this post Link to post Share on other sites
LSValmont 789 Posted February 27, 2021 On 7/23/2019 at 2:42 AM, NumbNutsJunior said: Update: The control does draw icons as intended. // Wait for display waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; // Controls private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; // Event handler _miniMap ctrlAddEventHandler ["Draw", { // Wiki example (_this select 0) drawIcon [ "iconStaticMG", [1,0,0,1], getPos player, 24, 24, getDir player, "Player Vehicle", 1, 0.03, "TahomaB", "right" ] }]; This no longer works for me.... anyone can confirm? Share this post Link to post Share on other sites
pierremgi 4850 Posted February 27, 2021 No, what works. Tested in vanilla and debug console (spawned) Share this post Link to post Share on other sites
Pagoda.br 8 Posted October 6, 2021 I also tested and it's not working. There is a solution? 😯 Edit: Thanks to sharp. from Arma 3 Discord! This works! private _displays = uiNameSpace getVariable "igui_displays"; private _ctrlGPS = _displays select (_displays findIf {!isNull (_x displayCtrl 101)}) displayCtrl 101; Share this post Link to post Share on other sites
pierremgi 4850 Posted October 6, 2021 Difficult to understand the how and the why! This topic has little explanation and context. First of all, disableSerialization is missing, imho. Not mandatory for a simple test, but can't be omitted in more general context. Second, what works in Vanilla, couldn't work with addons. I repeat: [] spawn { waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; disableSerialization; comment "you can test without"; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; _miniMap ctrlAddEventHandler ["Draw", { (_this select 0) drawIcon [ "iconStaticMG", [1,0,0,1], getPos player, 24, 24, getDir player, "Player Vehicle", 1, 0.03, "TahomaB", "right" ] }]; }; works in Vanilla. And probably with most of well-scripted addons. So, please, don't transform simple issue (copy/paste bug or else) to a fake issue on a working script. If you have no script error and no result, at least give your mod list. The culprit is probably inside. Share this post Link to post Share on other sites
Northup 17 Posted June 18, 2022 On 10/6/2021 at 9:04 AM, pierremgi said: Difficult to understand the how and the why! This topic has little explanation and context. First of all, disableSerialization is missing, imho. Not mandatory for a simple test, but can't be omitted in more general context. Second, what works in Vanilla, couldn't work with addons. I repeat: [] spawn { waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; disableSerialization; comment "you can test without"; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; _miniMap ctrlAddEventHandler ["Draw", { (_this select 0) drawIcon [ "iconStaticMG", [1,0,0,1], getPos player, 24, 24, getDir player, "Player Vehicle", 1, 0.03, "TahomaB", "right" ] }]; }; works in Vanilla. And probably with most of well-scripted addons. So, please, don't transform simple issue (copy/paste bug or else) to a fake issue on a working script. If you have no script error and no result, at least give your mod list. The culprit is probably inside. I removed the comment, but this doesn't seem to work for me. I am sure I am doing something wrong. I have a trigger that executes an sqf that gets the position of an invisible marker and draws an icon there. This works fine on the main map, but I get no errors. I am not using any mods. Everything is vanilla. params [ ["_position",[],[[]]] ]; _marker = createMarker ["tower1", _position]; _marker setMarkerShape "ELLIPSE"; _marker setMarkerSize [1,1]; _marker setMarkerBrush "SolidBorder"; _marker setMarkerAlpha 0; _marker setMarkerColor "ColorOPFOR"; sleep 0.5; [] spawn { waitUntil{!isNull findDisplay 12}; findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",{ (_this select 0) drawIcon [ getMissionPath "\images\tower1_ca.paa", [1,1,1,1], getMarkerPos "tower1", 20, 20, 0, "", false, 0.03, "TahomaB", "right"]; }]; }; [] spawn { waitUntil {!isNull (uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull])}; disableSerialization; private _display = uiNamespace getVariable ["RscCustomInfoMiniMap", displayNull]; private _miniMapControlGroup = _display displayCtrl 13301; private _miniMap = _miniMapControlGroup controlsGroupCtrl 101; _miniMap ctrlAddEventHandler ["Draw", { (_this select 0) drawIcon [ getMissionPath "\images\tower1_ca.paa", [1,1,1,1], getMarkerPos "tower1", 20, 20, 0, "", false, 0.03, "TahomaB", "right"]; }]; }; 1 Share this post Link to post Share on other sites
Northup 17 Posted May 6, 2023 Ok. So I've got a mission I had to add icons to the player map and GPS. Depends on how you are running the mission. If it's a self hosted thing on your own PC, things that would work in that environment won't work the same way in a dedicated server environment. I'm learning this is true for a lot of stuff: Weather, Time, and.... drawing stuff on the map and GPS. Long and short of it is, anything you draw needs to be drawn on all client machines. Here's a snippet of some code I use to draw an icon on the player map and GPS. Works in a dedicated server environment. Should work regardless. //Draw on Map waitUntil {!isNull findDisplay 12}; findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { _ALP_towers = missionNamespace getVariable "ALP_triggerTowers"; { _this select 0 drawIcon [getMissionPath format ["\images\tower%1_ca.paa", (_forEachIndex + 1)], [1,1,1,1], (getPos (_x select 0)), 24, 24, 0, "", 1, 0.03, "TahomaB", "right"]; } forEach _ALP_towers; }]; //Draw on GPS private _displays = uiNamespace getVariable ["igui_displays", []]; { private _ctrl = _x displayCtrl 101; if (!isNull _ctrl && ctrlType _ctrl == 101) then { _ctrl ctrlAddEventHandler ["Draw", { _ALP_towers = missionNamespace getVariable "ALP_triggerTowers"; { _this select 0 drawIcon [getMissionPath format ["\images\tower%1_ca.paa", (_forEachIndex + 1)], [1,1,1,1], (getPos (_x select 0)), 24, 24, 0, "", 1, 0.03, "TahomaB", "right"]; } forEach _ALP_towers; }]; }; } forEach _displays; I have this code running in initplayerlocal. This is a mission with no addons, no mods, pure vanilla. 1 Share this post Link to post Share on other sites