The Real Bunc 137 Posted May 15, 2019 I've been been parameterising my DynamicCamo script so that a set of arguments are passed to the spawned script to make adjustment easier. The spawn goes like this from a units init camo = [this, "DEBUG", "aswitch", 0,1,0,1] spawn compile preprocessfile "camoscript.sqf"; I tried to pick up these arguments in the script itself using params [_unit, _debug, _switch, _cLo, _cHi, _aLo, _aHi]; but I constantly got errors and it would not get past the first assignment ie it was throwing errors when trying to assign this from the spawn argument array to the local variable _unit. neither did the other local variables in the params line seem to be getting properly assigned. But it works when in the script I do the following ; _unit = _this select 0; _debug = _this select 1; etc. I thought params was supposed to be a replacement for this more longwinded way of assigning parameter values? I notice in the Biki for Params command that there is no mention of using params with spawn. But it does say that it passes an array of arguments into an array of local variables in the params array. Does this not work for spawn? Does it only work for Call or execVM ? Or is there something wrong with my params construction? Ive got things working using the _this select n approach but Id like to use the params [_variable, _variable1, ….] approach as its tidier and can include data type checks and default values. Any help would be appreciated. I thought I had a handle on params but clearly I'm doing something wrong. Share this post Link to post Share on other sites
POLPOX 779 Posted May 15, 2019 Read the documentation carefully. params takes string to work. params ["_unit", "_debug", "_switch", "_cLo", "_cHi", "_aLo", "_aHi"]; 1 Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted May 15, 2019 Params needs to be declared using strings, in your case it should be this: params ["_unit", "_debug", "_switch", "_cLo", "_cHi", "_aLo", "_aHi"]; If something doesn't work the way it should, always check the wiki. Cheers Share this post Link to post Share on other sites
gc8 981 Posted May 15, 2019 Also 7 minutes ago, The Real Bunc said: camo = [this, "DEBUG", "aswitch", 0,1,0,1] spawn compile preprocessfile "camoscript.sqf"; I believe this is same as (execVM): camo = [this, "DEBUG", "aswitch", 0,1,0,1] execVM "camoscript.sqf"; 1 Share this post Link to post Share on other sites
The Real Bunc 137 Posted May 15, 2019 Damn, I thought it was probably something simple I was missing. I must have read that Params wiki page about five times and not spotted that the params was using quotes around the variables! Going to have another look at my script now. Thanks for the very helpful comments guys. Ill check out execVM equivalence as well. Share this post Link to post Share on other sites
Dedmen 2724 Posted May 17, 2019 On 5/15/2019 at 4:27 PM, gc8 said: I believe this is same as (execVM) I think execVM might be preproc with line numbers. But yeah it's essentially the same. Share this post Link to post Share on other sites