dr death jm 117 Posted September 24, 2016 ok so basically I'm editing some code of load outs, and as I am told call Bis_fnc_Param (is no good). and private []; "should be" params []; but as I do so, (change code) I see no difference. old Private ["_unit","_PERIdent","_Randomise","_role","_Uniforms","_Voice","_Uniform","_Headgear","_Goggles"]; _unit=[_this,0,objNull,[ObjNull]] call Bis_fnc_Param; _PERIdent=[_this,1,true,[true]] call Bis_fnc_Param; _Randomise=[_this,2,true,[true]] call Bis_fnc_Param; _role=typeOf _unit; new params ["_unit","_GBIdent","_Randomise","_role","_Uniform","_Uniforms","_Voice","_Headgear","_Goggles"]; _unit = param [0]; _GBIdent = param [1]; _Randomise = param [1]; _role = typeOf _unit; why is the reason of using params to private, or the reason to need to change and not use call Bis_fnc_Param ? I don't see the optimization. I'm Only asking so ill have a better understanding wiki explains params ["_one","_two","three"]; blah blah blah [1,2,3]; better yet I wish people posting in wiki would sometimes remember that no everybody understands and maybe should post some working code as an example kinda like what I posted above (but with the rest of the code). Share this post Link to post Share on other sites
davidoss 552 Posted September 24, 2016 params [["_unit", objNull, [objNull]], ["_PERIdent", true, [true]], ["_Randomise", true, [true]]]; private _role = typeOf _unit; or _this select 0 params ["_unit", objNull,[objNull]]; _this select 1 params ["_PERIdent", true, [true]]; _this select 2 params ["_Randomise", true, [true]]; private _role = typeOf _unit; or params ["_unit", "PERIdent", "_Randomise"]; private _role = typeOf _unit; if you not need to predefine variables values (if not passed) 1 Share this post Link to post Share on other sites
JasperRab 26 Posted September 24, 2016 https://community.bistudio.com/wiki/params https://community.bistudio.com/wiki/private params sets your variables, so when you used to do this, _unit = param [0]; _GBIdent = param [1]; _Randomise = param [1]; You can do it simpler (and better) like this, params ["_unit","_GBIdent","_Randomise"]; with params you dont need to make the variables private. ( private ["_var"]; ) 1 Share this post Link to post Share on other sites
R3vo 2654 Posted September 24, 2016 If you use params or param, make sure to set default values and define the data types, otherwise you could simply use _this select x 1 Share this post Link to post Share on other sites
killzone_kid 1332 Posted September 25, 2016 https://community.bistudio.com/wiki/params see example 1 1 Share this post Link to post Share on other sites
dr death jm 117 Posted September 25, 2016 k thanks guys , killzone_kid, gotta love ya , you sent me right to the link I had complained of , lol.. R3vo, yep, I'm using _this select _x or x <---? jasperRap, not fully a complete answer, but I understand (i think). So Davidoss, params ["_unit","_GBIdent","_Randomise","_role","_Uniform","_Uniforms","_Voice","_Headgear","_Goggles"]; you are saying should be: params ["_unit","_GBIdent","_Randomise"]; no need for predrifning, "_Uniform","_Uniforms","_Voice","_Headgear","_Goggles" , I didn't post full code but "_Uniform","_Uniforms","_Voice","_Headgear","_Goggles" are variables further down the code, so just to say and ask, if i get an undefined (error) then add it to my params ["_unit","_GBIdent","_Randomise"]; and _role should be private I think jasperRap,was saying the same thing, but not to use private, I'll go thru and change code and test, Im just trying to get the code proper so the only time ill need to change it again is if there's a bis update that requires it thanks again for your time and help.. Share this post Link to post Share on other sites
dr death jm 117 Posted September 25, 2016 update (about hour later) so far works. params [["_Unit", objNull, [objNull]],["_GBIdent", true, [true]],["_Randomise", true, [true]],"_role","_Uniform","_Uniforms","_Voice","_Headgear","_Goggles"]; private _role = typeOf _Unit; what is the private for? could it be _role = typeOf _Unit; not that im getting errors from this, I just wanted to know the reason and in case this may make a difference the load out is ai only not for players. Share this post Link to post Share on other sites
R3vo 2654 Posted September 25, 2016 See Example 3 https://community.bistudio.com/wiki/private Private makes the variable only available in the inner most scope, preventing it from interfering with inline functions or other code structures. As a rule of thumb: It's good habit to set alle local variables private where possible. Just as extra security. 1 Share this post Link to post Share on other sites
davidoss 552 Posted September 25, 2016 params [ ["_Unit", objNull, [objNull]], ["_GBIdent", true, [true]], ["_Randomise", true, [true]] ]; private ["_role","_Uniform","_Uniforms","_Voice","_Headgear","_Goggles"]; Private variables are defined in below code of that script and as Revo said are private to script. You can join private variables into params array but its better to define them as private 1 Share this post Link to post Share on other sites
dr death jm 117 Posted September 25, 2016 See Example 3 https://community.bistudio.com/wiki/private Private makes the variable only available in the inner most scope, preventing it from interfering with inline functions or other code structures. As a rule of thumb: It's good habit to set alle local variables private where possible. Just as extra security. params [ ["_Unit", objNull, [objNull]], ["_GBIdent", true, [true]], ["_Randomise", true, [true]] ]; private ["_role","_Uniform","_Uniforms","_Voice","_Headgear","_Goggles"]; Private variables are defined in below code of that script and as Revo said are private to script. You can join private variables into params array but its better to define them as private Awesome guys , this has been a lot of help. and info. Share this post Link to post Share on other sites