Rebitaay 13 Posted March 14, 2017 I'm making a script for my mission that selects all of the caches (placed in editor) and moves them to a random building, but that's besides the point. In order to test a new method of moving them, I'm doing this to make sure they're being selected properly: initServer.sqf {[_x] execVM "Scripts\MoveCaches.sqf";} forEach [Cache1,Cache2,Cache3,Cache4,Cache5,Cache6]; MoveCaches.sqf private "_cache"; _cache = _this select 0; systemChat format["%1",_cache]; In system chat, Caches 1-6 appear, but there is also an extra "any" which is causing this error. Why is this happening, and how can I prevent it? - Thanks Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 14, 2017 something else also calls moveCaches.sqf without argument 1 Share this post Link to post Share on other sites
Rebitaay 13 Posted March 14, 2017 9 minutes ago, killzone_kid said: something else also calls moveCaches.sqf without argument That was it! I've fixed the issue now, thank you! And also, thank you for your many contributions to the wiki, and your tutorials. I kept seeing your name all over the place when learning to script, and your content has helped me a ton. Share this post Link to post Share on other sites
serena 150 Posted March 14, 2017 Get all caches implicitly: AllCaches = { private _res = []; private _obj = nil; while {_obj = missionNamespace getVariable "Cache" + str (count _res + 1); not isNil {_obj}} do { _res pushBack _obj}; _res }; call AllCaches // Result: [Cache1,Cache2,Cache3,Cache4,Cache5,Cache6] Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 14, 2017 1 hour ago, serena said: Get all caches implicitly: I raise you with this one liner (allVariables missionNamespace select {_x find "cache" isEqualTo 0 && {_x select [5] call {str parseNumber _this isEqualTo _this}}}) apply {missionNamespace getVariable _x} 1 Share this post Link to post Share on other sites
serena 150 Posted March 14, 2017 count allVariables missionNamespace // result for blank mission: 1308 Faster than light :) P.S. I like this: _x select [5] call {str parseNumber _this isEqualTo _this} 1 Share this post Link to post Share on other sites
killzone_kid 1326 Posted March 14, 2017 Yeah but my script gets every and all Cache vars even if you have some missing in between 1 Share this post Link to post Share on other sites
Larrow 2801 Posted March 15, 2017 4 hours ago, killzone_kid said: I raise you with this one liner No not the one line quiz again. :) 3 Share this post Link to post Share on other sites