{"name":"ctrlMapScreenToWorld","title":"ctrlMapScreenToWorld","type":"command","url":"https://community.bistudio.com/wiki/ctrlMapScreenToWorld","revid":377831,"updated":"2026-01-03T04:31:43Z","groups":["GUI Control - Map"],"status":"ok","games":{"arma1":"1.05","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma1 1.05","arma3_since":"0.50","description":"Converts map screen coordinates into world coordinates. Unlike posScreenToWorld, this command returns world position is format [x, y], otherwise it is identical to posScreenToWorld.","syntaxes":[{"syntax":"control ctrlMapScreenToWorld [x, y]","params":[{"name":"control","type":"Control","description":"map control","type_expr":"Control"},{"name":"x","type":"Number","description":"screen X","type_expr":"Number"},{"name":"y","type":"Number","description":"screen Y","type_expr":"Number"}],"returns":{"type":"Position2D","type_expr":"Position2D","description":"world coordinates"},"form":"binary","left":{"text":"control"},"right":{"text":"[x, y]"}}],"examples":[{"code":["_worldCoord = _control ctrlMapScreenToWorld _ScreenCoord;"]},{"code":["_worldCoord = _control ctrlMapScreenToWorld [_x, _y];"]},{"code":["_worldCoord = findDisplay 12 displayCtrl 51 ctrlMapScreenToWorld [0.5, 0.5];"]}],"see_also":["ctrlMapWorldToScreen","posScreenToWorld","posWorldToScreen","findDisplay","displayCtrl"],"notes":[{"user":"LowFly","date":"2007-04-06","text":"You can get the screen coordinates by the UI Event Handlers onMouseButtonDown, onMouseButtonUp, onMouseButtonClick, onMouseButtonDblClick.\n\nThe return Array is in 2D, you can use it with all set-position commands.\n\n```sqf\n_x = returnArray select 0;\n_y = returnArray select 1;\n```"},{"user":"Ceeeb","text":"The command parameters are screen position coordinates, which may not equate to the map control's coordinates. A map control's screen coordinates and size can be found use the ctrlPosition command. This is an issue when using the Arma 3 in-game map, which is not fullscreen (all previous titles used full screen map controls, so map control coords did equate to screen coords)."},{"user":"Icaruk","date":"2017-08-28","text":"This example creates a RscMapControl and hints you the [x,y] position where you clicked.\n\n```sqf\n0 spawn {\n    disableSerialization;\n    _map = findDisplay 46 createDisplay \"RscCredits\" ctrlCreate [\"RscMapControl\", -1];\n    _map ctrlSetPosition [0,0,1,1];\n    _map ctrlCommit 0;\n\n    _map ctrlAddEventHandler [\"mouseButtonDown\", {\n        _ctrl = _this select 0;\n        _x = _this select 2;\n        _y = _this select 3;\n\n        _pos = _ctrl ctrlMapScreenToWorld [_x, _y];\n        hint format [\"pos: %1\", _pos];\n    }];\n};\n```"}]}