Faron 12 Posted January 6, 2017 Dear Community and helpful happy helpers, while I was scripting around a bit, I experienced the very uneven case (sarcasm!) that something simply didn't work. Today it's a loop: Quote _markerCount = (count allMapMarkers) - 1; hint format ["The total marker amount is %1", _markerCount]; _i = 0; while {( _i <= _markerCount )} do { if (isNil "_i") then {_i = 0}; _currentMarker = allMapMarkers select _i; _treasureDistance = _treasure distance2D _currentMarker; /*if (_treasureDistance <= 200) then { if (markerType _currentMarker == "respawn_naval")) then { _marker = _currentMarker; } else { if ((markerShape _currentMarker == "ELLIPSE") && (markerBrush _currentMarker == "DiagGrid")) then { _area = _currentMarker; }; }; };*/ _i = _i + 1; }; As you can see, I even commented the core part out. _markerCount is around 500. As far as I know, a while loop is limited to 10 000 iterations, so I don't get why this one isn't executed? Might this depend on the servers capacity? I appreciate every suggestion! Greetz, Faron Share this post Link to post Share on other sites
dchan200 18 Posted January 6, 2017 2 hours ago, Faron said: _markerCount = (count allMapMarkers) - 1; hint format ["The total marker amount is %1", _markerCount]; _i = 0; while {( _i <= _markerCount )} do { if (isNil "_i") then {_i = 0}; _currentMarker = allMapMarkers select _i; _treasureDistance = _treasure distance2D _currentMarker; /*if (_treasureDistance <= 200) then { if (markerType _currentMarker == "respawn_naval")) then { _marker = _currentMarker; } else { if ((markerShape _currentMarker == "ELLIPSE") && (markerBrush _currentMarker == "DiagGrid")) then { _area = _currentMarker; }; }; };*/ _i = _i + 1; } Your while loop looks fine. I think the root cause of your problem is distance2D. _currentMarker is not an object or position so distance2D will throw an error. To correct this, get the marker's position using getMarkerPos. Like so: _treasureDistance = _treasure distance2D getMarkerPos(_currentMarker); Also, I would suggest replacing your while loop with a forEach loop as it is more fitting for this use case. 1 Share this post Link to post Share on other sites