Jump to content
Sign in to follow this  
jshock

Quick BIS_fnc_param Questions

Recommended Posts

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 by JShock

Share this post


Link to post
Share on other sites

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
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 by waltenberg

Share this post


Link to post
Share on other sites
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
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 by waltenberg

Share this post


Link to post
Share on other sites
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

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

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

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

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
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
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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×