'##############
'Cockpit-Script
'##############

'------------------------------------------------------------------------------------------


'----------------------
'	Trigger
'----------------------
'	Реверс
{trigger:automatic_R}
'	Antirepeat
	(L.L.cp_bt_gang) !
	{if}
		1 (S.L.cp_bt_gang)
	{else}
		2 (S.L.cp_bt_gang)
	{endif}
	
	
	(L.L.antrieb_getr_gangvorwahl) 1 <= 
	(L.L.cockpit_gang1) ! (L.L.cockpit_gang2) ! (L.L.cockpit_gang3) ! (L.L.cockpit_gangD) ! && && && &&
	{if}
		(L.L.antrieb_getr_gangvorwahl) 0 = !
		{if}
			(T.L.ev_gangwahltaster)
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
		{endif}
		0 (S.L.cockpit_gangN)
		1 (S.L.cockpit_gangR)
		(L.L.Velocity) abs 5 <
		{if}
			(L.L.Velocity) abs 1 < (L.L.Brake) &&
			(L.L.cp_bt_gang) 2 < &&
			{if}
				0 (S.L.antrieb_getr_gangvorwahl)
			{endif}
		{else}
			(L.L.cp_bt_gang) 2 <
			{if}
				0 (S.L.antrieb_getr_gangvorwahl)
			{endif}
		{endif}
	{endif}
{end}

{trigger:automatic_R_off}
	(L.L.cockpit_gangR) 1 =
	{if}
		0.7 (S.L.cockpit_gangR)
	{endif}
{end}


'	Нейтралка

{trigger:automatic_N}
	(L.L.antrieb_getr_gangvorwahl) 1 = !
	{if}
		(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) -  - (S.L.antrieb_getr_gangwahlzeitpunkt)
	{endif}
	(T.L.ev_gangwahltaster_N)
	1 (S.L.antrieb_getr_gangvorwahl) (S.L.cockpit_gangN)
	0 (S.L.cockpit_gangR) (S.L.cockpit_gang1) (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gangD)
	0 (S.L.cp_bt_gang) (S.L.cp_bt_gang1) (S.L.cp_bt_gang2) (S.L.cp_bt_gang3) (S.L.cp_bt_gangD)
{end}


{trigger:automatic_N_off}
	(L.L.cockpit_gangN) 1 =
	{if}
		0.7 (S.L.cockpit_gangN)
	{endif}	
{end}

'	D

{trigger:automatic_D}
'	Antirepeat
	(L.L.cp_bt_gangD) !
	{if}
		1 (S.L.cp_bt_gangD)
	{else}
		2 (S.L.cp_bt_gangD)
	{endif}
	
	
	(L.L.antrieb_getr_gangvorwahl) 0 >
	(L.L.cockpit_gangR) !
	{if}
		(L.L.antrieb_getr_gangvorwahl) 7 = !
		{if}
			(T.L.ev_gangwahltaster)
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
		{endif}
		1 (S.L.cockpit_gangD)
		0 (S.L.cockpit_gangN) (S.L.cockpit_gang1) (S.L.cockpit_gang2) (S.L.cockpit_gang3)
		0 (S.L.cp_bt_gang1) (S.L.cp_bt_gang2) (S.L.cp_bt_gang3)
		(L.L.Velocity) 5 <
		{if}
			(L.L.Velocity) 1 < (L.L.Brake) &&
			(L.L.cp_bt_gangD) 2 < &&
			{if}
				7 (S.L.antrieb_getr_gangvorwahl)
			{else}
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
		{else}
			(L.L.cp_bt_gangD) 2 <
			{if}
				7 (S.L.antrieb_getr_gangvorwahl)
			{endif}
		{endif}
	{endif}
{end}


{trigger:automatic_D_off}
	(L.L.cockpit_gangD) 1 =
	{if}
		0.7 (S.L.cockpit_gangD)
	{endif}	
{end}


{trigger:horn}
	
		(L.L.cockpit_hupe) ! (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe_an)
		{endif}
		1 (S.L.cockpit_hupe)
{end}

{trigger:horn_off}	
	
		(L.L.cockpit_hupe) (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe_aus)
		{endif}
		0 (S.L.cockpit_hupe)	
	
{end}

{trigger:cp_retarder_direkt_toggle}
	(L.L.cp_retarder_sw_direkt) ! (S.L.cp_retarder_sw_direkt) s1
	(M.L.kippschaltersound)
{end}


{trigger:cp_retarder_toggle}
	(C.L.cockpit_has_retarderswitch)
	{if}
		(L.L.cp_retarder_sw) ! (S.L.cp_retarder_sw) s1
		(M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_motorkuehlung_toggle}
	(C.L.cockpit_has_coolingswitch)
	{if}
		(L.L.cp_motorkuehlung_sw) ! (S.L.cp_motorkuehlung_sw) s1
		(M.L.kippschaltersound)
	{endif}
{end}

{trigger:button_unknown_1}
	(L.L.button_unknown_1) ! (S.L.button_unknown_1) s1
	(M.L.kippschaltersound)
{end}
{trigger:button_unknown_2}
	(L.L.button_unknown_2) ! (S.L.button_unknown_2) s1
	(M.L.kippschaltersound)
{end}
{trigger:button_unknown_3}
	(L.L.button_unknown_3) ! (S.L.button_unknown_3) s1
	(M.L.kippschaltersound)
{end}
{trigger:button_unknown_4}
	(L.L.button_unknown_4) ! (S.L.button_unknown_4) s1
	(M.L.kippschaltersound)
{end}
{trigger:button_unknown_5}
	(L.L.button_unknown_5) ! (S.L.button_unknown_5) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_schalter_knick_ovrd_toggle}
	1 (S.L.cp_knick_ovrd_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_schalter_knick_ovrd_toggle_off}
	0 (S.L.cp_knick_ovrd_sw) s1
	(M.L.kippschaltersound)
{end}


'---------------------------------------
{trigger:cp_fahrerlicht_toggle}
	(L.L.bt_cp_light) ! (S.L.bt_cp_light) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_untenrechts_toggle}
	(L.L.bt_salon1_light) 
	{if}
		0 (S.L.bt_salon1_light) s1
	{else}
		1 (S.L.bt_salon1_light) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_licht_oberdeck_toggle}
	(L.L.bt_salon2_light) 
	{if}
		0 (S.L.bt_salon2_light) s1
	{else}
		1 (S.L.bt_salon2_light) s1
	{endif}		
	(M.L.kippschaltersound)
{end}



{trigger:cp_licht_unterdeck_toggle}
	(L.L.cp_licht_unterdeck_sw) 
	{if}
		0 (S.L.cp_licht_unterdeck_sw) s1
	{else}
		1 (S.L.cp_licht_unterdeck_sw) s1
	{endif}		
{end}

'---------------------------------------

{trigger:cp_wischer_schnell_toggle}
	(L.L.cp_wischer_einaus_sw) 1 =
	{if}
		(L.L.cp_wischer_schnell_sw) !
		(L.L.cockpit_wischer_drehschalter_mode) 2 =
		{if}
			3 (S.L.cockpit_wischer_drehschalter_mode)
			1 (S.L.cp_wischer_schnell_sw)
		{else}
			(L.L.cockpit_wischer_drehschalter_mode) 3 =
			{if}
				2 (S.L.cockpit_wischer_drehschalter_mode)
				0 (S.L.cp_wischer_schnell_sw)
			{endif}
		{endif}
		(C.L.wiper_lever) !
		{if}
			l1 (M.L.kippschaltersound)
		{endif}
	{endif}
{end}
	
{trigger:kw_wipermode_up}
	(L.L.cp_wischer_einaus_sw) ! (S.L.cp_wischer_einaus_sw) s1
	{if}
		2 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
		2 3 / (S.L.cockpit_wischerhebel) (S.L.cockpit_wischer_drehschalter)
		(L.L.cp_wischer_intervall_sw) !
		{if}
			(T.L.ev_wischerhebel)
		{endif}
	{else}
		(L.L.cp_wischer_intervall_sw)
		{if}
			1 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
			1 3 / (S.L.cockpit_wischerhebel) 
			0 (S.L.cockpit_wischer_drehschalter)
		{else}
			0 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischerhebel) 
			1 3 / (S.L.cockpit_wischer_drehschalter)
			(T.L.ev_wischerhebel)
		{endif}
	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_intervall_toggle}
	(L.L.cp_wischer_intervall_sw) ! (S.L.cp_wischer_intervall_sw) s1
	(L.L.cp_wischer_einaus_sw) ! &&
	{if}
		1 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
		1 3 / (S.L.cockpit_wischerhebel) 
		0 (S.L.cockpit_wischer_drehschalter)
	{else}
		(L.L.cp_wischer_einaus_sw)
		{if}
			2 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode)
			2 3 / (S.L.cockpit_wischerhebel) (S.L.cockpit_wischer_drehschalter)
		{else}
			0 (S.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischerhebel)
			1 3 / (S.L.cockpit_wischer_drehschalter)
		{endif}

	{endif}
	(C.L.wiper_lever) !
	{if}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_wascher_button}
	1 (S.L.cp_wischer_wascher_sw)
{end}

{trigger:cp_wischer_wascher_button_off}
	0 (S.L.cp_wischer_wascher_sw) s1
{end}

{trigger:cp_heizluefter_toggle}
	(L.L.cp_heizluefter_sw) ! (S.L.cp_heizluefter_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_heizluefter2_toggle}
	(L.L.cp_heizluefter2_sw) ! (S.L.cp_heizluefter2_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_heizluefter3_toggle}
	(L.L.cp_heizluefter3_sw) ! (S.L.cp_heizluefter3_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_heizluefter4_toggle}
	(L.L.cp_heizluefter4_sw) ! (S.L.cp_heizluefter4_sw) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_klimator_sw_drag}
	(L.S.mouse_y) -100 / (L.L.cp_klimator_sw) + (S.L.cp_klimator_sw) s0
	l0 0 <
	{if}
		0 (S.L.cp_klimator_sw)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_klimator_sw)
	{endif}
{end}

{trigger:cp_rollo_drag}

	(L.L.cp_rollo_pos) (S.L.cp_rollo_lastpos)

	1 (S.L.cp_rollo_dragged)
	0 (S.L.cp_rollo_speed)
	(L.S.mouse_y) 500 / (L.L.cp_rollo_pos) + (S.L.cp_rollo_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo_pos)
	{endif}	

	(L.L.cp_rollo_pos) (L.L.cp_rollo_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo_speed)
{end}

{trigger:cp_rollo_off}
	0 (S.L.cp_rollo_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo_retract}
	(L.L.cp_rollo_bommel) 0 = (L.L.cp_rollo_pos) &&
	{if}
		(T.L.ev_rollo_retract)
	{endif}
	1 (S.L.cp_rollo_bommel) (S.L.cp_rollo_retract)
{end}

{trigger:cp_rollo_retract_off}
	0 (S.L.cp_rollo_bommel) (S.L.cp_rollo_retract) (S.L.cp_rollo_speed)
{end}

'---------------------------------------
'	12V
'---------------------------------------
{trigger:elec_12V_toggle}
	(L.L.bt_elec_12v) ! (S.L.bt_elec_12v)
	(M.L.kippschaltersound)
{end}

'---------------------------------------
'	ABS
'---------------------------------------
{trigger:ABS_toggle}
	(L.L.bt_abs) ! (S.L.bt_abs)
	(M.L.kippschaltersound)
{end}

'---------------------------------------
'	Validator
'---------------------------------------
{trigger:Validator_toggle}
	(L.L.bt_val) ! (S.L.bt_val)
	(M.L.kippschaltersound)
{end}

'-------------------------------------------
'	Книлинг
'-------------------------------------------
'	кнопка "автонаклон"
{trigger:cp_kneel_AI}
	(L.L.bt_kneel_al) ! (S.L.bt_kneel_al)
	(L.L.kneel_allowed) ! (S.L.kneel_allowed)
	(T.L.ev_haltebremse_sw_an)
{end}

{trigger:cp_kneel_AI_off}
	0 (S.L.bt_kneel_al)
{end}

'	кнопка "опускание"
{trigger:cp_kneel_L}
	(L.L.bt_kneel_l) ! (S.L.bt_kneel_l)
	(L.L.kneel_l) ! (S.L.kneel_l)
	(T.L.ev_haltebremse_sw_an)
{end}

