Blanco 0 Posted July 31, 2003 hello, I've made a small script where I order a group to move to an array of markers. There's no problem with the script but I want it so the user can put all the markernames in an array in the exec-line, so I don't have to write a new script for every new unit... something like this : [bob,["m1","m2","m3"]] exec "markermove.sqs" but I don't have a clue how to change the script then... Her's what I have now... Quote[/b] ];markermove.sqs ;autor <yBlanco> ;created 31/07/2003 3:40:34 ;; execute  [unitname]exec "markermove.sqs" _unit = _this select 0 _grp = group _unit _markersarray = ["m1","m2","m3"]                           _allmarkers = count _markersarray _i = 0 #start ?"alive _x" count units _grp <= 0 : exit "_x doMove getmarkerpos (_markersarray select _i)" ForEach (units _Grp) @unitready units _grp _i = _i + 1 ~.5 ?_i < _allmarkers : goto "start" plz help Blanco Share this post Link to post Share on other sites
Bart.Jan 0 Posted July 31, 2003 [bob,["m1","m2","m3"]] exec "markermove.sqs" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _unit = _this select 0 _grp = group _unit _markersarray = _this select 1 _allmarkers = count _markersarray ... Share this post Link to post Share on other sites
crashdome 3 Posted July 31, 2003 as above but you may want to replace your #start with: #start ?"alive _x" count units _grp <= 0 : exit ? !(_markersarray IsNull):"_x doMove getmarkerpos (_markersarray select _i)" ForEach (units _Grp) @ ((unitready units _grp) or (_markersarray IsNull)) _i = _i + 1 ~.5 ?_i < _allmarkers : goto "start" exit that is just a precaution in case the user fails to supply an array of markers when executing the script. In that case the script will just exit and not supply an error message disrupting the game. To be safe you should add a hint just before the "_i = _i + 1"... ? (_markersarray IsNull):hint ("No markers supplied to .... script") that way it will even tell the user what is exactly wong Share this post Link to post Share on other sites
Blanco 0 Posted August 1, 2003 Thx guys, works great, Actually I tried _markersarray = _this select 1 before, but it was early in the morning and I was too tired to script, I think. My first post here & I'm very pleased with the respons! Thx again Blanco out Is there somewhere a "solved" button like at www.ofpec.com? Share this post Link to post Share on other sites