jibun 1 Posted September 23, 2018 When i do something like this: {_array set [_forEachIndex, _x + 1]} forEach _array It throws me an "Type Any expected Number" error. After further investigation i revealed that _forEachIndex is scalar bool array string 0xfcffffef, which means that there's no variable named _forEachIndex. How to fix it? Share this post Link to post Share on other sites
gc8 970 Posted September 23, 2018 What's in _array? Share this post Link to post Share on other sites
gc8 970 Posted September 23, 2018 Just noticed this is for arma 1. the _forEachIndex maybe isn't available for that game wiki Share this post Link to post Share on other sites
jibun 1 Posted September 23, 2018 15 minutes ago, gc8 said: What's in _array? Coordinates. 12 minutes ago, gc8 said: Just noticed this is for arma 1. the _forEachIndex maybe isn't available for that game wiki My bad, thought that it should be available in OFP aswell since there is no remarks saying that _forEachIndex is present since ArmA 1/2/3 and not available in OFP. Share this post Link to post Share on other sites
Dedmen 2590 Posted September 27, 2018 Seems like _forEachIndex was added in 2010https://community.bistudio.com/wiki?title=forEach&diff=59114&oldid=57534 I think that was Arma 2 timeframe Share this post Link to post Share on other sites
prototype1479 63 Posted September 30, 2018 you need to use _x instead of _foreachindex Share this post Link to post Share on other sites
Dedmen 2590 Posted October 2, 2018 On 30.9.2018 at 6:33 AM, prototype1479 said: you need to use _x instead of _foreachindex That doesn't make sense. _x and _forEachIndex are completely different things. And if you look at his code you'll see that _x won't work. Share this post Link to post Share on other sites
prototype1479 63 Posted October 3, 2018 Well don't you have to use _x in OFP if you are using foreach command? His code is hella flawed yeah I know he really needs to give more info about what are these arrays and variables. But he probably figured out by now Share this post Link to post Share on other sites
Dedmen 2590 Posted October 4, 2018 19 hours ago, prototype1479 said: His code is hella flawed yeah I know he really needs to give more info about what are these arrays and variables. Well according to his code he wants to increment each number in the array. Solution would probably be to just use a normal for loop then. 19 hours ago, prototype1479 said: Well don't you have to use _x in OFP if you are using foreach command? _x is the element that's currently being iterated over yeah... But you don't HAVE TO use it. Share this post Link to post Share on other sites
prototype1479 63 Posted October 4, 2018 You mean no one has to use _x in foreach or he only? Share this post Link to post Share on other sites
Dedmen 2590 Posted October 5, 2018 18 hours ago, prototype1479 said: You mean no one has to use _x in foreach or he only? No one. You can do whatever you want in there. 1 Share this post Link to post Share on other sites
faguss 64 Posted October 6, 2018 _i=0; {_array set [_i _x + 1]; _i=_i+1} forEach _array 2 Share this post Link to post Share on other sites