{trigger:cp_kneel_L_off}
	0 (S.L.bt_kneel_l)
	0 (S.L.kneel_l)
{end}

'	кнопка "LN"
{trigger:cp_kneel_LN}
	(L.L.bt_kneel_ln) ! (S.L.bt_kneel_ln)
	(M.L.kippschaltersound)
{end}

{trigger:cp_kneel_LN_off}
	0 (S.L.bt_kneel_ln)
{end}

'	кнопка "подъём"
{trigger:cp_kneel_Lif}
	(L.L.bt_kneel_lif) ! (S.L.bt_kneel_lif)
	(L.L.kneel_lif) ! (S.L.kneel_lif)
	(T.L.ev_haltebremse_sw_an)
{end}

{trigger:cp_kneel_Lif_off}
	0 (S.L.bt_kneel_lif)
	0 (S.L.kneel_lif)
{end}

'	кнопка "возврат"
{trigger:cp_kneel_R}
	(L.L.bt_kneel_r) ! (S.L.bt_kneel_r)
	(L.L.kneel_r) ! (S.L.kneel_r)
	(T.L.ev_haltebremse_sw_an)
{end}

{trigger:cp_kneel_R_off}
	0 (S.L.bt_kneel_r)
{end}



'-------------------------------------------
'	Кнопка сброса суточного пробега
'-------------------------------------------
{trigger:odometr_reset}
	(L.L.elec_busbar_main)
	{if}
		0 (S.L.odometr_sbros)
	{endif}

	1 (S.L.cp_odometr_reset)
{end}

{trigger:odometr_reset_off}
	0 (S.L.cp_odometr_reset)
{end}

'-------------------------------------------
'	Регулятор яркости подсветки приборов
'-------------------------------------------
{trigger:Pribiri_light_drag}
	(L.S.mouse_x) 200 / (L.L.bt_plight_pos) + 0 max 1 min (S.L.bt_plight_pos)
{end}

'------------------------------------
'Крышка мототсека
'------------------------------------
{trigger:Motortuer_drag}

	1 (S.L.motortuer_dragged)
	(L.L.motortuer_pos) (S.L.motortuer_lastpos)

	(L.S.mouse_y) -200 / (L.L.motortuer_pos) + (S.L.motortuer_pos) s0
	l0 0 <
	{if}
		0 (S.L.motortuer_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.motortuer_pos)
	{endif}
	
	(L.L.bottle_visible) 1 =
	{if}
		(L.L.motortuer_pos) 0.06 <
		{if}
			0.06 (S.L.motortuer_pos)
		{endif}
	{endif}

	(L.L.motortuer_pos) (L.L.motortuer_lastpos) - (L.S.Timegap) / (S.L.motortuer_speed)
{end}

{trigger:Motortuer_off}
	0 (S.L.motortuer_dragged)
{end}

{trigger:Bottle}
	(L.L.motortuer_pos) 0.05 >
	{if}
		(L.L.bottle_visible) ! (S.L.bottle_visible)
	{endif}
{end}

'------------------------------------
'Крышка щитка реле
'------------------------------------
{trigger:cp_Sr_drag}

	1 (S.L.cp_sr_dragged)
	(L.L.cp_sr_pos) (S.L.cp_sr_lastpos)

	(L.S.mouse_x) -200 / (L.L.cp_sr_pos) + (S.L.cp_sr_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_sr_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_sr_pos)
	{endif}

	(L.L.cp_sr_pos) (L.L.cp_sr_lastpos) - (L.S.Timegap) / (S.L.cp_sr_speed)
{end}


{trigger:cp_Sr_off}
	0 (S.L.cp_sr_dragged)
{end}


'------------------------------------
'	Пандус для инвалидов
'------------------------------------
{trigger:Pandus_drag}

	1 (S.L.pandus_dragged)
	(L.L.pandus_pos) (S.L.pandus_lastpos)

	(L.S.mouse_y) -200 / (L.L.pandus_pos) + (S.L.pandus_pos) s0
	l0 0 <
	{if}
		0 (S.L.pandus_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.pandus_pos)
	{endif}
'	Открыт или закрыт пандус.		
	(L.L.pandus_pos) 0.4 > (L.L.door_2L) &&
	{if}
		1 (S.L.pandus_opn)
		0 (S.L.pandus_cls)
	{endif}
	(L.L.pandus_pos) 0.2 < (L.L.door_2L) &&
	{if}
		1 (S.L.pandus_cls)
		0 (S.L.pandus_opn)
	{endif}
	(L.L.pandus_opn) (L.L.door_2L) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.45 < 
		{if}
			0.45 (S.L.pandus_pos)
		{endif}
	{endif}
	(L.L.pandus_cls) (L.L.door_2L) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.1 > 
		{if}
			0.1 (S.L.pandus_pos)
		{endif}
	{endif}
	(L.L.pandus_pos) (L.L.pandus_lastpos) - (L.S.Timegap) / (S.L.pandus_speed)
{end}


{trigger:Pandus_off}
	0 (S.L.pandus_dragged)
{end}


'++++++++++++++++++++++++++++++++++++
'------------------------------------
'Форточки
'------------------------------------
'	Водительская
'------------------------------------
{trigger:cp_fort_vod_opn_drag}

	(L.L.cp_fort_vod_pos) (S.L.cp_fort_vod_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fort_vod_pos) + (S.L.cp_fort_vod_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fort_vod_pos)
		(L.L.cp_fort_vod_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls)
		{endif}
		1 (S.L.cp_fort_vod_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fort_vod_pos)
		(L.L.cp_fort_vod_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn)
		{endif}
		1 (S.L.cp_fort_vod_endanschlag)
	{endif}

	(L.L.cp_fort_vod_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fort_vod_endanschlag)
	{endif}


	(L.L.cp_fort_vod_pos) (L.L.cp_fort_vod_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fort_vod_opn_off}
	0 (S.L.cp_fahrerfenster_speed)
{end}

'------------------------------------
'Первая правая
'------------------------------------
{trigger:cp_f1_r_opn_drag}
	(L.L.cp_f1_r_pos) (S.L.cp_f1_r_lastpos)
	(L.S.mouse_x) 200 / (L.L.cp_f1_r_pos) + (S.L.cp_f1_r_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_f1_r_pos)
		(L.L.cp_f1_r_endanschlag) !
		{if}
			(T.L.ev_f1_r_cls)
		{endif}
		1 (S.L.cp_f1_r_endanschlag)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_f1_r_pos)
		(L.L.cp_f1_r_endanschlag) !
		{if}
			(T.L.ev_f1_r_opn)
		{endif}
		1 (S.L.cp_f1_r_endanschlag)
	{endif}
	(L.L.cp_f1_r_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_f1_r_endanschlag)
	{endif}
	(L.L.cp_f1_r_pos) (L.L.cp_f1_r_lastpos) - abs (L.S.Timegap) / (S.L.cp_f1_r_speed)
{end}

{trigger:cp_f1_r_opn_off}
	0 (S.L.cp_f1_r_speed)
{end}

'------------------------------------
'Вторая правая
'------------------------------------
{trigger:cp_f2_r_opn_drag}
	(L.L.cp_f2_r_pos) (S.L.cp_f2_r_lastpos)
	(L.S.mouse_x) 200 / (L.L.cp_f2_r_pos) + (S.L.cp_f2_r_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_f2_r_pos)
		(L.L.cp_f2_r_endanschlag) !
		{if}
			(T.L.ev_f2_r_cls)
		{endif}
		1 (S.L.cp_f2_r_endanschlag)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_f2_r_pos)
		(L.L.cp_f2_r_endanschlag) !
		{if}
			(T.L.ev_f2_r_opn)
		{endif}
		1 (S.L.cp_f2_r_endanschlag)
	{endif}
	(L.L.cp_f2_r_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_f2_r_endanschlag)
	{endif}
	(L.L.cp_f2_r_pos) (L.L.cp_f2_r_lastpos) - abs (L.S.Timegap) / (S.L.cp_f2_r_speed)
{end}

{trigger:cp_f2_r_opn_off}
	0 (S.L.cp_f2_r_speed)
{end}

'------------------------------------
'Первая левая
'------------------------------------
{trigger:cp_f1_l_opn_drag}
	(L.L.cp_f1_l_pos) (S.L.cp_f1_l_lastpos)
	(L.S.mouse_x) -200 / (L.L.cp_f1_l_pos) + (S.L.cp_f1_l_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_f1_l_pos)
		(L.L.cp_f1_l_endanschlag) !
		{if}
			(T.L.ev_f1_l_cls)
		{endif}
		1 (S.L.cp_f1_l_endanschlag)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_f1_l_pos)
		(L.L.cp_f1_l_endanschlag) !
		{if}
			(T.L.ev_f1_l_opn)
		{endif}
		1 (S.L.cp_f1_l_endanschlag)
	{endif}
	(L.L.cp_f1_l_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_f1_l_endanschlag)
	{endif}
	(L.L.cp_f1_l_pos) (L.L.cp_f1_l_lastpos) - abs (L.S.Timegap) / (S.L.cp_f1_l_speed)
{end}

{trigger:cp_f1_l_opn_off}
	0 (S.L.cp_f1_l_speed)
{end}

'------------------------------------
'Вторая левая
'------------------------------------
{trigger:cp_f2_l_opn_drag}
	(L.L.cp_f2_l_pos) (S.L.cp_f2_l_lastpos)
	(L.S.mouse_x) -200 / (L.L.cp_f2_l_pos) + (S.L.cp_f2_l_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_f2_l_pos)
		(L.L.cp_f2_l_endanschlag) !
		{if}
			(T.L.ev_f2_l_cls)
		{endif}
		1 (S.L.cp_f2_l_endanschlag)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_f2_l_pos)
		(L.L.cp_f2_l_endanschlag) !
		{if}
			(T.L.ev_f2_l_opn)
		{endif}
		1 (S.L.cp_f2_l_endanschlag)
	{endif}
	(L.L.cp_f2_l_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_f2_l_endanschlag)
	{endif}
	(L.L.cp_f2_l_pos) (L.L.cp_f2_l_lastpos) - abs (L.S.Timegap) / (S.L.cp_f2_l_speed)
{end}

{trigger:cp_f2_l_opn_off}
	0 (S.L.cp_f2_l_speed)
{end}

'------------------------------------
'Первая правая
'------------------------------------
{trigger:cp_fortochka_L1}
	(L.L.cp_fortochka_L1) ! (S.L.cp_fortochka_L1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_fortochka_L2}
	(L.L.cp_fortochka_L2) ! (S.L.cp_fortochka_L2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_fortochka_L3}
	(L.L.cp_fortochka_L3) ! (S.L.cp_fortochka_L3) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_fortochka_R1}
	(L.L.cp_fortochka_R1) ! (S.L.cp_fortochka_R1) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_fortochka_R2}
	(L.L.cp_fortochka_R2) ! (S.L.cp_fortochka_R2) s1
	(M.L.klappfenstersound)
{end}

{trigger:cp_fortochka_R3}
	(L.L.cp_fortochka_R3) ! (S.L.cp_fortochka_R3) s1
	(M.L.klappfenstersound)
{end}

'------------------------------------
'Кнопка включения VDO
'------------------------------------
{trigger:vdo_panel_button}
	(L.L.vdo_panel_button) ! (S.L.vdo_panel_button) s1
	(M.L.kippschaltersound)
{end}

'------------------------------------
'Скрипт Экстр
'------------------------------------
{trigger:cp_extra_1}
	(L.L.cp_extra_1) ! (S.L.cp_extra_1) s1
{end}

{trigger:cp_extra_2}
	(L.L.cp_extra_2) ! (S.L.cp_extra_2) s1
{end}

{trigger:cp_extra_3}
	(L.L.cp_extra_3) ! (S.L.cp_extra_3) s1
{end}

{trigger:cp_extra_4}
	(L.L.cp_extra_4) ! (S.L.cp_extra_4) s1
{end}

{trigger:cp_extra_5}
	(L.L.cp_extra_5) ! (S.L.cp_extra_5) s1
{end}

