Jump to content
Sign in to follow this  
twisted

comparing arrays then adding commmon elements to a thrid array

Recommended Posts

so i want to count all towns between to bases(also towns). I figured out a way which would be by finding all towns near the 2 bases and then sorting out and only keeping the towns common to both. but whne i try i get an error.

{if _x in _townsby1 then {_commontowns se> Error position: Error if: Type Location, expected Bool

_dist = _firsttown distance _secondtown; _townsby1 = nearestLocations [_firsttownpos, ["NameVillage","NameCity","NameLocal","NameCityCapital","CityCenter","Airport"], _dist];  _townsby2 = nearestLocations [_secondtownpos, ["NameVillage","NameCity","NameLocal","NameCityCapital","CityCenter","Airport"], _dist];  // now get all towns common to both lists  _commontowns = [];  {if _x in _townsby1 then {_commontowns set[count _commontowns, _x]; }} foreach _townsby2;

edit - dope. i forgot to put brackets around the if statement. very embaressing.

Edited by twisted
aaaaargh

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  

×