_text = _this select 0;

_s1 = _this select 1;
_s2 = _this select 2;
_s3 = _this select 3;
_s4 = _this select 4;
_s5 = _this select 5;
_s6 = _this select 6;
_s7 = _this select 7;
_s8 = _this select 8;

switch (_this select 1) do 
{
	case "00" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\00.paa"];};
	case "01" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\01.paa"];};
	case "02" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\02.paa"];};
	case "03" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\03.paa"];};
	case "04" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\04.paa"];};
	case "05" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\05.paa"];};
	case "06" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\06.paa"];};
	case "07" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\07.paa"];};
	case "08" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\08.paa"];};
	case "09" : {_text setObjectTexture [0,"\ch_m1abrams\markings\m1\num1\09.paa"];};
	case "empty" : {_text setObjectTexture [0,"\ch_m1abrams\markings\empty.paa"];};

	case "random" :
	{
		//based on DKM Script
		_nr = (((getpos _text select 0) + (getpos _text select 1)*3)Mod 1000)-1;
		_nr = _nr - (_nr Mod 1);
		_i = _nr Mod 10;
		_text setobjecttexture [0, format ["\ch_m1abrams\markings\m1\num1\0%1.paa", _i]];
		_i = ((_nr - _i)/10) Mod 10;
		_text setobjecttexture [0, format ["\ch_m1abrams\markings\m1\num1\0%1.paa", _i]];
	};
};

switch (_this select 2) do 
{

	case "00" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\00.paa"];};
	case "01" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\01.paa"];};
	case "02" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\02.paa"];};
	case "03" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\03.paa"];};
	case "04" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\04.paa"];};
	case "05" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\05.paa"];};
	case "06" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\06.paa"];};
	case "07" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\07.paa"];};
	case "08" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\08.paa"];};
	case "09" : {_text setObjectTexture [1,"\ch_m1abrams\markings\m1\num1\09.paa"];};
	case "empty" : {_text setObjectTexture [1,"\ch_m1abrams\markings\empty.paa"];};

	case "random" :
	{
		//based on DKM Script
		_nr = (((getpos _text select 0) + (getpos _text select 1)*2)Mod 1000)-1;
		_nr = _nr - (_nr Mod 1);
		_i = _nr Mod 10;
		_text setobjecttexture [1, format ["\ch_m1abrams\markings\m1\num1\0%1.paa", _i]];
		_i = ((_nr - _i)/10) Mod 10;
		_text setobjecttexture [1, format ["\ch_m1abrams\markings\m1\num1\0%1.paa", _i]];
	};
};

switch (_this select 3) do 
{
	case "empty" : {_text setObjectTexture [2,"\ch_m1abrams\markings\empty.paa"];};
};

switch (_this select 4) do 
{
	case "empty" : {_text setObjectTexture [3,"\ch_m1abrams\markings\empty.paa"];};
};

switch (_this select 5) do 
{
	case "00" : {_text setObjectTexture [4,"\ch_m1abrams\markings\m1\t3\t3_00.paa"];};
	case "empty" : {_text setObjectTexture [4,"\ch_m1abrams\markings\empty.paa"];};
};

switch (_this select 6) do 
{
	case "00" : {_text setObjectTexture [5,"\ch_m1abrams\markings\m1\t3\t3_00.paa"];};
	case "empty" : {_text setObjectTexture [5,"\ch_m1abrams\markings\empty.paa"];};
};

switch (_this select 7) do 
{
	case "empty" : {_text setObjectTexture [6,"\ch_m1abrams\markings\empty.paa"];};
};

switch (_this select 8) do 
{
	case "empty" : {_text setObjectTexture [7,"\ch_m1abrams\markings\empty.paa"];};
};


//the following code is here to fix a bug with setObjectTexture command in singleplayer games
sleep 0.1;

waitUntil {time == 0};

CH_Markings = [_text, _s1, _s2, _s3, _s4, _s5, _s6, _s7, _s8] execVM "\ch_m1abrams_cfg\scripts\m1\markings.sqf";