Jump to content
Sign in to follow this  
Alo Keen

allMapMarkers - is the array alphanum sorted by default?

Recommended Posts

I did, it seems they are, but didn't want to run into an untested case somewhere down the line.

Share this post


Link to post
Share on other sites

What type is returned? An array of map marker names (strings)?

Share this post


Link to post
Share on other sites

From what I could tell, yes. Didn't do a type check on it, just diag_log. Gonna look up checking var types and report back... Damn, learning a new language from scratch is infuriating, I keep looking through the wiki and stuff to do the basics...

Share this post


Link to post
Share on other sites

if you open the editor debug (in editor or game) and type allMapMarkers.. you get this:

["BIS_loc_Agia_Marina","BIS_loc_Marina_Bay","BIS_loc_Spartan","BIS_loc_Village1"
,"BIS_loc_LZ_Connor","BIS_loc_TrypitiBay","BIS_loc_Girna","BIS_loc_village2"
,"BIS_loc_CampMaxwell","BIS_loc_AirStation","BIS_loc_Old_Outpost"
,"BIS_loc_SniperSchool","BIS_loc_Xiros","BIS_loc_Pythos","BIS_loc_CampTempest1"
,"BIS_loc_Airfield1","BIS_loc_NatoBase1","BIS_loc_farm2","BIS_loc_CampRogain"
,"BIS_loc_hill1","BIS_loc_hill2","BIS_loc_hill4","BIS_loc_hill5","BIS_loc_hill6"
,"BIS_loc_hill7","BIS_loc_hill8","BIS_loc_hill9","BIS_loc_hill10","BIS_loc_hill12"
,"BIS_loc_Strogos_Bay","BIS_loc_Girna_Bay","BIS_loc_Kyfi_Bay","BIS_loc_Nisi_Bay"
,"BIS_loc_Tsoukalia","BIS_loc_KeirosBay","BIS_loc_Kamino_Coast","BIS_loc_Limeri_Bay"
,"BIS_loc_TsoukalaBay","BIS_loc_LZBaldy","BIS_loc_MilRange","BIS_loc_Kamino_Bay"]

makes it very easy to tell if marine or no roads for dynamic spawning.

eFindLocations.sqf

_i = 0;

eLocations = {

_color = _this select 0;
_locations = configfile >> "cfgworlds" >> worldname >> "names";

//--- Create config-base locations
	for "_i" from 0 to (count _locations - 1) do {
		_current = _locations select _i;

		_classname = format ["BIS_loc_%1",configname _current];
		_position = getarray(_current >> "position");
		_type = gettext(_current >> "type");

		_m = createMarker [_classname, _position];
		if (DebugDeep == "true") then {_m setMarkerType "mil_dot";} else { _m setMarkerType "empty";};
		if (_type == "NameMarine") then {_m setMarkerColor "ColorBlue"};
		if ((_type == "Hill")||(_type == "ViewPoint")) then {_m setMarkerColor "ColorGreen"};
		if (_type == "Airport") then {_m setMarkerColor "ColorOrange"};

		_m_text = format["%1", _classname];
		if (DebugDeep == "true") then {_m_text = format["%1 <> Pos: %2", _classname,_position];};

		_m setMarkerText _m_text;

		//hint format ["mName: %1\nmPos: %2\ntype: %3\ncurrent: %4",_classname,_position,_type,_current];	
	};		


//last bracket of eLocations function
};


//call the function
["ColorBlack"] call eLocations;

eRoads.sqf

//fnc to find all road segments found in ao_size of current area.
ao_markerLocations_roads = 
{

markerLocations_roads = getMarkerPos "AO" nearRoads ao_size;
if (isNil "markerLocations_roads") exitWith {if (Debug == "true") then {hint "im NIL: no roads in marker area";};};

if (DebugDeep == "true") then { 
	for "_i" from 0 to (count markerLocations_roads - 1) do {
		_current = markerLocations_roads select _i;
		_position = position _current;


		roadMarkerName = format["roadMarker_%1", _current];
		roadMarker = createMarker [roadMarkerName, _position];
		roadMarker setMarkerType "mil_dot";
		roadMarker setMarkerText roadMarkerName;
		roadMarker setMarkerColor 'colorBlack';
		myMarkerNameVar set [(count myMarkerNameVar), roadMarker]; // push the marker name into the array

	};

};
//last bracket of ao_markerLocations_roads function
};

call ao_markerLocations_roads;

ALL JUST EXAMPLES

Share this post


Link to post
Share on other sites

It returns an array of strings and the array is unsorted. It appears to me that the array returned is in the order that the markers were created, but I did not test that.

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
Sign in to follow this  

×