Jump to content
vrakpant

Creating markers onMapSingleClick using rscMapControl dialog

Recommended Posts

*SOLVED*
Solution in my second post

Hi! I've been playing around with dialogs for the first time recently, and I've ran in to an issue trying to create markers in a MapControl dialog.

Dialog.hpp

class TABLET_MAP: rscMapControl
{
	idc = -1;
	maxSatelliteAlpha = 0;
	onMouseZChanged = "";
	onMouseButtonDown = "";

	x = 0.306235 * safezoneW + safezoneX;
	y = 0.269598 * safezoneH + safezoneY;
	w = 0.388615 * safezoneW;
	h = 0.387171 * safezoneH;
};
class tablet_arty: RscButton
{
	idc = 1600;

	text = "Request Artillery"; //--- ToDo: Localize;
	x = 0.304069 * safezoneW + safezoneX;
	y = 0.666063 * safezoneH + safezoneY;
	w = 0.0824972 * safezoneW;
	h = 0.0659852 * safezoneH;
};
class tablet_extraction: RscButton
{
	idc = 1601;

	text = "Call Extraction"; //--- ToDo: Localize;
	x = 0.614052 * safezoneW + safezoneX;
	y = 0.666063 * safezoneH + safezoneY;
	w = 0.0824972 * safezoneW;
	h = 0.0659852 * safezoneH;
};
class tablet_reinforcements: RscButton
{
	idc = 1602;

	text = "Reinforcements"; //--- ToDo: Localize;
	x = 0.458442 * safezoneW + safezoneX;
	y = 0.666063 * safezoneH + safezoneY;
	w = 0.0824972 * safezoneW;
	h = 0.0659852 * safezoneH;
};
class vrak_frame: RscFrame
{
	idc = 1800;
	x = 0.298913 * safezoneW + safezoneX;
	y = 0.236059 * safezoneH + safezoneY;
	w = 0.402174 * safezoneW;
	h = 0.516884 * safezoneH;
};

which nets me this result:


145694142986.png


Where I'm at a loss is how I make the MapControl read the _pos of my cursor and create a marker there, I have an addaction running the script mark.sqf

mark.sqf
 

createDialog "tablet_dialog";

mapclick = false;

onMapSingleClick "
deleteMarkerLocal 'marker1';
_marker= createMarkerLocal ['marker1',[0,0,0]];
_marker setMarkerColorLocal 'ColorRed';
_marker setMarkerShapeLocal 'ELLIPSE';
_marker setMarkerBrushLocal 'Solid';
_marker setMarkerSizeLocal [1000, 1000];
'marker1' setMarkerPos _pos;
mapclick = true;
true";

waitUntil{!visibleMap};


onMapSingleClick "";

The dialog opens, but nothing happens when I click it. If I exchange 

createDialog "tablet_dialog";

with

openMap true;

it works like a charm, so I suspect I'm using the wrong command, I'd be very grateful if someone could point me in the right direction! Thanks in advance!

Share this post


Link to post
Share on other sites

Yep! I was completely off. I had to define OnMouseButtonClicked  in my TABLET_MAP class to call mark.sqf

class TABLET_MAP: rscMapControl
{
	idc = -1;
	maxSatelliteAlpha = 0;
	onMouseZChanged = "";
	onMouseButtonDown = "";
	onMouseButtonClick = "_this execvm 'mark.sqf'";

	x = 0.306235 * safezoneW + safezoneX;
	y = 0.269598 * safezoneH + safezoneY;
	w = 0.388615 * safezoneW;
	h = 0.387171 * safezoneH;
};

 

And use ctrlMapScreenToWorld to define the position in mark.sqf

mark.sqf


 

_position = _this select 0 ctrlMapScreenToWorld [ (_this select 2), (_this select 3) ];



deleteMarkerLocal 'marker1';
_marker= createMarkerLocal ['marker1',[0,0,0]];
_marker setMarkerColorLocal 'ColorRed';
_marker setMarkerShapeLocal 'ELLIPSE';
_marker setMarkerBrushLocal 'Solid';
_marker setMarkerSizeLocal [10, 10];
"marker1" setMarkerPos _position;



You always figure it out a few minutes after posting!

  • Like 1

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

×