jshock 513 Posted October 5, 2014 (edited) I have read the wiki page, and understand most of it, but it doesn't answer the following questions: For the default value and data type, can it be Boolean (as in the use of true/false) or does it just use 1 or 0 as it's Boolean check? And secondly, the index is no different then saying (_this select 0) or (_this select 1), correct? For example if I have something that looks like this: nul = [1, 2] execVM "script.sqf"; //script.sqf _number = (_this select 0); _secondNumber = (_this select 1); //is no different than _number = [_this, 0 , 0, 0] call BIS_fnc_param; _secondNumber = [_this, 1, 0, 0] call BIS_fnc_param; Disregard second question, found the answer :p. And if I was going for a patrol operation type mission, and I would like to define what mission is being played, either by randomization, or by passed arguement, would that look something like this: private ["_mission", "_random"]; _mission = [_this, 0, 0, 0] call BIS_fnc_param; _random = [_this, 1, false, 0] call BIS_fnc_param; if (_random) then { _mission = floor(random 5); } else { switch (_mission) do { case 0: {}; case 1: {}; case 2: {}; case 3: {}; case 4: {}; case 5: {}; default: {}; }; }; Edited October 5, 2014 by JShock Share this post Link to post Share on other sites
654wak654 25 Posted October 5, 2014 I'd assume it's something like: [color="#FF8040"][color="#1874CD"]_variable[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#000000"]_this[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color]BOOL[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_param[color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 5, 2014 (edited) I have read the wiki page, and understand most of it, but it doesn't answer the following questions:For the default value and data type, can it be Boolean (as in the use of true/false) or does it just use 1 or 0 as it's Boolean check? If you want the parameter to be of a specific type e.g. boolean, you need to provied that in an array as fourth parameter for BIS_fnc_param like this: [color=#FF8040][color=#1874CD]_trueOrFalseThingy[/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#000000]_this[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b],[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#000000]true[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b]][/b][/color] [color=#191970][b]call[/b][/color] BIS_fnc_param[color=#8B3E2F][b];[/b][/color][/color] It doesn't matter if you put "true" or "false" into the type-check-array (I believe), what matters is the data type of what's in there. You can put more than one data type in there if you want to say, the e.g. _trueOrFalseThingy can bei a boolean or a string or an object: [color=#FF8040][color=#1874CD]_trueOrFalseThingy[/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#000000]_this[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b],[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#000000]true[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]""[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]objNull[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b]][/b][/color] [color=#191970][b]call[/b][/color] BIS_fnc_param[color=#8B3E2F][b];[/b][/color][/color] EDIT: For your second question, you could do it like this: [color=#FF8040][color=#1874CD]_mission[/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#000000]_this[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]-1[/color][color=#8B3E2F][b],[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#FF0000]0[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b]][/b][/color] [color=#191970][b]call[/b][/color] BIS_fnc_param[color=#8B3E2F][b];[/b][/color] [color=#191970][b]if[/b][/color][color=#8B3E2F][b]([/b][/color][color=#1874CD]_mission[/color] [color=#191970][b]isEqualTo[/b][/color] [color=#FF0000]-1[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]then[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#1874CD]_mission[/color] [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]floor[/b][/color] [color=#191970][b]random[/b][/color] [color=#FF0000]6[/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]switch[/b][/color] [color=#8B3E2F][b]([/b][/color][color=#1874CD]_mission[/color][color=#8B3E2F][b])[/b][/color] [color=#191970][b]do[/b][/color] [color=#8B3E2F][b]{[/b][/color] [color=#191970][b]case[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b]:[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]case[/b][/color] [color=#FF0000]1[/color][color=#8B3E2F][b]:[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]case[/b][/color] [color=#FF0000]2[/color][color=#8B3E2F][b]:[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]case[/b][/color] [color=#FF0000]3[/color][color=#8B3E2F][b]:[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]case[/b][/color] [color=#FF0000]4[/color][color=#8B3E2F][b]:[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]case[/b][/color] [color=#FF0000]5[/color][color=#8B3E2F][b]:[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#191970][b]default[/b][/color] [color=#8B3E2F][b]{[/b][/color][color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color] [color=#8B3E2F][b]}[/b][/color][color=#8B3E2F][b];[/b][/color][/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. Regards, waltenberg aka Johnny Edited October 11, 2014 by waltenberg Share this post Link to post Share on other sites
Jona33 51 Posted October 5, 2014 I'd assume it's something like: [color="#FF8040"][color="#1874CD"]_variable[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#000000"]_this[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b][[/b][/color]BOOL[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_param[color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Close, _variable=[_this,0,false,[false]] call Bis_fnc_Param; That argument takes an array of examples of a compatible data type (at least I've always used it that way) as opposed to the typeName of that data type. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 5, 2014 (edited) I'd assume it's something like: [color=#FF8040][color=#1874CD]_variable[/color] [color=#8B3E2F][b]=[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#000000]_this[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b],[/b][/color] [color=#8B3E2F][b][[/b][/color]BOOL[color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b]][/b][/color] [color=#191970][b]call[/b][/color] BIS_fnc_param[color=#8B3E2F][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter That's not correct. The mentioned array takes data of the datatypes which should be allowed. You can use "" (empty string) to indicate that string is allowed. You can use 0 or any other number to indicate that numbers are allowed. Same goes for objNull (objects), true (boolean), [] (array) etc. EDIT: Well, ninja'd Edited October 11, 2014 by waltenberg Share this post Link to post Share on other sites
jshock 513 Posted October 5, 2014 Close, _variable=[_this,0,false,[false]] call Bis_fnc_Param; That argument takes an array of examples of a compatible data type (at least I've always used it that way) as opposed to the typeName of that data type. So, just to check my understanding of it, the fourth parameter as you and Waltenberg have put, as long as it contains false or true, the function understands that the data type coming in needs to be Boolean, correct? It's not saying that the dataType coming in has to be either false or true. And since we all seem to be writing over eachother, Waltenberg already qualified my question :p. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 5, 2014 We are all glad to have helped you. ;) PS: Had to slightly correct my post in the switch-do part as "floor random 5" will never be 5, but maximum 4. Share this post Link to post Share on other sites
654wak654 25 Posted October 5, 2014 Whoops! My bad, should have guessed it's an example from all the other forms. Also good to know the SQF to BBCode converter is getting popular :). Share this post Link to post Share on other sites
jshock 513 Posted October 5, 2014 PS: Had to slightly correct my post in the switch-do part as "floor random 5" will never be 5, but maximum 4. I was actually just about to check to make sure that was right as well, we must be on the same thought pattern today :p. And also thanks for the other way of doing the "random" portion of the mission variable, the fewer variables and arguments needed to be passed the better :D. @Jona and @654wak654 thanks for your help as well, much appreciated! Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted October 5, 2014 (edited) You're welcome. ^_^ And final thought: "default" MUST NOT have a ":" after it. ;) Edited October 5, 2014 by waltenberg Share this post Link to post Share on other sites
dreadedentity 278 Posted October 5, 2014 I thought of the "accepted variable types" parameter as an "example" of the data type you'd like to use, ie. false, [], "", 0, objNull. It should even work with side types, ie. west, east, civilian, independent ---------- Post added at 19:03 ---------- Previous post was at 18:50 ---------- As a coincidence, I had the wiki page for typeName open in another tab, it shows all of the "null" variable types (Example 3). All of them should work, but I haven't tested it. Share this post Link to post Share on other sites
jshock 513 Posted October 7, 2014 Ok, so in part related, or at least from what I can tell from the directory given by this error message. What would cause the below error message: https://www.dropbox.com/s/hccwqd153zlgktx/error.jpg?dl=0 Share this post Link to post Share on other sites
dreadedentity 278 Posted October 7, 2014 Ok, so in part related, or at least from what I can tell from the directory given by this error message.What would cause the below error message Well it looks like you broke BIS_fnc_param lol. I'll need to see the script you were trying to run when the error happened to help you at all. Share this post Link to post Share on other sites
jshock 513 Posted October 7, 2014 Well it looks like you broke BIS_fnc_param lol. I'll need to see the script you were trying to run when the error happened to help you at all. Well then....who knew I could be so good as to break BIS parent functions....check our PM messages for the link :p. BTW was just using the fn_defend.sqf with the fn_garrison.sqf as the testing scripts, all the rest are just blank/just hint something. Share this post Link to post Share on other sites