Jump to content

Recommended Posts

Hot to ? )

It wasn't a problem, but now with the lines, if anyone know how to work with them, i would appreciate explanation )

Share this post


Link to post
Share on other sites

To copy:

copyMarkers = {
	private "_array" ;
	_array = [] ;
	{
		if (_x find "_USER_DEFINED #" != -1) then {
			_array = _array + [[_x,getMarkerPos _x,getMarkerSize _x,getMarkerType _x,getMarkerColor _x,markerText _x]] ;
		} ;
	} forEach allMapMarkers ;
	copyToClipboard str _array ;
} ;

To paste:

pasteMarkers = {
	{
		if (_x find "_USER_DEFINED #" != -1) then {
			deleteMarker _x ;
		} ;
	} forEach allMapMarkers ;
	{
		_x params [
			"_name",
			"_pos",
			"_size",
			"_type",
			"_col",
			"_txt"
		] ;
		_marker = createMarker [_name,_pos] ;
		_market setMarkerShape "ICON" ;
		_marker setMarkerSize _size ;
		_marker setMarkerType _type ;
		_marker setMarkerColor _col ;
		_marker setMarkerText _txt ;
	} forEach _this ;
} ;

These scripts only work for user created markers (not created on any editors, in game created marker). It'll remove all user created markers before paste.

Feel free to modify.

 

To use:

 

Copy Markers: 

call copyMarkers

This will copy results to your clipboard.

 

Paste Markers:

<paste the result of copyMarkers> call pasteMarkers

ex.

[["_USER_DEFINED #0/2/3",[4253.79,6348.01,0],[1,1],"hd_dot","ColorBlack",""],["_USER_DEFINED #0/3/3",[4250.69,6245.64,0],[1,1],"hd_join","ColorBlack","AAA"],["_USER_DEFINED #0/4/3",[4010.21,6263.9,0],[1,1],"hd_flag","ColorWEST",""],["_USER_DEFINED #0/5/3",[4149.84,6172.39,0],[1,1],"hd_start","ColorWEST","CCC"]] call pasteMarkers

EDIT: The script wont work for drawed line.

  • Like 1

Share this post


Link to post
Share on other sites

 

thanks, but as i said it wasn't a problem, problem with lines )

Share this post


Link to post
Share on other sites

I need this but for editor placed markers. Tried to modify the script but not luck so far. 

// to copy markers
copyMarkers = {
	private "_array" ;
	_array = [] ;
	{
		
			_array = _array + [[_x,getMarkerPos _x,getMarkerSize _x,getMarkerType _x,getMarkerColor _x,markerText _x]] ;
	} forEach allMapMarkers ;
	copyToClipboard str _array ;
} ;

//to paste
pasteMarkers = {
	{
			deleteMarker _x ;
	} forEach allMapMarkers ;
	{
		_x params [
			"_name",
			"_pos",
			"_size",
			"_type",
			"_col",
			"_txt"
		] ;
		_marker = createMarker [_name,_pos] ;
		_market setMarkerShape "ICON" ;
		_marker setMarkerSize _size ;
		_marker setMarkerType _type ;
		_marker setMarkerColor _col ;
		_marker setMarkerText _txt ;
	} forEach _this ;
} ;

Defined as functions in description. sqf

class CfgFunctions
{
	class copyMarkers
	{
	file = "copyMarkers.sqf";
	};
	class pasteMarkers
	{
	file = "pasteMarkers.sqf";
	};
};

Changed some marker colors in debug 

"bluefor_mrk41" setMarkerColor "colorOPFOR";
"bluefor_mrk30" setMarkerColor "colorOPFOR";
"bluefor_mrk10" setMarkerColor "colorOPFOR";

Tried to copy marker with debug

call copyMarkers;

 But I receive no result  in debug! 

Share this post


Link to post
Share on other sites

hashmap + MEH are your friends:

 

You can script, for example:
 

TAG_hashMarkers =  createHashMapFromArray (allMapMarkers apply {[_x,[markerShape _x,markerType _x,markerColor _x, markerSize _x, markerDir _x]]});

addMissionEventHandler ["MarkerCreated", {
  params ["_marker", "_channelNumber", "_owner", "_local"];
  TAG_hashMarkers set [_marker,[markerShape _marker,markerType _marker,markerColor _marker, markerSize _marker, markerDir _marker]];
}];

addMissionEventHandler ["MarkerUpdated", {
  params ["_marker", "_local"];
  TAG_hashMarkers set [_marker,[markerShape _marker,markerType _marker,markerColor _marker, markerSize _marker, markerDir _marker]];
}];

addMissionEventHandler ["MarkerDeleted", {
  params ["_marker", "_local"];
  TAG_hashMarkers deleteAt _marker
}];

Do what you need with that. _local (and _owner) parameters can be used for conditions.

  • Like 2

Share this post


Link to post
Share on other sites

I came up with a dead simple solution for map markers saving. I needed to save only their color but other conditions can be applied. 

 

//save markers to user profile, server side
_mapMarkers = allMapMarkers select {!('_USER_DEFINED' in _x)};
_mrkRed = _mapMarkers select {(markerColor _x == "colorOPFOR")};
profileNamespace setVariable ["NeolibNapfMarkers", _mrkRed];

//load markers from user profile, server side
_mrkRed = profileNamespace getVariable ["NeolibNapfMarkers", []];
{_x setMarkerColor "colorOPFOR"} forEach _mrkRed;

//delete save, server side 
profileNamespace setVariable ["NeolibNapfMarkers", nil];

 

  • 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

×