Jump to content
Sign in to follow this  
McArcher

Array of arrays

Recommended Posts

Does arma support array of arrays or array of mixed variables? If yes, what doesn't it like in this code??

if (not isServer) then 
{ 
private ["_n", "_crate", "_patternW", "_patternA", "_crateArray", "_i"];
_crate = _this select 0;
_n = _crate getVariable "crateID";
_patternW = [];
_patternW = + mcti_RUweapons_defaultNumbers;
_patternA = [];
_patternA = + mcti_RUmagazines_defaultNumbers;
mcti_JIP_crates = mcti_JIP_crates + [_crate, _patternW, _patternA];
publicVariable "mcti_JIP_crates";

// applying patterns
_crateArray = mcti_JIP_crates select _n;
_crate = _crateArray select 0;
_patternW = _crateArray select 1;
_patternA = _crateArray select 2;
clearMagazineCargo _crate;
clearWeaponCargo _crate;
_i = 0;
{
	if (_x > 0) then { _crate addWeaponCargo [ mcti_weapons_pattern select _i, _x] };
	_i = _i + 1;
} forEach _patternW;
_i = 0;
{
	if (_x > 0) then { _crate addMagazineCargo  [ mcti_magazines_pattern select _i, _x] };
	_i = _i + 1;
} forEach _patternA;

player groupChat format ["Crate #%1 initialized.", _n];
};

.rpt:

Unsupported language Russian in stringtable
Error in expression <_crates select _n;
_crate = _crateArray select 0;
_patternW = _crateArray select>
 Error position: <select 0;
_patternW = _crateArray select>
 Error select: Тип Объект, ожидаетÑÑ ÐœÐ½Ð¾Ð¶ÐµÑтво,Config entry
File mpmissions\__CUR_MP.Chernarus\mca_crate_initSelf.sqf, line 15
Creating debriefing

maybe some special syntax needed?

Edited by McArcher

Share this post


Link to post
Share on other sites

Wild guess: it has something to do with Russian... Use english config entries.

AFAIK arrays in arrays (in arrays etc) support any kind of variable setup.

Share this post


Link to post
Share on other sites

The Russian is his game version trying to be helpful with translated RPT errors. I get them in Czech.

If I'm not mistaken it says "Type object, expected array, config entry".

The problem is that _crateArray isn't an array of objects, it's a single object.

Share this post


Link to post
Share on other sites

Ah. Damn Russian :p

Maybe mcti_JIP_crates = mcti_JIP_crates + [[_crate, _patternW, _patternA]]; would help?

Share this post


Link to post
Share on other sites
Ah. Damn Russian :p

Maybe mcti_JIP_crates = mcti_JIP_crates + [[_crate, _patternW, _patternA]]; would help?

great! that works! thanks very very much :)

what do [['s mean ?

Edited by McArcher

Share this post


Link to post
Share on other sites

Aye. When you add _crate, _patternW and _patternA using just [] you simply added them to the end of the mcti_JIP_crates array, not as a new array with the three variables. [[]] add a new array.

I missed that earlier, my eyes get sore from looking at scripts sometimes.

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  

×