'------------------------------------
'Форточка на перегородке
'------------------------------------
{trigger:cp_fp_opn_drag}
	(L.L.cp_fp_pos) (S.L.cp_fp_lastpos)
	(L.S.mouse_x) -200 / (L.L.cp_fp_pos) + (S.L.cp_fp_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fp_pos)
		(L.L.cp_fp_endanschlag) !
		{if}
			(T.L.ev_fp_cls)
		{endif}
		1 (S.L.cp_fp_endanschlag)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fp_pos)
		(L.L.cp_fp_endanschlag) !
		{if}
			(T.L.ev_fp_opn)
		{endif}
		1 (S.L.cp_fp_endanschlag)
	{endif}
	(L.L.cp_fp_pos) s0 0 > l0 1 < &&
	{if}
		0 (S.L.cp_fp_endanschlag)
	{endif}

	(L.L.cp_fp_pos) (L.L.cp_fp_lastpos) - abs (L.S.Timegap) / (S.L.cp_fp_speed)
{end}


{trigger:cp_fp_opn_off}
	0 (S.L.cp_fp_speed)
{end}

'------------------------------------
'Ролло в перегородке
'------------------------------------
{trigger:cp_rollo_peregorodka}
	(L.L.cp_rollo_peregorodka) ! (S.L.cp_rollo_peregorodka) s1
{end}

'------------------------------------
'Монетница
'------------------------------------
{trigger:monetnica}
	(L.L.monetnica) ! (S.L.monetnica) s1
{end}

'------------------------------------
'Сидения
'------------------------------------

{trigger:cp_sidenie1_drag}

	(L.L.cp_sidenie1_pos) (S.L.cp_sidenie1_lastpos)
	
	(L.S.mouse_x) 300 / (L.L.cp_sidenie1_pos) + 0 max 1 min (S.L.cp_sidenie1_pos) s0
	
	(L.L.cp_sidenie1_pos) (L.L.cp_sidenie1_lastpos) - abs (L.S.Timegap) / (S.L.cp_sidenie1_speed)
	
	l0 0 =
	(L.L.cp_sidenie1_antipereat1) ! &&
	{if}
		(T.L.ev_sidenie1_opn)
		1 (S.L.cp_sidenie1_antipereat1)
		0 (S.L.cp_sidenie1_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_sidenie1_antipereat2) ! &&
	{if}
		(T.L.ev_sidenie1_cls)
		1 (S.L.cp_sidenie1_antipereat2)
		0 (S.L.cp_sidenie1_antipereat1)
	{endif}
	
{end}


{trigger:cp_sidenie1_off}
	0 (S.L.cp_sidenie1_antipereat1) (S.L.cp_sidenie1_antipereat2)
{end}

{trigger:cp_sidenie2_drag}

	(L.L.cp_sidenie2_pos) (S.L.cp_sidenie2_lastpos)
	
	(L.S.mouse_x) 300 / (L.L.cp_sidenie2_pos) + 0 max 1 min (S.L.cp_sidenie2_pos) s0
	
	(L.L.cp_sidenie2_pos) (L.L.cp_sidenie2_lastpos) - abs (L.S.Timegap) / (S.L.cp_sidenie2_speed)
	
	l0 0 =
	(L.L.cp_sidenie2_antipereat1) ! &&
	{if}
		(T.L.ev_sidenie2_opn)
		1 (S.L.cp_sidenie2_antipereat1)
		0 (S.L.cp_sidenie2_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_sidenie2_antipereat2) ! &&
	{if}
		(T.L.ev_sidenie2_cls)
		1 (S.L.cp_sidenie2_antipereat2)
		0 (S.L.cp_sidenie2_antipereat1)
	{endif}
	
{end}


{trigger:cp_sidenie2_off}
	0 (S.L.cp_sidenie2_antipereat1) (S.L.cp_sidenie2_antipereat2)
{end}

{trigger:cp_sidenie3_drag}

	(L.L.cp_sidenie3_pos) (S.L.cp_sidenie3_lastpos)
	
	(L.S.mouse_x) 300 / (L.L.cp_sidenie3_pos) + 0 max 1 min (S.L.cp_sidenie3_pos) s0
	
	(L.L.cp_sidenie3_pos) (L.L.cp_sidenie3_lastpos) - abs (L.S.Timegap) / (S.L.cp_sidenie3_speed)
	
	l0 0 =
	(L.L.cp_sidenie3_antipereat1) ! &&
	{if}
		(T.L.ev_sidenie3_opn)
		1 (S.L.cp_sidenie3_antipereat1)
		0 (S.L.cp_sidenie3_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_sidenie3_antipereat2) ! &&
	{if}
		(T.L.ev_sidenie3_cls)
		1 (S.L.cp_sidenie3_antipereat2)
		0 (S.L.cp_sidenie3_antipereat1)
	{endif}
	
{end}


{trigger:cp_sidenie3_off}
	0 (S.L.cp_sidenie3_antipereat1) (S.L.cp_sidenie3_antipereat2)
{end}

'------------------------------------
'Центральная часть приборки
'------------------------------------

{trigger:cp_seredina_drag}

	(L.L.cp_seredina_pos) (S.L.cp_seredina_lastpos)
	
	(L.S.mouse_y) 500 / (L.L.cp_seredina_pos) + 0 max 1 min (S.L.cp_seredina_pos) s0
	
	(L.L.cp_seredina_pos) (L.L.cp_seredina_lastpos) - abs (L.S.Timegap) / (S.L.cp_seredina_speed)
	
	l0 0 =
	(L.L.cp_seredina_antipereat1) ! &&
	{if}
		(T.L.ev_sidenie1_opn)
		1 (S.L.cp_seredina_antipereat1)
		0 (S.L.cp_seredina_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_sidenie1_antipereat2) ! &&
	{if}
		(T.L.ev_sidenie1_cls)
		1 (S.L.cp_seredina_antipereat2)
		0 (S.L.cp_seredina_antipereat1)
	{endif}
	
{end}


{trigger:cp_seredina_off}
	0 (S.L.cp_seredina_antipereat1) (S.L.cp_seredina_antipereat2)
{end}

'------------------------------------
'Боковые крышки
'------------------------------------

{trigger:cp_kryshka1_drag}

	1 (S.L.cp_kryshka1_dragged)
	(L.L.cp_kryshka1_pos) (S.L.cp_kryshka1_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_kryshka1_pos) + (S.L.cp_kryshka1_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_kryshka1_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_kryshka1_pos)
	{endif}

	(L.L.cp_kryshka1_pos) (L.L.cp_kryshka1_lastpos) - (L.S.Timegap) / (S.L.cp_kryshka1_speed)
{end}


{trigger:cp_kryshka1_off}
	0 (S.L.cp_kryshka1_dragged)
{end}

{trigger:cp_kryshka2_drag}

	1 (S.L.cp_kryshka2_dragged)
	(L.L.cp_kryshka2_pos) (S.L.cp_kryshka2_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_kryshka2_pos) + (S.L.cp_kryshka2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_kryshka2_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_kryshka2_pos)
	{endif}

	(L.L.cp_kryshka2_pos) (L.L.cp_kryshka2_lastpos) - (L.S.Timegap) / (S.L.cp_kryshka2_speed)
{end}


{trigger:cp_kryshka2_off}
	0 (S.L.cp_kryshka2_dragged)
{end}

'-------------------------------------------			
'Монетница
'-------------------------------------------

{trigger:cp_dver_block}
	(L.L.cp_dver_block) ! (S.L.cp_dver_block) s1
{end}

{trigger:cp_monetnica_drag}


	(L.L.cp_monetnica_pos) (S.L.cp_monetnica_lastpos)
	
	(L.S.mouse_y) -300 / (L.L.cp_monetnica_pos) + 0 max 1 min (S.L.cp_monetnica_pos) s0
	
	(L.L.cp_monetnica_pos) (L.L.cp_monetnica_lastpos) - abs (L.S.Timegap) / (S.L.cp_monetnica_speed)
	
	l0 0 =
	(L.L.cp_monetnica_antipereat1) ! &&
	{if}
		(T.L.ev_monetnica_opn)
		1 (S.L.cp_monetnica_antipereat1)
		0 (S.L.cp_monetnica_antipereat2)
	{endif}
		
	l0 1 =
	(L.L.cp_monetnica_antipereat2) ! &&
	{if}
		(T.L.ev_monetnica_cls)
		1 (S.L.cp_monetnica_antipereat2)
		0 (S.L.cp_monetnica_antipereat1)
	{endif}

{end}


{trigger:cp_monetnica_off}
	0 (S.L.cp_monetnica_antipereat1) (S.L.cp_monetnica_antipereat2)
{end}

'------------------------------------
'Левое зеркало
'------------------------------------
{trigger:cp_refl_trans_drag}
	(L.S.mouse_y) 150 / (L.L.cp_refl_trans_pos) + 0 max 1 min (S.L.cp_refl_trans_pos)
{end}

{trigger:cp_refl_rot_drag}
	(L.S.mouse_x) 150 / (L.L.cp_refl_rot_pos) + 0 max 1 min (S.L.cp_refl_rot_pos)
{end}

'------------------------------------
'Правое зеркало
'------------------------------------
{trigger:cp_refr_trans_drag}
	(L.S.mouse_y) 150 / (L.L.cp_refr_trans_pos) + 0 max 1 min (S.L.cp_refr_trans_pos)
{end}


{trigger:cp_refr_rot_drag}
	(L.S.mouse_x) 150 / (L.L.cp_refr_rot_pos) + 0 max 1 min (S.L.cp_refr_rot_pos)
{end}

'------------------------------------
'Кнопка включения мониторов слежения
'------------------------------------
{trigger:cp_monitor}
(L.L.cp_monitor) ! (S.L.cp_monitor) s1
(M.L.kippschaltersound)
{end}

'------------------------------------
' Переключатель спорт не спорт
'------------------------------------
{trigger:cp_sportmode_toggle}
	(L.L.cp_sportmode_sw) ! (S.L.cp_sportmode_sw) s1
	(M.L.kippschaltersound)
{end}

'--------------------------------------
'	Люки
'--------------------------------------
{trigger:hatch_1}
	(L.L.hatch_1_rot1) ! (L.L.hatch_1_rot2) ! (L.L.hatch_1_trans) ! && &&
	{if}
		1 (S.L.hatch_1_rot1)
		0.4 (S.L.hatch_1)
		(T.L.ev_klappfenster_opn)
	{else}
		(L.L.hatch_1_rot1)
		{if}
			1 (S.L.hatch_1_trans)
			0 (S.L.hatch_1_rot1)
			1 (S.L.hatch_1)
			(T.L.ev_klappfenster_opn)
		{else}
			(L.L.hatch_1_trans)
			{if}
				1 (S.L.hatch_1_rot2)
				0.4 (S.L.hatch_1)
				0
				(S.L.hatch_1_rot1)
				(S.L.hatch_1_trans)
				(T.L.ev_klappfenster_cls)
			{else}
				0
				(S.L.hatch_1_rot1)
				(S.L.hatch_1_rot2)
				(S.L.hatch_1_trans)
				(S.L.hatch_1)
				(T.L.ev_klappfenster_cls)
			{endif}
		{endif}
	{endif}
{end}

{trigger:hatch_2}
	(L.L.hatch_2_rot1) ! (L.L.hatch_2_rot2) ! (L.L.hatch_2_trans) ! && &&
	{if}
		1 (S.L.hatch_2_rot1)
		0.4 (S.L.hatch_1)
		(T.L.ev_klappfenster_opn)
	{else}
		(L.L.hatch_2_rot1)
		{if}
			1 (S.L.hatch_2_trans)
			0 (S.L.hatch_2_rot1)
			1 (S.L.hatch_2)
			(T.L.ev_klappfenster_opn)
		{else}
			(L.L.hatch_2_trans)
			{if}
				1 (S.L.hatch_2_rot2)
				0.4 (S.L.hatch_2)
				0
				(S.L.hatch_2_rot1)
				(S.L.hatch_2_trans)
				(T.L.ev_klappfenster_cls)
			{else}
				0
				(S.L.hatch_2_rot1)
				(S.L.hatch_2_rot2)
				(S.L.hatch_2_trans)
				(S.L.hatch_2)
				(T.L.ev_klappfenster_cls)
			{endif}
		{endif}
	{endif}
{end}

