Jump to content
Sign in to follow this  
cougarxr7

Vehicle position occupied script

Recommended Posts

Larrow,

I did what you said,

Deleted "terminate h;", actually just blocked // out.

Changed the following line'

_turretPath = _position select 1;

to.

_turretPath = [_position, 1, nil, [ [] ] ] call BIS_fnc_param;

However, now I am getting some errors in the RPT.

Error in expression <
if (isnil "_value") then {
_value = _default;
};
if (_thisCount > 3) then >
 Error position: <_default;
};
if (_thisCount > 3) then >
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 65
Error in expression <typeDefault = typename _default;
if !({_type == typename _x} count _types > 0) >
 Error position: <_type == typename _x} count _types > 0) >
 Error Undefined variable in expression: _type
File A3\functions_f\Debug\fn_param.sqf, line 75
Error in expression <name _x} count _types > 0) then {
if ({_typeDefault == typename _x} count _type>
 Error position: <_typeDefault == typename _x} count _type>
 Error Undefined variable in expression: _typedefault
File A3\functions_f\Debug\fn_param.sqf, line 77
Error in expression <ult %2 is type %3, must be %4",_id, str _default, _typeDefault, _textTypes] call>
 Error position: <_default, _typeDefault, _textTypes] call>
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 88
Error in expression <pes = _this select 3;
_type = typename _value;
_typeDefault = typename _default>
 Error position: <_value;
_typeDefault = typename _default>
 Error Undefined variable in expression: _value
File A3\functions_f\Debug\fn_param.sqf, line 72
Error in expression <d,_value] call bis_fnc_error;
};
};
};
_value
} else {
if (isnil "_value") then>
 Error position: <_value
} else {
if (isnil "_value") then>
 Error Undefined variable in expression: _value
File A3\functions_f\Debug\fn_param.sqf, line 108
Error in expression <ypename _value;
_typeDefault = typename _default;
if !({_type == typename _x} c>
 Error position: <_default;
if !({_type == typename _x} c>
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 73
Error in expression <ypename _value;
_typeDefault = typename _default;
if !({_type == typename _x} c>
 Error position: <_default;
if !({_type == typename _x} c>
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 73
Error in expression <ypename _value;
_typeDefault = typename _default;
if !({_type == typename _x} c>
 Error position: <_default;
if !({_type == typename _x} c>
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 73
Error in expression <
if (isnil "_value") then {
_value = _default;
};
if (_thisCount > 3) then >
 Error position: <_default;
};
if (_thisCount > 3) then >
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 65
Error in expression <typeDefault = typename _default;
if !({_type == typename _x} count _types > 0) >
 Error position: <_type == typename _x} count _types > 0) >
 Error Undefined variable in expression: _type
File A3\functions_f\Debug\fn_param.sqf, line 75
Error in expression <pes = _this select 3;
_type = typename _value;
_typeDefault = typename _default>
 Error position: <_value;
_typeDefault = typename _default>
 Error Undefined variable in expression: _value
File A3\functions_f\Debug\fn_param.sqf, line 72
Error in expression <name _x} count _types > 0) then {
if ({_typeDefault == typename _x} count _type>
 Error position: <_typeDefault == typename _x} count _type>
 Error Undefined variable in expression: _typedefault
File A3\functions_f\Debug\fn_param.sqf, line 77
Error in expression <ult %2 is type %3, must be %4",_id, str _default, _typeDefault, _textTypes] call>
 Error position: <_default, _typeDefault, _textTypes] call>
 Error Undefined variable in expression: _default
File A3\functions_f\Debug\fn_param.sqf, line 88
Error in expression <d,_value] call bis_fnc_error;
};
};
};
_value
} else {
if (isnil "_value") then>
 Error position: <_value
} else {
if (isnil "_value") then>
 Error Undefined variable in expression: _value
File A3\functions_f\Debug\fn_param.sqf, line 108

Just out of curiosity I extracted the function pbo from the addon folder.

Look at those lines the RPT refer to.

Hard to understand why BI own file is throwing these errors???

Thanks for your help!

Edit!

Not meaning to sound rude to the devs at BI, their ability to do what they do is amazing to me!

I know I cannot do what they do!!!

"It just it's curiosity that kills the cat!!!"

Edited by Cougarxr7

Share this post


Link to post
Share on other sites

Ah , thats what comes from posting at work while holding a sandwich in one hand and talking about project progress with the boss :)

My intention was to just pass back an empty array but ive and put a nil there :/ . So pretty much what was happening before but instead of the RPT error BIS_fnc_param was telling me im a fecking idiot lol.

_turretPath = [_position, 1, [] ] call BIS_fnc_param;

You could also just move the original line to between these two lines instead. Then it wont try to access select 1 until we actually know there is a turret path to access, which makes more sense.

                case "Turret" : {
					  _turretPath = _position select 1;
                   switch (_turretPath) do {

BIS_fnc_param just seem like an easier option at the time and maybe introduce something new for you to look up. :evil:

Share this post


Link to post
Share on other sites

OK!!!!! Now I am really curious, what kind of sandwich???

Changed the code,

_turretPath = [_position, 1, [] ] call BIS_fnc_param; 

From what I read this is how the array is read.

select 0 is "_position"< I can understand position.

select 1 is "1" < not sure what 1 is for?

select 2 is "[empty array]" not sure what the empty array is for?

Is that correct?

Although I never saw a "select 0 or select 2" in the script code.

I am trying to understand arrays and their meaning to the select command.

Added.

                case "Turret" : { 
                         _turretPath = _position select 1; 
                   switch (_turretPath) do {  

No RPT errors

Thanks again!!!

Edited by Cougarxr7

Share this post


Link to post
Share on other sites

An array is basically a list of stuff, can be anything numbers, strings, objects etc and can be a mixture of any.

As we know _position = assignedVehicleRole player can return ....

["Driver"] a string

["Cargo"] a string

["Turret", [0] ] a string and an array

["Turret", [1] ] a string and an array

The select command will return what is at the specified index, remember arrays first index is 0 so..

result = [ "hello", "world" ] select 0;    //will return the string "hello"
result = [ "hello", "world" ] select 1;    //will return the string "world"

Our problem was that occasionally we had..

["Driver"] select 1; There is nothing at index 1 so we would get an error

Bis_fnc_param

[ array to check, index to get, default return value] call BIS_fnc_param

breaking our line down

[ _position, 1, [] ] call BIS_fnc_param

which could look like

[ ["Driver"], 1, [] ] call BIS_fnc_param

As ["Driver"] has no index 1 it will return [] instead

or could be

[ [ "Turret", [0] ], 1, [] ] call BIS_fnc_param

Here [ "Turret", [0] ] does have an index 1 so it will return [0]

Hope that makes some sense :) Chicken salad btw :P

Share this post


Link to post
Share on other sites

Larrow,

Thank you for the help, I am doing allot of reading concerning all scripting.

I hope you will not mind if I poke you once in awhile with a question or 2.

Again thanks!

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  

×