spitfire007 10 Posted April 29, 2015 I can't see why this is not passing the _selectedBuilding out once the position is not less than 1000. _posSelectedBuilding passes fine when the first value of the array is over 1000 but _selectedBuilding = any ?? going blind and tired .. _posSelectedBuilding =0; while {_posSelectedBuilding < 1000} do { _selectedBuilding = _buildingsArray call BIS_fnc_selectRandom; _posSelectedBuilding = getPosASL _selectedBuilding; _posSelectedBuilding = _posSelectedBuilding select 0; }; diag_log format ["#################### _posSelectedBuilding in _posSelectedBuilding = %1", _posSelectedBuilding]; diag_log format ["#################### _selectedBuilding in _selectedBuilding = %1", _selectedBuilding]; Share this post Link to post Share on other sites
gc8 972 Posted April 29, 2015 What is the script supposed to do? Share this post Link to post Share on other sites
gersen 10 Posted April 29, 2015 maybe because _selectedBuilding is an object Share this post Link to post Share on other sites
jshock 512 Posted April 29, 2015 Try intially declaring "_posSelectedBuilding" as an empty array instead of an integer: _posSelectedBuilding = []; Share this post Link to post Share on other sites
gersen 10 Posted April 29, 2015 Try intially declaring "_posSelectedBuilding" as an empty array instead of an integer: _posSelectedBuilding = []; yes, the position is an array Share this post Link to post Share on other sites
st_dux 26 Posted April 29, 2015 _selectedBuilding is showing up as "any" because you haven't declared it outside of the while loop's scope; thus, the variable is meaningless outside of the loop. Put "_selectedBuilding = objNull;" right below your first line (before the while loop) to solve this problem. See also: http://community.bistudio.com/wiki/Variables#Scope Share this post Link to post Share on other sites
spitfire007 10 Posted April 30, 2015 Thanks Guys, Scope... ! ST_Dux nailed it. Thanks Dux Share this post Link to post Share on other sites