{trigger:hatch_3}
	(L.L.hatch_3_rot1) ! (L.L.hatch_3_rot2) ! (L.L.hatch_3_trans) ! && &&
	{if}
		1 (S.L.hatch_3_rot1)
		0.4 (S.L.hatch_1)
		(T.L.ev_klappfenster_opn)
	{else}
		(L.L.hatch_3_rot1)
		{if}
			1 (S.L.hatch_3_trans)
			0 (S.L.hatch_3_rot1)
			1 (S.L.hatch_3)
			(T.L.ev_klappfenster_opn)
		{else}
			(L.L.hatch_3_trans)
			{if}
				1 (S.L.hatch_3_rot2)
				0.4 (S.L.hatch_3)
				0
				(S.L.hatch_3_rot1)
				(S.L.hatch_3_trans)
				(T.L.ev_klappfenster_cls)
			{else}
				0
				(S.L.hatch_3_rot1)
				(S.L.hatch_3_rot2)
				(S.L.hatch_3_trans)
				(S.L.hatch_3)
				(T.L.ev_klappfenster_cls)
			{endif}
		{endif}
	{endif}
{end}

{trigger:hatch_4}
	(L.L.hatch_4_rot1) ! (L.L.hatch_4_rot2) ! (L.L.hatch_4_trans) ! && &&
	{if}
		1 (S.L.hatch_4_rot1)
		0.4 (S.L.hatch_1)
		(T.L.ev_klappfenster_opn)
	{else}
		(L.L.hatch_4_rot1)
		{if}
			1 (S.L.hatch_4_trans)
			0 (S.L.hatch_4_rot1)
			1 (S.L.hatch_4)
			(T.L.ev_klappfenster_opn)
		{else}
			(L.L.hatch_4_trans)
			{if}
				1 (S.L.hatch_4_rot2)
				0.4 (S.L.hatch_4)
				0
				(S.L.hatch_4_rot1)
				(S.L.hatch_4_trans)
				(T.L.ev_klappfenster_cls)
			{else}
				0
				(S.L.hatch_4_rot1)
				(S.L.hatch_4_rot2)
				(S.L.hatch_4_trans)
				(S.L.hatch_4)
				(T.L.ev_klappfenster_cls)
			{endif}
		{endif}
	{endif}
{end}

'	Руль

{trigger:rudder_logo}
	(L.L.r_logo) ! (S.L.r_logo)
{end}

{trigger:cp_lenkrad_toggle}
	(L.L.cp_lenkrad_visible) ! (S.L.cp_lenkrad_visible)
{end}



{trigger:cp_batterietrennschalter_toggle}
	(L.L.elec_busbar_main_sw) ! (S.L.elec_busbar_main_sw) 
	(L.L.cp_batterietrennschalter_antirepeat) !
	{if}
		(L.L.elec_busbar_main_sw)
		{if}
			1 (S.L.bremse_ABS_selftest)
		{endif}
		1 (S.L.cp_batterietrennschalter_antirepeat)
		(T.L.ev_haltebremse_sw_an)
	{endif}
{end}
			
{trigger:cp_batterietrennschalter_toggle_off}
	0 (S.L.cp_batterietrennschalter_antirepeat)
{end}			



{trigger:cp_Fahrertuer_drag}

	(L.L.cp_dver_block) !
{if}

	1 (S.L.cp_fahrertuer_dragged)
	(L.L.cp_fahrertuer_pos) (S.L.cp_fahrertuer_lastpos)

	(L.S.mouse_x) 500 / (L.L.cp_fahrertuer_pos) + (S.L.cp_fahrertuer_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fahrertuer_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fahrertuer_pos)
	{endif}

	(L.L.cp_fahrertuer_pos) (L.L.cp_fahrertuer_lastpos) - (L.S.Timegap) / (S.L.cp_fahrertuer_speed)
{endif}
{end}


{trigger:cp_Fahrertuer_off}
	0 (S.L.cp_fahrertuer_dragged)
{end}



{trigger:KR_play}
	(L.L.cockpit_KR_play) 0.1 < 
	{if}
		(T.L.ev_kr_play)
	{endif}
	1 (S.L.cockpit_KR_play) (S.L.Snd_Radio)
	0 (S.L.am_power) (S.L.play)
{end}


{trigger:KR_play_off}
	0.8 (S.L.cockpit_KR_play)
{end}

{trigger:KR_stop}
	1 (S.L.cockpit_KR_stop)
	0 (S.L.cockpit_KR_play) (S.L.Snd_Radio)
	(T.L.ev_kr_stop)
{end}


{trigger:KR_stop_off}
	0 (S.L.cockpit_KR_stop)
{end}


{trigger:taster_standheizung}

	(L.L.cp_taster_standheizung_target) ! (S.L.cp_taster_standheizung_target) s1

	1 (S.L.cp_taster_standheizung)

	(C.L.auxheat_via_button) !
	{if}
		l1 (M.L.kippschaltersound)
		l0 (S.L.cp_taster_standheizung)
	{endif}
		
{end}

{trigger:taster_standheizung_off}
	
	(L.L.cp_taster_standheizung_target)
	{if}
		0 (S.L.cp_taster_standheizung)
	{else}
		0.6 (S.L.cp_taster_standheizung)
	{endif}

{end}

'Колёсико стеклоочистителя
{trigger:cp_wiper_turnswitch_drag}

	(L.S.mouse_y) abs (L.S.mouse_x) abs >=
	{if}
		(L.S.mouse_y) -50 / (L.L.cockpit_wischer_drehschalter) + 0 max 1 min (S.L.cockpit_wischer_drehschalter) s0
	
'		Stufen:
'		0: Aus
'		1: Intervall
'		2: Langsam
'		3: Schnell

		l0 0.17 <
		{if}
			0 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)		
		{else} 
			l0 0.5 <
			{if}
				0 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
				1 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cp_wischer_intervall_sw)
			{else}
				l0 0.83 <
				{if}
					2 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw)
					0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
				{else}
					3 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
					0 (S.L.cp_wischer_intervall_sw)
				{endif}
			{endif}
		{endif}
	{else}
		(L.S.mouse_x) 100 / (L.L.cockpit_wischerhebel_x) + (S.L.cockpit_wischerhebel_x) s1	
			
		l1 0.9 >
		{if}
			(L.L.cp_wischer_wascher_sw) !
			1 (S.L.cp_wischer_wascher_sw)
		{else}
			(L.L.cp_wischer_wascher_sw) !
			0 (S.L.cp_wischer_wascher_sw)
		{endif}
	{endif}
{end}

{trigger:cp_wiper_turnswitch_off}
	(L.L.cp_wischer_wascher_sw) !
	0 (S.L.cp_wischer_wascher_sw)

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischer_drehschalter_mode) 3 / (S.L.cockpit_wischer_drehschalter)
{end}

	
{trigger:cp_microphone}
	1 (S.L.cp_microphone_sw)
{end}

{trigger:cp_microphone_off}
	0 (S.L.cp_microphone_sw)
{end}



{trigger:cp_heizregler_defrost_drag}
	(L.S.mouse_x) -70 / (L.L.cockpit_heizregler_defrost) + 0 max 1 min (S.L.cockpit_heizregler_defrost)
{end}

{trigger:cp_heizregler_fussraum_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_fussraum) + 0 max 1 min (S.L.cockpit_heizregler_fussraum)
{end}

{trigger:cp_heizregler_temp_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_temp) + 0 max 1 min (S.L.cockpit_heizregler_temp)
{end}

{trigger:cp_heizregler_temp_increase}
	 (L.L.cockpit_heizregler_temp) 0.1 + 0 max 1 min (S.L.cockpit_heizregler_temp)
{end}

{trigger:cp_heizregler_temp_decrease}
	(L.L.cockpit_heizregler_temp) 0.1 - 0 max 1 min (S.L.cockpit_heizregler_temp)
{end}

{trigger:cp_heizregler_bug_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_bug) + 0 max 1 min (S.L.cockpit_heizregler_bug)
{end}

{trigger:cp_heizregler_umluft_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_umluft) + 0 max 1 min (S.L.cockpit_heizregler_umluft) s0

'	Stufen:
'	0: Umluftheizung
'	1: Direktbelьftung
'	2: Frischluftheizung

	l0 0.2 <
	{if}
		0 (S.L.cockpit_heizregler_ventilation_mode)
	{else}
		l0 0.8 <
		{if}
			1 (S.L.cockpit_heizregler_ventilation_mode)
		{else}
			2 (S.L.cockpit_heizregler_ventilation_mode)
		{endif}
	{endif}

{end}

{trigger:cp_heizregler_umluft_off}
	(L.L.cockpit_heizregler_ventilation_mode) 2 / (S.L.cockpit_heizregler_umluft)

{end}

'-------------------------------------------
'Переключатель аварийного останова двигателя и выключения "массы" и его крышка
'-------------------------------------------

{trigger:cp_avariinoe_vykl_kryshka}
	(L.L.cp_avariinoe_vykl_kryshka) !
	{if}
		1 (S.L.cp_avariinoe_vykl_kryshka)
		(T.L.ev_avar_kr)
	{else}
		(L.L.cp_avar_rot) 0.1 <
		{if}
			0 (S.L.cp_avariinoe_vykl_kryshka)
			(T.L.ev_avar_kr)
		{endif}
	{endif}
	
{end}

{trigger:cp_avar_mov_drag}

	(L.L.cp_avariinoe_vykl_kryshka) !
	{if}
		1 6 / (S.L.cp_avar_rot_max)
	{else}
		1 (S.L.cp_avar_rot_max)
	{endif}

	(L.S.mouse_x) -20 / (L.L.cp_avar_rot) + 0 max (L.L.cp_avar_rot_max) min (S.L.cp_avar_rot) s1

	l1 0.2 <
	{if}
		0 (S.L.cp_avar_rot_mode)			
	{else} 
		l1 0.9 >
		{if}
			0 (S.L.engine_injection_on)
			(L.L.elec_busbar_main)
			{if}
				0 (S.L.elec_busbar_main_sw)
			{endif}
					
			1 (S.L.cp_avar_rot_mode)
		{endif}
	{endif}
{end}

{trigger:cp_avar_mov_off}

'	Привязка ключа к фиксированным положениям
	(L.L.cp_avar_rot_mode) 2 / (S.L.cp_avar_rot)

{end}


{trigger:kolpak_1l}
	(L.L.kolpak_1l) ! (S.L.kolpak_1l)
	(T.L.ev_kolpak_1l)
{end}

{trigger:kolpak_1r}
	(L.L.kolpak_1r) ! (S.L.kolpak_1r)
	(T.L.ev_kolpak_1r)
{end}

{trigger:kolpak_2l}
	(L.L.kolpak_2l) !
	{if}
		1 (S.L.kolpak_2l)
		(T.L.ev_kolpaksound_cls)
	{else}
		0 (S.L.kolpak_2l)
		(T.L.ev_kolpaksound_opn)
	{endif}
{end}

{trigger:kolpak_2r}
	(L.L.kolpak_2r) !
	{if}
		1 (S.L.kolpak_2r)
		(T.L.ev_kolpaksound_cls)
	{else}
		0 (S.L.kolpak_2r)
		(T.L.ev_kolpaksound_opn)
	{endif}
{end}


{trigger:cp_bt_obduv}
	(L.L.bt_obduv) 
	{if}
		0 (S.L.bt_obduv) s1
	{else}
		1 (S.L.bt_obduv) s1
	{endif}		
	(M.L.kippschaltersound)
{end}

{trigger:Mirror_obogrev}
	(L.L.bt_mirror_obogrev) ! (S.L.bt_mirror_obogrev) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw01}
	(L.L.cp_dummy_sw01) ! (S.L.cp_dummy_sw01) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw02}
	(L.L.cp_dummy_sw02) ! (S.L.cp_dummy_sw02) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw03}
	(L.L.cp_dummy_sw03) ! (S.L.cp_dummy_sw03) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw04}
	(L.L.cp_dummy_sw04) ! (S.L.cp_dummy_sw04) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw05}
	(L.L.cp_dummy_sw05) ! (S.L.cp_dummy_sw05) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw06}
	(L.L.cp_dummy_sw06) ! (S.L.cp_dummy_sw06) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_dummy_sw07}
	(L.L.cp_dummy_sw07) ! (S.L.cp_dummy_sw07) s1
	(M.L.kippschaltersound)
{end}

{trigger:cp_per_polka_drag}
	(L.S.mouse_y) -70 / (L.L.polka_pos) + 0 max 1 min (S.L.polka_pos)
{end}

{trigger:cp_fort_fixator_drag}
	(L.S.mouse_x) -250 / (L.L.fixator_pos) + 0 max 1 min (S.L.fixator_pos)
{end}

