jphilapy 0 Posted December 30, 2006 For some reason the following which works good in OFP is not working in arma: gogs = "NVGoggles"; _units3 = units east1; "_x addweapon gogs" foreach _units3; I get the error message: '"_x addweapon gogs" |#| foreach _units3;' Error foreach: type string, expected code What should I be doing differently? Thanks, Jeff Share this post Link to post Share on other sites
Big Dawg KS 6 Posted December 30, 2006 Code requires curled braces: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x addweapon gogs} foreach _units3; Share this post Link to post Share on other sites
charonos 0 Posted December 30, 2006 I can't test right now if it makes a difference but try brackets instead of the quotes, thats how i do foreach statements: {_x addweapon gogs} foreach _units3; and from the Biki: { STATEMENT; ... } forEach ARRAY; Hope that helps, Charon Share this post Link to post Share on other sites
jphilapy 0 Posted December 30, 2006 I can't test right now if it makes a difference but try brackets instead of the quotes, thats how i do foreach statements:{_x addweapon gogs} foreach _units3; and from the Biki: { Â Â STATEMENT; Â Â ... } forEach ARRAY; Hope that helps, Charon Hi guys, thanks for the help. Yes I tried the brackets and it works fine. However now this statement with brackets is broken, but with quotes it throws no error: unitpos = "UP"; {_x setunitpos unitpos} foreach _units3; Throws the same error that I quoted in my previous post "_x setunitpos unitpos" foreach _units3; Doesn't throw any error. Maybe foreach is inconsistent? Jeff Share this post Link to post Share on other sites
jphilapy 0 Posted December 30, 2006 nevermind, i think i solved my own problem. It appears that the variable i am using, unitpos, is now a command in arma. Fixed. Jeff Share this post Link to post Share on other sites