ConanOfOz 0 Posted February 13, 2002 Here's the scenario. From within the Initialization of one member of a group (usually the leader) I have... </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">units group this exec "AddMeAndMine.sqs" <span id='postcolor'> The AddMeAndMine script is expecting a parameter of type Group (I hope!), and has (so far) only only line... </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">"?!(_x in AllUnits): AllUnits = AllUnits + [_x]" ForEach (_this) <span id='postcolor'> When I Preview this mission, I get the error... </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">'|#|?!(_x in AllUnits): AllUnits = AllUnits + [_x]':Error Invalid number in expression <span id='postcolor'> I don't understand what I've done wrong. BTW, is there a way to get the error message to persist on screen, or is there an error log written somewhere? It's a real pain in the arse to get a long-ish error message like this one recorded... Share this post Link to post Share on other sites
Bart.Jan 0 Posted February 14, 2002 Foreach can not be use with condition. It's only for use with commands. You can use this script : </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">allunits=[] _count=count _this _i=0 #more ?!((_this select _i) in allunits): allunits=allunits+[_this select _i] _i = _i + 1 ? _i < _count : goto "more" exit<span id='postcolor'> It's important to make empty array (allunits=[]) before you first start work with it. Share this post Link to post Share on other sites
ConanOfOz 0 Posted February 14, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Bart.Jan @ Feb. 15 2002,07:03)</td></tr><tr><td id="QUOTE">Foreach can not be use with condition. It's only for use with commands. You can use this script : </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">allunits=[] _count=count _this _i=0 #more ?!((_this select _i) in allunits): allunits=allunits+[_this select _i] _i = _i + 1 ? _i < _count : goto "more" exit<span id='postcolor'> It's important to make empty array (allunits=[]) before you first start work with it.<span id='postcolor'> Thanks Bart. About the error message itself... Do you know if this is logged anywhere? It tends to be onscreen too short a time to take down (especially if I have a few coming up ) Share this post Link to post Share on other sites
Bart.Jan 0 Posted February 17, 2002 I don't know about error log. Only possible way is to take screenshot by printscreen key. But I think sometimes an error message doesn't fit a simple line on screen. Share this post Link to post Share on other sites
nierop 0 Posted June 27, 2003 For answer see: OFPEC forum Bye, Share this post Link to post Share on other sites