{trigger:pandus}
	(L.L.pandus) !
	{if}
		1 (S.L.pandus) s1
	{else}
		0 (S.L.pandus) s1
	{endif}
	
	(M.L.kippschaltersound)

{end}

{trigger:lincoln}
	(L.L.lincoln) !
	{if}
		1 (S.L.lincoln) s1
	{else}
		0 (S.L.lincoln) s1
	{endif}
	
	(M.L.kippschaltersound)

{end}

{trigger:ekran_on}
	(L.L.ekran_on) !
	{if}
		1 (S.L.ekran_on) s1
	{else}
		0 (S.L.ekran_on) s1
	{endif}
	
	(M.L.kippschaltersound)

{end}

{trigger:ekran_light}
	(L.L.ekran_light) ! (S.L.ekran_light) s1
	(M.L.kippschaltersound)

{end}

'-------------------------------------------
' Включатель кондея
'-------------------------------------------
{trigger:cp_konvekta_toggle}
	(L.L.elec_busbar_main)
{if}
	(L.L.cp_konvekta_sw) ! (S.L.cp_konvekta_sw) s1
{endif}
	(M.L.kippschaltersound)
{end}

'----------------------
'	Init
'----------------------

{macro:cockpit_init}
	0.7 (S.L.cockpit_gangN)
	0 (S.L.cockpit_hupe_volume) (S.L.door_handsteuerung)
	1 (S.L.cp_retarder_sw) (S.L.cp_lenkrad_visible) (S.L.cp_taster_warnblinker) (S.L.cockpit_wischer_drehschalter_mode) 

	0.6 (S.L.cp_taster_warnblinker) (S.L.cp_taster_standheizung)

	(C.L.cockpit_zentralschmierung_dist) random (S.L.cp_zentralschmierung_nextkm)

	0.333 (S.L.cockpit_wischer_drehschalter)
	
	1 (S.L.pandus_cls)
	
	
{end}
'----------------------
'	Frame
'----------------------
{macro:cockpit_frame}

'Скрипт приветствия. Просто показываем экран приветствия на борткомпе "Лиаз". Автор Wizard

'Вызываем переменную, которая отвечает за начало отсчета времени
(L.L.elec_busbar_main)
	{if}
	{else}
		1 (S.L.liazlogo_timer_start)
	{endif}

'(S.L.liazlogo_visible)

'и инициализируем таймер...
(L.L.liazlogo_timer_start) (L.S.Timegap) + (S.L.liazlogo_timer_start)



'ну и простенькое условие появления логотипа
(L.L.liazlogo_timer_start) 5 >
{if}
0 (S.L.liazlogo_visible)
{else}
(L.L.elec_busbar_main) 1 =
{if}
1 (S.L.liazlogo_visible)
{else}
0 (S.L.liazlogo_visible)
{endif}
{endif}

'Ьbertragen der Schalterstellungen:
	(L.L.cp_retarder_sw) (S.L.antrieb_retarder_sw)
	(L.L.cp_retarder_sw_direkt) (S.L.antrieb_retarder_sw_direkt)
	(L.L.cp_wischer_schnell_sw) (S.L.wiper_schnell_sw)
	(L.L.cp_wischer_einaus_sw) (S.L.wiper_einaus_sw)
	(L.L.cp_wischer_intervall_sw) (S.L.wiper_intervall_sw)
	(L.L.cp_wischer_wascher_sw) (S.L.wiper_wascher_sw)

	(M.L.vdo_panel_speed_frame)
	(M.L.vdo_panel_time_frame)
	(M.L.tacho_frame)
	(M.L.tachometr_frame)
	(M.L.uhr_frame)
	(M.L.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.wischerhebel_frame)
	(M.L.wischer_drehschalter_frame)
	(M.L.oeldruck_frame)
	(M.L.tankuhr_frame)
	(M.L.cockpitlights_frame)
	(M.L.klimator_frame)
	(M.L.odometr_frame)
	(M.L.fahrertuer_frame)	
	(M.L.rollo_frame)
	(M.L.engine_thermometer_frame)
	(M.L.microphone_frame)
	(M.L.pressure_warning_needle_frame)
	(M.L.zentralschmierung_frame)
	(M.L.Thermometer_frame)
	(M.L.ampermetr_frame)
	(M.L.reletuer_frame)
	(M.L.pandus_frame)
	(M.L.motortuer_frame)
	(M.L.windows_frame)
	(M.L.kryshka1_frame)
	(M.L.kryshka2_frame)
	(M.L.Thermometer_frame)
	(M.L.timer_frame)	
	(M.L.date_frame)
	

' Мигание ":" на часах
	(L.L.Time_timer) (S.L.Time_timer_last)

	(L.L.Time_timer) 1 <
	{if}
		(L.L.Time_timer) (L.S.Timegap) 2 * + (S.L.Time_timer)
	{else}
		0 (S.L.Time_timer)
	{endif}
	
	(L.L.Time_timer) (L.L.Time_timer_last) !
	{if}
		(L.L.Time_BlinkOn) ! (S.L.Time_BlinkOn)
	{endif}
	
	(L.L.timer_01) s0
	(L.L.timer_01) 1 <
	{if}
		(L.L.timer_01) (L.S.Timegap) 1.9 * + (S.L.timer_01)
	{else}
		0 (S.L.timer_01)
	{endif}
	(L.L.timer_01) l0 !
	{if}
		(L.L.Lamp01_BlinkOn) ! (S.L.Lamp01_BlinkOn)
	{endif}
		
{end}

'-------------------------------------
' VDO спидометр
'-------------------------------------

{macro:vdo_panel_speed_frame}
	(L.L.Velocity) $IntToStr (S.$.vdo_panel_speed)
{end}

'-------------------------------------
' VDO Часы
'-------------------------------------

{macro:vdo_panel_time_frame}
' Цифровые часы Автор Славок
 (L.S.Time) 3600 / trunc " 2" s0
 (L.S.Time) 60 / l0 60 * - s1 
 
 l0 10 <
 {if}
  "0" l0 $IntToStr $+
 {else}
  l0 $IntToStr
 {endif}
 
 l1 10 <
 {if}
  ":0" $+ l1 $IntToStr $+
 {else}
  ":" $+ l1 $IntToStr $+
 {endif}
 
 (S.$.vdo_panel_time)

'-------------------------------------
' Спидометр
'-------------------------------------
{macro:tacho_frame}
	(L.L.Velocity) (F.L.cockpit_tacholinie) (S.L.cp_speed_arrow)
{end}


'-------------------------------------
' Тахометр
'-------------------------------------
{macro:tachometr_frame}
	(L.L.engine_n) (F.L.cp_taho) (S.L.cp_taho_arrow)
{end}


{macro:uhr_frame}
	(L.S.Time) s0 60 / (S.L.cockpit_uhr_min) 12 / (S.L.cockpit_uhr_std)
	l0 trunc (S.L.cockpit_uhr_sek)
{end} 

{macro:drehzahlmesser_frame}
	(L.L.engine_n) 3000 270 / / (S.L.cockpit_drehzahlwinkel)
{end}



{macro:hupe_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.cockpit_hupe) 1 =
		{if}
			(L.L.cockpit_hupe_volume) 1 <
			{if}
				(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * + (S.L.cockpit_hupe_volume)
			{else}
				1 (S.L.cockpit_hupe_volume)
			{endif}
		{else}
			(L.L.cockpit_hupe_volume) 0 >
			{if}
				(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe_volume)
			{else}
				0 (S.L.cockpit_hupe_volume)
			{endif}
		{endif}
	{else}
		(L.L.cockpit_hupe_volume) 0 >
		{if}
			(L.L.cockpit_hupe_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe_volume)
		{else}
			0 (S.L.cockpit_hupe_volume)
		{endif}
	{endif}	
	
{end}

{macro:wischerhebel_frame}

	(L.L.cockpit_wischerhebel_lastmode) (L.L.cockpit_wischerhebel_mode) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischerhebel_mode) (S.L.cockpit_wischerhebel_lastmode)
{end}

{macro:wischer_drehschalter_frame}

	(L.L.cockpit_wischer_drehschalter_lastmode) (L.L.cockpit_wischer_drehschalter_mode) = !
	{if}
		(T.L.ev_wischerhebel)
	{endif}
	(L.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischer_drehschalter_lastmode)
{end}



{macro:cockpitlights_frame}

'	AKPP
	(L.L.antrieb_getr_gangwahl) 0 = (L.L.elec_busbar_main) &&
	(L.L.cockpit_gangR) 0 > &&
	(S.L.lights_zf_R)
	
	(L.L.antrieb_getr_gangwahl) 1 = (L.L.elec_busbar_main) &&
	(L.L.cockpit_gangN) 0 > &&
	(S.L.lights_zf_N)
	
	(L.L.antrieb_getr_gangwahl) 7 = (L.L.elec_busbar_main) &&
	(L.L.cockpit_gangD) 0 > &&
	(S.L.lights_zf_D)
	
	(L.L.antrieb_getr_gangwahl) 2 = (L.L.elec_busbar_main) &&
	(L.L.cockpit_gang1) 0 > &&
	(S.L.lights_zf_1)
	
	(L.L.antrieb_getr_gangwahl) 3 = (L.L.elec_busbar_main) &&
	(L.L.cockpit_gang2) 0 > &&
	(S.L.lights_zf_2)
	
	(L.L.antrieb_getr_gangwahl) 4 = (L.L.elec_busbar_main) &&
	(L.L.cockpit_gang3) 0 > &&
	(S.L.lights_zf_3)

'	Batterie
	(L.L.engine_n) 400 < (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_batterie)

'	Retarder
	(L.L.antrieb_retarder) (L.L.elec_busbar_main_sw) &&
	(S.L.light_antrieb_retarder)

	(L.L.matrix_power) 1 = (L.L.elec_busbar_main) &&
	(S.L.lights_bt_matrix)

'	12V
	(L.L.bt_elec_12v) 1 = (L.L.elec_busbar_main) &&
	(S.L.lights_elec_12v)
	(S.L.elec_12v)

'	ABS button	
	(L.L.bt_abs) 1 = (L.L.elec_busbar_main) &&
	(S.L.lights_bt_abs)
	
'	Validator	
	(L.L.bt_val) 1 = (L.L.elec_busbar_main) &&
	(S.L.lights_validator)

'	Lincoln	
	(L.L.lincoln) 1 = (L.L.elec_busbar_main) &&
	(S.L.light_lincoln)
	
'	Obduv
	(L.L.bt_obduv) 1 = (L.L.elec_busbar_main) &&
	(S.L.obduv)

'	Кнопка освещения экрана VDO	
	(L.L.vdo_panel_button) 1 = (L.L.elec_busbar_main) &&
	(S.L.vdo_panel_button_light)
	
'	Лампа-индиктор включения освещения пандуса

	(L.L.pandus)
	(L.L.elec_busbar_main) &&
	(S.L.light_pandus)

	(L.L.door_2L) 0 >
	(L.L.pandus) &&
	(L.L.elec_busbar_main) &&
		{if}
	0 (S.L.light_pandus)
 	0 (S.L.pandus) s1
	{endif}
	
'	Кнопки освещения салона	
	(L.L.bt_salon1_light) 1 = (L.L.elec_busbar_main) &&
	(S.L.lights_bt_salon)
	
	(L.L.bt_salon2_light) 1 = (L.L.elec_busbar_main) &&
	(S.L.lights_bt_salon1)

'	Кнопка освещения экрана	
	(L.L.ekran_light) 1 =
	(S.L.ekran_light)
	
'	light_ampermetr
'	lights_oellamp
'	lights_fuellamp
'	light_engtemp

	(L.L.light_ampermetr) (L.L.lights_oellamp) (L.L.lights_fuellamp) (L.L.light_engtemp) || || ||
	(L.L.elec_busbar_main) &&
	(S.L.light_warnlamp)
	
	(L.L.elec_busbar_main) (L.L.p_norm) 0 = &&
	(L.L.Time_BlinkOn) &&
	(S.L.kniling_off)

	(L.L.elec_busbar_main) (L.L.p_norm) 1 = &&
	(S.L.kniling_on)
	
'	Лампа работы ASR	
	(L.L.engine_ASR_eingriff) (L.L.elec_busbar_main_sw) &&
	(S.L.light_ASR)
	
'	Лампа-индикатор низкого давления в 1-ом контуре
'	Лампа-индикатор низкого давления в 2-ом контуре
	(L.L.bremse_p_tank02) 570000 < (L.L.Time_BlinkOn) &&
	(L.L.elec_busbar_main) &&
	(S.L.light_tank2)
	
