Jump to content
Sign in to follow this  
cougarxr7

Error in expression!

Recommended Posts

Here is the error.

19:55:58 Error in expression <

deleteGroup _obj;

} else {

if (!isNull _obj) then

{

deleteVehicle _obj;

};

};

}>

2014/08/18, 19:55:58 Error position: <_obj) then

{

deleteVehicle _obj;

};

};

}>

2014/08/18, 19:55:58 Error Undefined variable in expression: _obj

2014/08/18, 19:55:58 File mpmissions\__cur_mp.Altis\sm\sideMissions.sqf, line 74

2014/08/18, 19:55:58 Error in expression <sArray select _c;

_isGroup = false;

if (_obj in allGroups) then { _isGroup = tru>

2014/08/18, 19:55:58 Error position: <_obj in allGroups) then { _isGroup = tru>

2014/08/18, 19:55:58 Error Undefined variable in expression: _obj

2014/08/18, 19:55:58 File mpmissions\__cur_mp.Altis\sm\sideMissions.sqf, line 63

		for "_c" from 0 to (count _unitsArray) do
		{
			_obj = _unitsArray select _c;
			_isGroup = false;
			if (_obj in allGroups) then { _isGroup = true; } else { _isGroup = false; };
			if (_isGroup) then
			{
				{
					if (!isNull _x) then
					{
						deleteVehicle _x;
					};
				} forEach (units _obj);
				deleteGroup _obj;
			} else {
				if (!isNull _obj) then
				{
					deleteVehicle _obj;
				};
			};
		};

Error Undefined variable in expression: _obj< how can that be undefined when >_obj = _unitsArray select _c;< does that not define it?

Anybody figure this error out?

Thanks!

Share this post


Link to post
Share on other sites

_unitsArray has (count _unitsArray) elements but its last index is (count _unitsArray - 1)

i.e.

for "_c" from 0 to (count _unitsArray - 1) do
...

Share this post


Link to post
Share on other sites

The units command is never going to return a null object so I'd removed the check there (unless something running parallel to this is also deleting objects). Could do the same thing for objects depending on where _unitsArray is coming from. There's also no need for the _isGroup variable (that I can see) as you can just check whether it's a group in the if statement below.

Sorry if that seems nitpicky, feel free to ignore me :)

And yeah, Master85 has you covered on the error.

Share this post


Link to post
Share on other sites

Still throwing an error!

Error in expression <m 0 to (count _unitsArray - 1) do

_obj = _unitsArray select _c;

_isGroup = fals>

Error position: <= _unitsArray select _c;

_isGroup = fals>

Error Missing ;

for "_c" from 0 to (count _unitsArray - 1) do 
{
			_obj = _unitsArray select _c;
			_isGroup = false;
			if (_obj in allGroups) then { _isGroup = true; } else { _isGroup = false; };
			if (_isGroup) then
			{
				{
					if (!isNull _x) then
					{
						deleteVehicle _x;
					};
				} forEach (units _obj);
				deleteGroup _obj;
			} else {
				if (!isNull _obj) then
				{
					deleteVehicle _obj;
				};
			};
		};

I think I might have figured out my problem!

Edited by Cougarxr7
solved maybe

Share this post


Link to post
Share on other sites

This is this new error it is throwing!

Error in expression <r "_c" from 0 to (count _unitsArray -1) do

{

_obj = _unitsArray select _c;

_isG>

2014/08/19, 19:10:00 Error position: <do

{

_obj = _unitsArray select _c;

_isG>

2014/08/19, 19:10:00 Error do: Type Array, expected code

_unitsArray = _this select 0;
for "_c" from 0 to (count _unitsArray -1) do 
{
	_obj = _unitsArray select _c;
	_isGroup = false; if (_obj in allGroups) then { _isGroup = true; };
	if (_isGroup) then
	{
	if (!isNull _x) then
		{ 
		deleteVehicle _x; }; } forEach (units _obj);
	} else {
	if (!isNull _obj) then
	{ 
	deleteVehicle _obj; 
	};
};

I am loss in how to fix this!

Anybody?

Thanks!

Share this post


Link to post
Share on other sites

you were missing some closing brackets. I tried to clean it up a bit. I think this is what you want.

_unitsArray = _this select 0;
for "_c" from 0 to (count _unitsArray -1) do {
_obj = _unitsArray select _c;
_isGroup = false; 
if (_obj in allGroups) then {_isGroup = true;};
if (_isGroup) then {
	if (!isNull _x) then { 
		{deleteVehicle _x;} forEach (units _obj);
	};
} else {
	if (!isNull _obj) then { 
		deleteVehicle _obj; 
	};
};
};

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  

×