'	Лампа-индикатор низкого давления в 3-ем контуре
	(L.L.bremse_p_tank03) 570000 < (L.L.Time_BlinkOn) &&
	(L.L.elec_busbar_main) &&
	(S.L.light_tank3)
	
'	Лампа-индикатор низкого давления в 4-ом контуре
	(L.L.bremse_p_tank04) 570000 < (L.L.Time_BlinkOn) &&
	(L.L.elec_busbar_main) &&
	(S.L.light_tank4)
	
	(L.L.bremse_feststell) (L.L.elec_busbar_main) &&
	(L.L.Lamp01_BlinkOn) &&
	(S.L.light_feststell)

	(L.L.bt_mirror_obogrev) (L.L.elec_busbar_main) &&
	(S.L.bt_light_mirror_obogrev)
	


'	Kippschalter-Beleuchtung
	(L.L.cp_retarder_sw_direkt) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_retarder_direkt)

	(L.L.cp_retarder_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_retarder)

	(L.L.cp_wischer_schnell_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_schnell)

	(L.L.cp_wischer_einaus_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_einaus)

	(L.L.cp_wischer_intervall_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_intervall)
	
	(L.L.cp_wischer_wascher_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_wischer_wascher)

	(L.L.cp_heizluefter_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_heizluefter)
	
	(L.L.cp_heizluefter2_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_heizluefter2)
	
	(L.L.cp_spiegelheizung_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_spiegelheizung)

	(L.L.cp_motorkuehlung_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_motorkuehlung)

	(L.L.door_handsteuerung) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tuer_handsteuerung)

	(L.L.cp_heizluefter_sw) (L.L.elec_busbar_main) &&
	(S.L.light_cp_heizluefter)

	(L.L.cp_knick_ovrd_sw) (L.L.elec_busbar_main) *
	(S.L.cockpit_light_knick_ovrd)


'	Dummy-Schalter:

	(L.L.cp_dummy_sw01) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func01)

	(L.L.cp_dummy_sw02) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func02)

	(L.L.cp_dummy_sw03) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func03)

	(L.L.cp_dummy_sw04) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func04)

{end}

'----------------------------------------
' Напряжение на аккумуляторных батареях
'----------------------------------------
{macro:ampermetr_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.elec_V_battery) 0.8 <
		{if}
			1 (S.L.light_ampermetr)
		{else}
			0 (S.L.light_ampermetr)
		{endif}
		(L.L.elec_V_battery) (F.L.cockpit_ampermetr) s0
	{else}
		0 s0
		0 (S.L.light_ampermetr)
	{endif}

'-------------------------------------------
' START Панель вольтметра электронного экрана
' почему переменные называюся cp_amper я хуй знает, написал и написал
'-------------------------------------------
	(L.L.cockpit_ampermetr) 5 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_1)
	{else}
		0 (S.L.cp_amper_1)
		
	{endif}

	(L.L.cockpit_ampermetr) 10 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_2)
	{else}
		0 (S.L.cp_amper_2)
		
	{endif}

	(L.L.cockpit_ampermetr) 15 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_3)
	{else}
		0 (S.L.cp_amper_3)
		
	{endif}

	(L.L.cockpit_ampermetr) 20 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_4)
	{else}
		0 (S.L.cp_amper_4)
		
	{endif}

	(L.L.cockpit_ampermetr) 25 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_5)
	{else}
		0 (S.L.cp_amper_5)
		
	{endif}

	(L.L.cockpit_ampermetr) 30 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_6)
	{else}
		0 (S.L.cp_amper_6)
		
	{endif}

	(L.L.cockpit_ampermetr) 35 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_7)
	{else}
		0 (S.L.cp_amper_7)
		
	{endif}

	(L.L.cockpit_ampermetr) 40 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_8)
	{else}
		0 (S.L.cp_amper_8)
		
	{endif}

	(L.L.cockpit_ampermetr) 45 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_9)
	{else}
		0 (S.L.cp_amper_9)
		
	{endif}

	(L.L.cockpit_ampermetr) 50 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_10)
	{else}
		0 (S.L.cp_amper_10)
		
	{endif}

	(L.L.cockpit_ampermetr) 55 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_11)
	{else}
		0 (S.L.cp_amper_11)
		
	{endif}

	(L.L.cockpit_ampermetr) 60 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_12)
	{else}
		0 (S.L.cp_amper_12)
		
	{endif}

	(L.L.cockpit_ampermetr) 65 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_13)
	{else}
		0 (S.L.cp_amper_13)
		
	{endif}

	(L.L.cockpit_ampermetr) 70 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_14)
	{else}
		0 (S.L.cp_amper_14)
		
	{endif}

	(L.L.cockpit_ampermetr) 75 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_15)
	{else}
		0 (S.L.cp_amper_15)
		
	{endif}

	(L.L.cockpit_ampermetr) 80 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_amper_16)
	{else}
		0 (S.L.cp_amper_16)
		
	{endif}
'-------------------------------------------
' END Панель вольтметра электронного экрана
'-------------------------------------------

	(L.L.cockpit_ampermetr) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_ampermetr)
{end}	

'----------------------------------------
{end}

{macro:oeldruck_frame}
	(L.L.engine_temperature) 0 <
	{if}
		(L.S.Weather_Temperature) (L.L.engine_temperature) - -5 >
		{if}
			(L.L.engine_n) 2 /
		{else}
			(L.L.engine_n)
		{endif}
		(F.L.cockpit_oeldruck) s0
	{else}
		(L.L.engine_n) (F.L.cockpit_oeldruck) s0
	{endif}

	(L.L.elec_busbar_main) !
	{if}
		0 s0
	{endif}

'-------------------------------------------
' START Панель давления масла электронного экрана
'-------------------------------------------	
	(L.L.cockpit_oeldruck) 6.66 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_1)
	{else}
		0 (S.L.cp_oil_1)
		
	{endif}

	(L.L.cockpit_oeldruck) 13.33 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_2)
	{else}
		0 (S.L.cp_oil_2)
		
	{endif}

	(L.L.cockpit_oeldruck) 19.99 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_3)
	{else}
		0 (S.L.cp_oil_3)
		
	{endif}

	(L.L.cockpit_oeldruck) 26.66 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_4)
	{else}
		0 (S.L.cp_oil_4)
		
	{endif}

	(L.L.cockpit_oeldruck) 33.33 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_5)
	{else}
		0 (S.L.cp_oil_5)
		
	{endif}

	(L.L.cockpit_oeldruck) 39.99 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_6)
	{else}
		0 (S.L.cp_oil_6)
		
	{endif}

	(L.L.cockpit_oeldruck) 46.65 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_7)
	{else}
		0 (S.L.cp_oil_7)
		
	{endif}

	(L.L.cockpit_oeldruck) 53.31 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_8)
	{else}
		0 (S.L.cp_oil_8)
		
	{endif}

	(L.L.cockpit_oeldruck) 59.97 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_9)
	{else}
		0 (S.L.cp_oil_9)
		
	{endif}

	(L.L.cockpit_oeldruck) 66.63 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_10)
	{else}
		0 (S.L.cp_oil_10)
		
	{endif}

	(L.L.cockpit_oeldruck) 73.29 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_11)
	{else}
		0 (S.L.cp_oil_11)
		
	{endif}

	(L.L.cockpit_oeldruck) 80 >=
	(L.L.liazlogo_timer_start) 5 >
	(L.L.elec_busbar_main) 1 = && &&
	{if}
		1 (S.L.cp_oil_12)
	{else}
		0 (S.L.cp_oil_12)
		
	{endif}
'-------------------------------------------
' END Панель давления масла электронного экрана
'-------------------------------------------

	(L.L.cockpit_oeldruck) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_oeldruck)
{end}

'-------------------------------------------
	
	(L.L.elec_busbar_main)
	{if}
		l1 15 < l1 1 > && (S.L.lights_oellamp)
	{else}
		0 (S.L.lights_oellamp)
	{endif}
{end}

{macro:tankuhr_frame}
	(L.L.elec_busbar_main)
	{if}
		(L.L.engine_tank_content) (F.L.cockpit_tankuhr) s0 100 < (S.L.lights_fuellamp)
	{endif}

	(L.L.elec_busbar_main) !
	{if}
		0 s0 (S.L.lights_fuellamp)
	{endif}

	(L.L.cockpit_tankuhr) s1
	2 s2
	2 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_tankuhr)

		(L.L.engine_tank_content) s0 trunc " 3" $IntToStrEnh "" $+
		(S.$.fuel)
{end}

{macro:engine_thermometer_frame}
	(L.L.elec_busbar_main) !
	{if}
		0 s0 (S.L.light_engtemp)
	{else}
		(L.L.engine_temperature) (F.L.cockpit_engine_temperature) s0
		(L.L.engine_temperature) 105 > (S.L.light_engtemp)
	{endif}

	(L.L.cockpit_motortemperaturwinkel) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_motortemperaturwinkel)
{end}


{macro:outside_hatches_sound}
	l1
	{if}
		(T.L.outside_hatches_sound_opn)
	{else}
		(T.L.outside_hatches_sound_cls)
	{endif}	
{end}

{macro:klappfenstersound}
	l1
	{if}
		(T.L.ev_klappfenster_opn)
	{else}
		(T.L.ev_klappfenster_cls)
	{endif}	
{end}
	

{macro:kippschaltersound}
	l1
	{if}
		(T.L.ev_kippschalter_ein)
	{else}
		(T.L.ev_kippschalter_aus)
	{endif}	
{end}

{macro:klappfenstersound}
	l1
	{if}
		(T.L.ev_klappfenster_opn)
	{else}
		(T.L.ev_klappfenster_cls)
	{endif}	
{end}


{macro:klimator_frame}

'Frontheizgerдt:
	(L.L.elec_busbar_main)
	{if}
		(L.L.cp_klimator_sw) s1
	{else}
		0 s1
	{endif}

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_klimator_RPM) > 
	{if}
		1.5 s0
	{else}
		0.5 s0
	{endif}

' Berechnung der Luefterbeschleunigung:
'Расчет ускорения вентилятора:

'Sollwert:
'заданная величина
	l1 100 * 
'Istwert:
'фактический:
	(L.L.cp_klimator_RPM)
'Beschleunigung:
'ускорение:
	- s0 * (L.S.Timegap) *
'Addition zum Istwert:
'Дополнение к фактическим значением:
	(L.L.cp_klimator_RPM) + (S.L.cp_klimator_RPM)


'Raumheizgerдte:
	(L.L.elec_busbar_main)
	{if}
		(L.L.cp_heizluefter_sw) s1
	{else}
		0 s1
	{endif}

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_cabinheater_RPM) > 
	{if}
		6 s0
	{else}
		1.0 s0
	{endif}

' Berechnung der Luefterbeschleunigung:

'Sollwert:
	l1 100 * 
'Istwert:
	(L.L.cp_cabinheater_RPM)
'Beschleunigung:
	- s0 * (L.S.Timegap) *
'Addition zum Istwert:
	(L.L.cp_cabinheater_RPM) + (S.L.cp_cabinheater_RPM)

{end}

{macro:traegheit}

'Simuliert trдges Verhalten (exponentiell)
'Имитация вялым поведением

'Ladekonventionen Зарядка конвенций:
'	Sollwert		l0
'	заданное значение
'	Istwert			l1
'	Актуальное
'	Konstante Anlauf	l2 (Einheiten/s)
'	Konstante Ablauf	l3 (Einheiten/s)

'Anlauf oder Auslauf?
	l0 l1 > 
	{if}
		l2 (L.S.Timegap) * 1 min -1 max s4
	{else}
		l3 (L.S.Timegap) * 1 min -1 max s4
	{endif}


'Sollwert:
	l0
'Istwert:
	l1
'Beschleunigung:
	- l4 *
'Addition zum Istwert:
	l1 + s1
{end}

'	 Дверца водителя.
{macro:fahrertuer_frame}

	(L.L.cp_fahrertuer_dragged) !
	{if}
		(L.L.cp_fahrertuer_pos) (L.S.Timegap) (L.L.cp_fahrertuer_speed) * + (S.L.cp_fahrertuer_pos)

		(L.L.cp_fahrertuer_pos) 1 >
		{if}
			1 (S.L.cp_fahrertuer_pos)
			(L.L.cp_fahrertuer_speed) /-/ 0.7 * (S.L.cp_fahrertuer_speed)
		{endif}
		(L.L.cp_fahrertuer_pos) 0 <
		{if}
			0 (S.L.cp_fahrertuer_speed) (S.L.cp_fahrertuer_pos)
		{endif}

		(L.L.cp_fahrertuer_pos) 0 >
		{if}
			(L.L.cp_fahrertuer_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_fahrertuer_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_fahrertuer_globalangle) * * + (S.L.cp_fahrertuer_speed)
		{endif}
	
		(L.L.cp_fahrertuer_speed) s0 (S.L.cp_fahrertuer_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_fahrertuer_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_fahrertuer_speed)
		{endif}


		(L.L.cp_fahrertuer_speed) 0 > (L.L.cp_fahrertuer_lastspeed) 0 < &&
		(L.L.cp_fahrertuer_speed) 0 < (L.L.cp_fahrertuer_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_fahrertuer_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_fahrertuer_pos) 0 > (L.L.cp_fahrertuer_open) ! &&
	{if}
		(T.L.ev_fahrertuer_auf)
		1 (S.L.cp_fahrertuer_open)
	{endif}

	(L.L.cp_fahrertuer_pos) 0 = (L.L.cp_fahrertuer_open) &&
	{if}
		(T.L.ev_fahrertuer_zu)
		0 (S.L.cp_fahrertuer_open)
	{endif}

	(L.L.cp_fahrertuer_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_fahrertuer_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
	

{end}


'	Крышка щитка реле

{macro:reletuer_frame}

	(L.L.cp_sr_dragged) !
	{if}
		(L.L.cp_sr_pos) (L.S.Timegap) (L.L.cp_sr_speed) * + (S.L.cp_sr_pos)

		(L.L.cp_sr_pos) 1 >
		{if}
			1 (S.L.cp_sr_pos)
			(L.L.cp_sr_speed) /-/ 0.7 * (S.L.cp_sr_speed)
		{endif}
		(L.L.cp_sr_pos) 0 <
		{if}
			0 (S.L.cp_sr_pos)
		{endif}

		(L.L.cp_sr_pos) 0 >
		{if}
			(L.L.cp_sr_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_sr_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_sr_globalangle) * * + (S.L.cp_sr_speed)
		{endif}
	
		(L.L.cp_sr_speed) s0 (S.L.cp_sr_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_sr_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_sr_speed)
		{endif}


		(L.L.cp_sr_speed) 0 > (L.L.cp_sr_lastspeed) 0 < &&
		(L.L.cp_sr_speed) 0 < (L.L.cp_sr_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_sr_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_sr_pos) 0 > (L.L.cp_sr_open) ! &&
	{if}
		(T.L.ev_sr_auf)
		1 (S.L.cp_sr_open)
	{endif}

	(L.L.cp_sr_pos) 0 = (L.L.cp_sr_open) &&
	{if}
		(T.L.ev_sr_zu)
		0 (S.L.cp_sr_open)
	{endif}

	(L.L.cp_sr_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_sr_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
	

{end}


'	Пандус...

{macro:pandus_frame}

	(L.L.pandus_dragged) !
	{if}
		(L.L.pandus_pos) (L.S.Timegap) (L.L.pandus_speed) * + (S.L.pandus_pos)
		
'	Падение(если поднят)
		(L.L.pandus_pos) 0.45 >
		{if}
			(L.L.pandus_speed) (L.S.Timegap) + (S.L.pandus_speed)
		{endif}
		
		(L.L.pandus_pos) 0.45 <
		{if}
			(L.L.pandus_speed) (L.S.Timegap) -1 * + (S.L.pandus_speed)
		{endif}
		

'	Отскок при максимальном откр.\закр.
		(L.L.pandus_pos) 1 >
		{if}
			1 (S.L.pandus_pos)
'	Отскок
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}

		(L.L.pandus_pos) 0 <
		{if}
			0 (S.L.pandus_pos)
'	Отскок
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}

'	Подпрыгивание при езде с открытым пандусом (на всякий... пожарный))).
		(L.L.Velocity) 100 / 0.2 min s3
		
		(L.L.pandus_pos) 1 = (L.L.Velocity) 0 > &&
		{if}
			(L.L.pandus_speed) l3 - (S.L.pandus_speed)
		{endif}

'	Полная остановка.	
		(L.L.Velocity) 2 > (L.L.pandus_pos) 0.5 > &&
		{if}
			0 (S.L.empty_01)
		{endif}
		
		(L.L.pandus_speed) 0 = !
		{if}
			(L.L.pandus_pos) 0.005 < (L.L.pandus_pos) 0.995 > ||
			{if}
				(L.L.empty_01) 1 <
				{if}
					(L.L.empty_01) (L.S.Timegap) + (S.L.empty_01)
				{else}
					0 (S.L.pandus_speed)
				{endif}
			{else}
				0 (S.L.empty_01)
			{endif}
		{endif}
	{endif}

'	Открыт или закрыт пандус.		
	(L.L.pandus_pos) 0.4 > (L.L.door_2L) &&
	{if}
		1 (S.L.pandus_opn)
		0 (S.L.pandus_cls)
	{endif}

	(L.L.pandus_pos) 0.2 < (L.L.door_2L) &&
	{if}
		1 (S.L.pandus_cls)
		0 (S.L.pandus_opn)
	{endif}

'	Отскок от закрытой двери.		
	(L.L.pandus_opn) (L.L.door_2L) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.47 < 
		{if}
			0.47 (S.L.pandus_pos)
'	Отскок
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}
	{endif}
		
	(L.L.pandus_cls) (L.L.door_2L) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.1 > 
		{if}
			0.1 (S.L.pandus_pos)
'	Отскок
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}
	{endif}

	(L.L.pandus_pos) 0.01 >
	{if}
		0 (S.L.pandus_close)
	{endif}

	(L.L.pandus_pos) 0 = (L.L.pandus_close) ! &&
	{if}
		1 (S.L.pandus_close)
		(T.L.ev_pandus_zu)
	{endif}
	
	(L.L.pandus_pos) 0.99 <
	{if}
		0 (S.L.pandus_open)
	{endif}

	(L.L.pandus_pos) 1 = (L.L.pandus_open) ! &&
	{if}
		(T.L.ev_pandus_zu)
		1 (S.L.pandus_open)
	{endif}
	
	(L.L.pandus_pos) 0.48 > (L.L.door_2L) ! &&
	{if}
		0 (S.L.pandus_door_stuk)
	{endif}

	(L.L.pandus_pos) 0.47 = (L.L.door_2L) ! (L.L.pandus_door_stuk) ! && &&
	{if}
		1 (S.L.pandus_door_stuk)
		(T.L.ev_pandus_zu)
	{endif}
	
	(L.L.pandus_speed) 0 <
	{if}
		(L.L.pandus_speed) /-/ (S.L.pandus_stuk_vol)
	{else}
		(L.L.pandus_speed) (S.L.pandus_stuk_vol)
	{endif}

{end}

'	Капот.
{macro:motortuer_frame}

	(L.L.motortuer_pos) 0.1 >
	{if}
	(L.L.motortuer_speed) abs (S.L.motortuer_volcurve)
'		(L.L.motortuer_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.motortuer_volcurve)
'		{else}
'			l0 (S.L.motortuer_volcurve)
'		{endif}
	{endif}

	(L.L.motortuer_dragged) !
	{if}
		(L.L.motortuer_pos) (L.S.Timegap) (L.L.motortuer_speed) * + (S.L.motortuer_pos)
		
		(L.L.motortuer_pos) 0.35 >
		{if}
			(L.L.motortuer_speed) (L.S.Timegap) + (S.L.motortuer_speed)
		{endif}
		
		(L.L.motortuer_pos) 0.35 <
		{if}
			(L.L.motortuer_speed) (L.S.Timegap) -1 * + (S.L.motortuer_speed)
		{endif}

		(L.L.motortuer_pos) 1 >
		{if}
			1 (S.L.motortuer_pos)
			(L.L.motortuer_speed) /-/ 0.2 * 0.2 min (S.L.motortuer_speed)
		{endif}
		(L.L.motortuer_pos) 0 <
		{if}
			0 (S.L.motortuer_speed) (S.L.motortuer_pos)
		{endif}

'	Полная остановка.	
		(L.L.motortuer_speed) 0 = !
		{if}
			(L.L.motortuer_pos) 0.005 < (L.L.motortuer_pos) 0.995 > ||
			{if}
				(L.L.empty_02) 1 <
				{if}
					(L.L.empty_02) (L.S.Timegap) + (S.L.empty_02)
				{else}
					0 (S.L.motortuer_speed)
				{endif}
			{else}
				0 (S.L.empty_02)
			{endif}
		{endif}
		
		(L.L.bottle_visible) 1 =
		{if}
			(L.L.motortuer_pos) 0.06 <
			{if}
				0.06 (S.L.motortuer_pos)
				(L.L.motortuer_speed) /-/ 0.1 * 0.2 min (S.L.motortuer_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.motortuer_pos) 0 > (L.L.motortuer_open) ! &&
	{if}
		1 (S.L.motortuer_open)
	{endif}

	(L.L.motortuer_pos) 0 = (L.L.motortuer_open) &&
	{if}
		(T.L.ev_motortuer_cls)
		0 (S.L.motortuer_open)
	{endif}
{end}


{macro:rollo_frame}
	(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) max (S.L.cp_rollo_rastpos)
	
	(L.L.cp_rollo_pos) 0.4 >=
	{if}
		(L.L.cp_rollo_pos) 0.4 - 1.666 * (S.L.cp_rollo_pos_2) s1
		l1 0 <
		{if}
			0 (S.L.cp_rollo_pos_2)
		{endif}
		l1 1 >
		{if}
			1 (S.L.cp_rollo_pos_2)
		{endif}
	{endif}

	(L.L.cp_rollo_dragged) !
	{if}
		(L.L.cp_rollo_retract)
		{if}
			(L.L.cp_rollo_speed) (L.S.Timegap) (L.L.cp_rollo_pos) 14 * * - (S.L.cp_rollo_speed)
			(L.L.cp_rollo_pos) (L.S.Timegap) (L.L.cp_rollo_speed) * + (S.L.cp_rollo_pos) (S.L.cp_rollo_rastpos) 0.4 - 1.666 * (S.L.cp_rollo_pos_2)
					
		{else}
			(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) < 
			{if}
				(L.L.cp_rollo_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo_speed)
				(L.L.cp_rollo_pos) (L.S.Timegap) (L.L.cp_rollo_speed) * + (L.L.cp_rollo_rastpos) min (S.L.cp_rollo_pos) 0.4 - 1.666 * (S.L.cp_rollo_pos_2)
			{else}
				0 (S.L.cp_rollo_speed)
			{endif}
		{endif}

		(L.L.cp_rollo_pos) 1 >
		{if}
			1 (S.L.cp_rollo_pos) (S.L.cp_rollo_rastpos)
		{else}
			(L.L.cp_rollo_pos) 0 <
			{if}
			0 (S.L.cp_rollo_pos) (S.L.cp_rollo_retract) (S.L.cp_rollo_rastpos)
			{endif}
		{endif}
		
		(L.L.cp_rollo_pos_2) 0 <
		{if}
			0 (S.L.cp_rollo_pos_2)
		{endif}
		(L.L.cp_rollo_pos_2) 1 >
		{if}
			1 (S.L.cp_rollo_pos_2)
		{endif}

	{endif}
{end}



{macro:microphone_frame}

	(L.L.cp_microphone_sw)
	(L.L.elec_busbar_main) && s0
	(L.L.Snd_Microphone) s1


	l0 l1 ! &&
	{if}
		(T.L.micro_lautsprecherknack_start)
	{endif}

	l0 ! l1 &&
	{if}
		(T.L.micro_lautsprecherknack_end)
	{endif}


	l0 (S.L.Snd_Microphone)
{end}


{macro:pressure_warning_needle_frame}

	(L.L.bremse_p_Tank01) (L.L.bremse_p_Tank02) + 2 / (S.L.cockpit_warndruck) (F.L.cockpit_warndruck) (S.L.cockpit_warndruckwinkel)

{end}

{macro:zentralschmierung_frame}

	(L.L.cp_zentralschmierung_nextkm) (L.L.velocity) 3600 / (L.S.Timegap) * + (S.L.cp_zentralschmierung_nextkm)
	(C.L.cockpit_zentralschmierung_dist) >
	(L.L.cp_zentralschmierung_runtime) (C.L.cockpit_zentralschmierung_maxtime) < &&
	{if}
		1 (S.L.cockpit_light_zentralschmierung)
		(L.L.cp_zentralschmierung_runtime) (L.S.Timegap) + (S.L.cp_zentralschmierung_runtime)
	{else}
		(L.L.cockpit_light_zentralschmierung)
		{if}
			0 (S.L.cp_zentralschmierung_nextkm)
		{endif}
		0 (S.L.cockpit_light_zentralschmierung) (S.L.cp_zentralschmierung_runtime)
	{endif}	

{end}

{macro:Thermometer_frame}

	(L.L.Cabinair_Temp) s0 trunc " 3" $IntToStrEnh "." $+ 
	l0 abs l0 abs trunc - 10 * trunc " 1" $IntToStrEnh $+ "C" $+
	(S.$.cockpit_temperatur)
	
'	Спиртовой термометр(уличный)

	50 (L.S.Weather_Temperature) + trunc 0 max 100 min s1
	"C" 100 $* l1 $SetLengthL (S.$.weather_temp_spirt_termometr)
	
'	Спиртовой термометр(салонный)

	50 (L.L.Cabinair_Temp) + trunc 0 max 100 min s1
	"C" 100 $* l1 $SetLengthL (S.$.cockpit_temp_spirt_termometr)
{end}

{macro:odometr_frame}
'	Выравнивание переменных
	(L.L.kmcounter_km) (L.L.kmcounter_m) 1000 / + (S.L.km_counter_km)
	(L.L.km_counter_km) 10 * trunc 10 / (S.L.km_counter_km)
	(L.L.kmcounter_m) "04" $IntToStrEnh 3 $SetLengthR (S.$.km_counter_m)
	(L.$.km_counter_m) 1 $SetLengthL $StrToFloat trunc (S.L.km_counter_m)
'	-------------------------


	(L.L.km_counter_km) (L.L.km_counter_km_last) - (S.L.km_counter_km_day)
	(L.L.km_counter_m) (L.L.km_counter_m_last) <
	{if}
		10 (L.L.km_counter_m) + (L.L.km_counter_m_last) - (S.L.km_counter_m_day)
	{else}
		(L.L.km_counter_m) (L.L.km_counter_m_last) - (S.L.km_counter_m_day)
	{endif}
	
	(L.L.elec_busbar_main)
	{if}
'		Расчет общего пробега
		(L.L.km_counter_km) trunc " 7" $IntToStrEnh 5 $SetLengthR
		"." $+
		(L.$.km_counter_m) 1 $SetLengthL $+
		(S.$.odometr_full)

'		Расчет суточного пробега
		(L.L.km_counter_km_day) " 4" $IntToStrEnh
		"." $+
		(L.L.km_counter_m_day) trunc $IntToStr $+
		" " $+
		(S.$.odometr_day)
		
'		Если суточный пробег будет больше 9999 км, то он автоматически сбросится (защита от дурака)		
		(L.L.km_counter_km_day) 9999 >=
		{if}
			0 (S.L.odometr_sbros)
		{endif}
		
		(L.L.odometr_sbros) 0 =
		{if}
			(L.L.km_counter_km) (S.L.km_counter_km_last)
			(L.L.km_counter_m) (S.L.km_counter_m_last)
			1 (S.L.odometr_sbros)
		{endif}
		
	{else}
		" " $ (S.$.odometr_full)
		" " $ (S.$.odometr_day)
	{endif}
{end}

{macro:windows_frame}

'	Запотевание

	(L.S.Weather_Temperature) 10 <
	(L.L.Rain_Window_Norm_Wetness) ||
	{if}
		(L.S.Weather_Temperature) 0 >
		{if}
			(L.L.Glass_pot) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot)
			(L.L.bt_obduv) (L.L.elec_busbar_main) &&
			{if}
				(L.L.Glass_pot_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front)
				(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.001 * - 0 max (S.L.Glass_pot_front_noObduv)
			{else}
				(L.L.Glass_pot_front) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot_front)
				(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.05 * + 1 min (S.L.Glass_pot_front_noObduv)
			{endif}
		{endif}
	{else}
		(L.L.bt_obduv) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_pot_front) (L.S.Timegap) 0.05 * - 0 max (S.L.Glass_pot_front)
		{else}
			(L.L.Glass_pot_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front)
		{endif}
		(L.L.Glass_pot) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot)
		(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_noObduv)
	{endif}
	
'	Замерзание
	
	(L.S.Weather_Temperature) 0 <
	{if}
		(L.L.Glass_ice) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice)
		(L.L.Glass_pot) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot)
		(L.L.Glass_pot_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front)
		(L.L.Glass_pot_front_noObduv) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_pot_front_noObduv)
		
		(L.L.bt_obduv) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.005 * - 0 max (S.L.Glass_ice_front_noObduv)
		{else}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.01 * + 1 min (S.L.Glass_ice_front_noObduv)
		{endif}
	{else}
		(L.L.Glass_ice) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice)
		(L.L.bt_obduv) (L.L.elec_busbar_main) &&
		{if}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.05 * - 0 max (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.02 * - 0 max (S.L.Glass_ice_front_noObduv)
		{else}
			(L.L.Glass_ice_front) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front)
			(L.L.Glass_ice_front_noObduv) (L.S.Timegap) 0.01 * - 0 max (S.L.Glass_ice_front_noObduv)
		{endif}
	{endif}
	
	
'	Зеркала
	
	(L.S.PrecipType) 0 >
	{if}
		(L.L.Precip_mirror) (L.S.Timegap) (L.S.PrecipRate) 2 / * + 1 min (S.L.Precip_mirror)
	{else}
		(L.S.Weather_Temperature) 0 >
		{if}
			(L.L.Precip_mirror) (L.S.Timegap) 0.1 * - 0 max (S.L.Precip_mirror)
		{endif}
	{endif}
	
	(L.L.bt_mirror_obogrev) (L.L.elec_busbar_main) &&
	{if}
		(L.L.mirror_temp) (L.S.Timegap) 0.05 * + 0.5 min (S.L.mirror_temp)
		(L.L.Precip_mirror) (L.S.Timegap) (L.L.mirror_temp) * - 0 max (S.L.Precip_mirror)
	{else}
		(L.L.mirror_temp) (L.S.Timegap) 0.05 * - 0 max (S.L.mirror_temp)
	{endif}

	
{end}

{macro:kryshka1_frame}

	(L.L.cp_kryshka1_dragged) !
	{if}
		(L.L.cp_kryshka1_pos) (L.S.Timegap) (L.L.cp_kryshka1_speed) * + (S.L.cp_kryshka1_pos)

		(L.L.cp_kryshka1_pos) 1 >
		{if}
			1 (S.L.cp_kryshka1_pos)
			(L.L.cp_kryshka1_speed) /-/ 0.7 * (S.L.cp_kryshka1_speed)
		{endif}
		(L.L.cp_kryshka1_pos) 0 <
		{if}
			0 (S.L.cp_kryshka1_speed) (S.L.cp_kryshka1_pos)
		{endif}

		(L.L.cp_kryshka1_pos) 0 >
		{if}
			(L.L.cp_kryshka1_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_kryshka1_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_kryshka1_globalangle) * * + (S.L.cp_kryshka1_speed)
		{endif}
	
		(L.L.cp_kryshka1_speed) s0 (S.L.cp_kryshka1_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_kryshka1_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_kryshka1_speed)
		{endif}


		(L.L.cp_kryshka1_speed) 0 > (L.L.cp_kryshka1_lastspeed) 0 < &&
		(L.L.cp_kryshka1_speed) 0 < (L.L.cp_kryshka1_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_kryshka1_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_kryshka1_pos) 0 > (L.L.cp_kryshka1_open) ! &&
	{if}
		(T.L.ev_kryshka1_auf)
		1 (S.L.cp_kryshka1_open)
	{endif}

	(L.L.cp_kryshka1_pos) 0 = (L.L.cp_kryshka1_open) &&
	{if}
		(T.L.ev_kryshka1_zu)
		0 (S.L.cp_kryshka1_open)
	{endif}

	(L.L.cp_kryshka1_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_kryshka1_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
	

{end}

{macro:kryshka2_frame}

	(L.L.cp_kryshka2_dragged) !
	{if}
		(L.L.cp_kryshka2_pos) (L.S.Timegap) (L.L.cp_kryshka2_speed) * + (S.L.cp_kryshka2_pos)

		(L.L.cp_kryshka2_pos) 1 >
		{if}
			1 (S.L.cp_kryshka2_pos)
			(L.L.cp_kryshka2_speed) /-/ 0.7 * (S.L.cp_kryshka2_speed)
		{endif}
		(L.L.cp_kryshka2_pos) 0 <
		{if}
			0 (S.L.cp_kryshka2_speed) (S.L.cp_kryshka2_pos)
		{endif}

		(L.L.cp_kryshka2_pos) 0 >
		{if}
			(L.L.cp_kryshka2_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_kryshka2_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_kryshka2_globalangle) * * + (S.L.cp_kryshka2_speed)
		{endif}
	
		(L.L.cp_kryshka2_speed) s0 (S.L.cp_kryshka2_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_kryshka2_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_kryshka2_speed)
		{endif}


		(L.L.cp_kryshka2_speed) 0 > (L.L.cp_kryshka2_lastspeed) 0 < &&
		(L.L.cp_kryshka2_speed) 0 < (L.L.cp_kryshka2_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_kryshka2_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_kryshka2_pos) 0 > (L.L.cp_kryshka2_open) ! &&
	{if}
		(T.L.ev_kryshka2_auf)
		1 (S.L.cp_kryshka2_open)
	{endif}

	(L.L.cp_kryshka2_pos) 0 = (L.L.cp_kryshka2_open) &&
	{if}
		(T.L.ev_kryshka2_zu)
		0 (S.L.cp_kryshka2_open)
	{endif}

	(L.L.cp_kryshka2_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_kryshka2_globalangle) 

	(L.L.velocity) (L.L.cp_velocity_last) - (S.L.cp_acceleration)
	(L.L.velocity) (S.L.cp_velocity_last)
	

{end}

{macro:Thermometer_frame}

	(L.L.Cabinair_Temp) -10 < 
	(L.L.Cabinair_Temp) 100 > ||
	{if}
		(L.L.Cabinair_Temp) $IntToStr (S.$.cockpit_temperatur)
	{else}
		(L.L.Cabinair_Temp) 10 > 
		(L.L.Cabinair_Temp) -1 < ||
		{if}
			" " (L.L.Cabinair_Temp) $IntToStr $+ (S.$.cockpit_temperatur)
		{else}
			(L.L.Cabinair_Temp) 0 < ||
			{if}
				" -" (L.L.Cabinair_Temp) $IntToStr $+ (S.$.cockpit_temperatur)
			{else}
				"  " (L.L.Cabinair_Temp) $IntToStr $+ (S.$.cockpit_temperatur)
			{endif}
		{endif}
	{endif}

	
	(L.S.Weather_Temperature) -10 < 
	(L.S.Weather_Temperature) 100 > ||
	{if}
		(L.S.Weather_Temperature) $IntToStr (S.$.Temp_out)
	{else}
		(L.S.Weather_Temperature) 10 > 
		(L.S.Weather_Temperature) -1 < ||
		{if}
			" " (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
		{else}
			(L.S.Weather_Temperature) 0 < ||
			{if}
				" -" (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
			{else}
				"  " (L.S.Weather_Temperature) $IntToStr $+ (S.$.Temp_out)
			{endif}
		{endif}
	{endif}	
{end}

{macro:timer_frame}

	(L.S.Time) 3600 / trunc " 2" s0
	(L.S.Time) 60 / l0 60 * - s1 
	
	l0 10 <
	{if}
		"0" l0 $IntToStr $+
	{else}
		l0 $IntToStr
	{endif}
	
	l1 10 <
	{if}
		":0" $+ l1 $IntToStr $+
	{else}
		":" $+ l1 $IntToStr $+
	{endif}
	
	(S.$.Timer)
	{end}

	
{macro:date_frame}	
	
			(L.S.Day) "02" $IntToStrEnh "." $+
			(L.S.Month) "02" $IntToStrEnh $+ 			
    (S.$.date)

	{end}