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

'Simuliert alle unmittelbar mit dem Armaturenbrett zusammenhängenden Funktionen

'(c) 23.10.2009 Rüdiger Hülsmann
'(c) 15.04.2010 Marcel Kuhnt

'Script Version: 1.0
'Omsi release: 1.0

'Needs:
'- antrieb
'- engine
'- bremse
'- lights
'- wiper?
'- doors


'Revision History:
'- Rüdiger Hülsmann	09.06.2009	Last Change				
'- Marcel Kuhnt		13.06.2009	Added Gearbox switches			
'- Marcel Kuhnt		13.06.2009	Moved some switchvars to other scripts	
'- Rüdiger Hülsmann	19.06.2009	Added Openable Window Triggers
'- Rüdiger Hülsmann	23.10.2009	Added Battery and kinderwagen light
'- Marcel Kuhnt		26.10.2009	Radio switchable with Motorkühlung (replaced with cassette player)
'- Rüdiger Hülsmann	28.10.2009	Added driver door
'- Rüdiger Hülsmann	16.12.2009	Added driver curtain
'- Rüdiger Hülsmann	18.12.2009	Bugfix driver curtain
'- Marcel Kuhnt		15.04.2010	Traegheit debugged
'- Rüdiger Hülsmann	13.05.2010	Engine temperature
'- Rüdiger Hülsmann	03.06.2010	Automatic battery switch on key insertion (For standard-II-buses)
'- Rüdiger Hülsmann	08.06.2010	Automatic battery switch made optional, Auxiliary heating switchable by button or switch
'- Rüdiger Hülsmann	23.06.2010	Added mouse-clickable wiper lever on wheel console
'- Rüdiger Hülsmann	08.07.2010	Wiper lever: Improved usability 
'- Rüdiger Hülsmann	18.07.2010	Wiper lever: soundfix for keyboard operation and new ignition key algorithm 
'- Rüdiger Hülsmann	16.09.2010	Auxheat Switch Bugfix
'- Rüdiger Hülsmann	18.09.2010	Imported microphone switch
'- Rüdiger Hülsmann	17.10.2010	Added pressure warning needle
'- Rüdiger Hülsmann	23.10.2010	Added old-style gear button functionality
'- Rüdiger Hülsmann	06.11.2010	Gear-button "1" functionality removed for old-style gear buttons
'- Rüdiger Hülsmann	16.11.2010	Heating sliders
'- Rüdiger Hülsmann	23.11.2010	Central lubrication, cabin heater sound
'- Rüdiger Hülsmann	23.12.2010	Included 10 "multi-purpose" dummy switches
'- Rüdiger Hülsmann	29.12.2010	ASR switch
'- Rüdiger Hülsmann	04.01.2011	"D-only" gear selector function
'- Rüdiger Hülsmann	05.01.2011	fog lamp switch, high beam lever animation, clock debugged
'- Rüdiger Hülsmann	07.01.2011	Wiper lever sound and function debugges, availybility of several cockpit functions depending on bus type (via constfile)
'- Rüdiger Hülsmann	16.01.2011	Support for wiper turn-switch
'- Rüdiger Hülsmann	18.01.2011	Old-style gear button sounds
'- Rüdiger Hülsmann	26.01.2011	Invertable driver door
'- Rüdiger Hülsmann	26.01.2011	Thermometer
'- Vitaly.L	        28.02.2015	Óáğàí êîìáèíèğîâàííûé ïåğåêëş÷àòåëü äâîğíèêîâ è çàâèñèìîñòü ìåæäó ğåæèìàìè.

'------------------------------------------------------------------------------------------
'----------------------
'	Trigger
'----------------------

{trigger:kw_batterietrennschalter}
	1 (S.L.cp_taster_batterietrennschalter)

	(L.L.cp_schluessel_trans)
	{if}
		1 (S.L.elec_busbar_main_sw)
	{endif}

{end}

{trigger:kw_batterietrennschalter_off}
	0 (S.L.cp_taster_batterietrennschalter)
{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:cp_fahrerlicht_toggle}
	(L.L.cp_fahrerlicht_sw) ! (S.L.cp_fahrerlicht_sw) s1
	(M.L.kippschaltersound)
{end}

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

{trigger:cp_licht_oberdeck_toggle}
	(L.L.cp_licht_oberdeck_sw) 
	{if}
		0 (S.L.cp_licht_oberdeck_sw) s1
	{else}
		1 (S.L.cp_licht_oberdeck_sw) 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}		
	(M.L.kippschaltersound)
{end}

{trigger:cp_fan}
	(L.L.cp_fan) ! (S.L.cp_fan) s0
	(T.L.ev_kippschalter_aus)
{end}

{trigger:cp_fan_spd}
	(L.L.cp_fan_spd) ! (S.L.cp_fan_spd) s0
	(T.L.ev_kippschalter_aus)
{end}

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

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

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

{trigger:cp_wischer_wascher_button}
	1 (S.L.cp_wischer_wascher_sw) s1
	(C.L.wiper_lever)
	{if}
		(T.L.ev_wischerhebel)
		1 (S.L.cockpit_wischerhebel_x)
	{else}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:cp_wischer_wascher_button_off}
	0 (S.L.cp_wischer_wascher_sw) s1
	(S.L.wiper_wascher_sw)
	(C.L.wiper_lever)
	{if}
		(T.L.ev_wischerhebel)
		0 (S.L.cockpit_wischerhebel_x)
	{else}
		l1 (M.L.kippschaltersound)
	{endif}
{end}

{trigger:Motortuer_drag}

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

	(L.S.mouse_x) -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:bagaznik1_drag}

	1 (S.L.bagaznik1_dragged)
	(L.L.bagaznik1_pos) (S.L.bagaznik1_lastpos)

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

	(L.L.bagaznik1_pos) (L.L.bagaznik1_lastpos) - (L.S.Timegap) / (S.L.bagaznik1_speed)
{end}

{trigger:bagaznik1_off}
	0 (S.L.bagaznik1_dragged)
{end}

{trigger:sumka}
	(L.L.bagaznik1_pos) 0.05 >
	{if}
		(L.L.sumka_visible) ! (S.L.sumka_visible)
	{endif}
{end}

{trigger:bagaznik2_drag}

	1 (S.L.bagaznik2_dragged)
	(L.L.bagaznik2_pos) (S.L.bagaznik2_lastpos)

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

	(L.L.bagaznik2_pos) (L.L.bagaznik2_lastpos) - (L.S.Timegap) / (S.L.bagaznik2_speed)
{end}

{trigger:bagaznik2_off}
	0 (S.L.bagaznik2_dragged)
{end}

{trigger:sumka1}
	(L.L.bagaznik2_pos) 0.05 >
	{if}
		(L.L.sumka1_visible) ! (S.L.sumka1_visible)
	{endif}
{end}


{trigger:bagaznik3_drag}

	1 (S.L.bagaznik3_dragged)
	(L.L.bagaznik3_pos) (S.L.bagaznik3_lastpos)

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

	(L.L.bagaznik3_pos) (L.L.bagaznik3_lastpos) - (L.S.Timegap) / (S.L.bagaznik3_speed)
{end}

{trigger:bagaznik3_off}
	0 (S.L.bagaznik3_dragged)
{end}

{trigger:sumka2}
	(L.L.bagaznik3_pos) 0.05 >
	{if}
		(L.L.sumka2_visible) ! (S.L.sumka2_visible)
	{endif}
{end}

{trigger:bagaznik4_drag}

	1 (S.L.bagaznik4_dragged)
	(L.L.bagaznik4_pos) (S.L.bagaznik4_lastpos)

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

	(L.L.bagaznik4_pos) (L.L.bagaznik4_lastpos) - (L.S.Timegap) / (S.L.bagaznik4_speed)
{end}

{trigger:bagaznik4_off}
	0 (S.L.bagaznik4_dragged)
{end}

{trigger:sumka3}
	(L.L.bagaznik4_pos) 0.05 >
	{if}
		(L.L.sumka3_visible) ! (S.L.sumka3_visible)
	{endif}
{end}

{trigger:bagaznik5_drag}

	1 (S.L.bagaznik5_dragged)
	(L.L.bagaznik5_pos) (S.L.bagaznik5_lastpos)

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

	(L.L.bagaznik5_pos) (L.L.bagaznik5_lastpos) - (L.S.Timegap) / (S.L.bagaznik5_speed)
{end}

{trigger:bagaznik5_off}
	0 (S.L.bagaznik5_dragged)
{end}

{trigger:sumka4}
	(L.L.bagaznik5_pos) 0.05 >
	{if}
		(L.L.sumka4_visible) ! (S.L.sumka4_visible)
	{endif}
{end}


{trigger:bagaznik6_drag}

	1 (S.L.bagaznik6_dragged)
	(L.L.bagaznik6_pos) (S.L.bagaznik6_lastpos)

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

	(L.L.bagaznik6_pos) (L.L.bagaznik6_lastpos) - (L.S.Timegap) / (S.L.bagaznik6_speed)
{end}

{trigger:bagaznik6_off}
	0 (S.L.bagaznik6_dragged)
{end}

{trigger:sumka5}
	(L.L.bagaznik6_pos) 0.05 >
	{if}
		(L.L.sumka5_visible) ! (S.L.sumka5_visible)
	{endif}
{end}

{trigger:bagaznik7_drag}

	1 (S.L.bagaznik7_dragged)
	(L.L.bagaznik7_pos) (S.L.bagaznik7_lastpos)

	(L.S.mouse_x) -200 / (L.L.bagaznik7_pos) + (S.L.bagaznik7_pos) s0
	l0 0 <
	{if}
		0 (S.L.bagaznik7_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.bagaznik7_pos)
	{endif}
	
	(L.L.bagaznik7_pos) (L.L.bagaznik7_lastpos) - (L.S.Timegap) / (S.L.bagaznik7_speed)
{end}

{trigger:bagaznik7_off}
	0 (S.L.bagaznik7_dragged)
{end}

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

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

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

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

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

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

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

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

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

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

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

{trigger:cp_schalter_ASR_off_toggle}
	(L.L.cp_ASR_off) ! (S.L.cp_ASR_off) 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_luk1}
	(L.L.cp_luk1) 1 + (S.L.cp_luk1) 3 >
	{if}
		0 (S.L.cp_luk1)
	{endif}
	(L.L.cp_luk1) s0
	(M.L.luki_pos_rot)
	l1 (S.L.cp_luk1_pos)
	l2 (S.L.cp_luk1_rot)
{end}

{trigger:cp_luk2}
	(L.L.cp_luk2) 1 + (S.L.cp_luk2) 3 >
	{if}
		0 (S.L.cp_luk2)
	{endif}
	(L.L.cp_luk2) s0
	(M.L.luki_pos_rot)
	l1 (S.L.cp_luk2_pos)
	l2 (S.L.cp_luk2_rot)
{end}

{trigger:cp_luk3}
	(L.L.cp_luk3) 1 + (S.L.cp_luk3) 3 >
	{if}
		0 (S.L.cp_luk3)
	{endif}
	(L.L.cp_luk3) s0
	(M.L.luki_pos_rot)
	l1 (S.L.cp_luk3_pos)
	l2 (S.L.cp_luk3_rot)
{end}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

{trigger:cp_rollo_drag}

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

	0 (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) 0.24 >=
	{if}
		(L.L.rollo_1) 0 =
		{if}
			1 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.5 >=
	{if}
		(L.L.rollo_2) 0 =
		{if}
			1 (S.L.rollo_2)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.73 >=
	{if}
		(L.L.rollo_3) 0 =
		{if}
			1 (S.L.rollo_3)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.9 >=
	{if}
		(L.L.rollo_4) 0 =
		{if}
			1 (S.L.rollo_4)
		{endif}
	{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}

{trigger:cp_rollo2_drag}

	(L.L.cp_rollo2_pos) (S.L.cp_rollo2_lastpos)

	0 (S.L.cp_rollo2_dragged)
	0 (S.L.cp_rollo2_speed)
	(L.S.mouse_y) 500 / (L.L.cp_rollo2_pos) + (S.L.cp_rollo2_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo2_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo2_pos)
	{endif}
	
	(L.L.cp_rollo2_pos) 0.24 >=
	{if}
		(L.L.rollo_1) 0 =
		{if}
			1 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.5 >=
	{if}
		(L.L.rollo_2) 0 =
		{if}
			1 (S.L.rollo_2)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.73 >=
	{if}
		(L.L.rollo_3) 0 =
		{if}
			1 (S.L.rollo_3)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.9 >=
	{if}
		(L.L.rollo_4) 0 =
		{if}
			1 (S.L.rollo_4)
		{endif}
	{endif}	

	(L.L.cp_rollo2_pos) (L.L.cp_rollo2_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo2_speed)
{end}

{trigger:cp_rollo2_off}
	0 (S.L.cp_rollo2_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo2_retract}
	(L.L.cp_rollo2_bommel) 0 = (L.L.cp_rollo2_pos) &&
	{if}
		(T.L.ev_rollo_retract)
	{endif}
	1 (S.L.cp_rollo2_bommel) (S.L.cp_rollo2_retract)

{end}

{trigger:cp_rollo2_retract_off}
	0 (S.L.cp_rollo2_bommel) (S.L.cp_rollo2_retract) (S.L.cp_rollo2_speed)
{end}

{trigger:cp_fahrerfenster_opn_drag}

	(L.L.cp_fahrerfenster_pos) (S.L.cp_fahrerfenster_lastpos)

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

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


	(L.L.cp_fahrerfenster_pos) (L.L.cp_fahrerfenster_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}

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

{trigger:cp_fortochka_pass_anim_5_opn_drag}

	(L.L.cp_fortochka_pass_anim_5_pos) (S.L.cp_fortochka_pass_anim_5_lastpos)

	(L.S.mouse_x) -500 / (L.L.cp_fortochka_pass_anim_5_pos) + (S.L.cp_fortochka_pass_anim_5_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_fortochka_pass_anim_5_pos)
		(L.L.cp_fortochka_pass_anim_5_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_cls_1)
		{endif}
		1 (S.L.cp_fortochka_pass_anim_5_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_fortochka_pass_anim_5_pos)
		(L.L.cp_fortochka_pass_anim_5_endanschlag) !
		{if}
			(T.L.ev_fahrerfenster_opn_1)
		{endif}
		1 (S.L.cp_fortochka_pass_anim_5_endanschlag)
	{endif}

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


	(L.L.cp_fortochka_pass_anim_5_pos) (L.L.cp_fortochka_pass_anim_5_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


{trigger:cp_fortochka_pass_anim_5_opn_off}
	0 (S.L.cp_fortochka_pass_anim_5_speed)
{end}

{trigger:cp_rul_kolonka_opn_drag}

	(L.L.cp_rul_kolonka_pos) (S.L.cp_rul_kolonka_lastpos)

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

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


	(L.L.cp_rul_kolonka_pos) (L.L.cp_rul_kolonka_lastpos) - abs (L.S.Timegap) / (S.L.cp_rul_kolonka_speed)
{end}


{trigger:cp_rul_kolonka_opn_off}
	0 (S.L.cp_rul_kolonka_speed)
{end}

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

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

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

{trigger:cp_schluessel_mov_drag}

'	Fallunterscheidung: Schlüssel in x- oder y-Richtung?
	
	(L.S.mouse_y) abs (L.S.mouse_x) abs >=
	{if}

'		Zunächst Translation (Einstecken)

		(L.S.mouse_y) 10 / (L.L.cp_schluessel_trans) + 0 max 1 min (S.L.cp_schluessel_trans) s0
		
'		Stufen:
'		0: Schlüssel abgezogen
'		1: Schlüssel eingesteckt

		l0 0.5 <
		{if}
			0 (S.L.cp_schluessel_trans_mode) (S.L.elec_busbar_main_sw)
		{else} 
			1 (S.L.cp_schluessel_trans_mode)
			1 (S.L.bremse_ABS_selftest)

'			Wenn beim Einstecken bereits der Stromkreis geschlossen werden soll, ohne Trennschalter:

			(C.L.automatic_battery_switch)
			{if}
				1 (S.L.elec_busbar_main_sw)
			{endif}		
		{endif}
	{endif}
{end}

{trigger:cp_schluessel_rot_drag}

'		Sonst Rotation (Lichtschalter)

		(L.S.mouse_x) -20 / (L.L.cp_schluessel_rot) + 0 max 1 min (S.L.cp_schluessel_rot) s1

'		Stufen:
'		0: Licht aus
'		1: Standlicht
'		2: Abblendlicht

		l1 0.2 <
		{if}
			0 (S.L.cp_schluessel_rot_mode) 
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_schluessel_rot_mode) 
			{else}
				2 (S.L.cp_schluessel_rot_mode)
			{endif}
		{endif}
	{endif}
{end}
{trigger:cp_schluessel_mov_off}

'	Einrasten auf den festen Positionen:
	(L.L.cp_schluessel_trans_mode) (S.L.cp_schluessel_trans)
	(L.L.cp_schluessel_rot_mode) 2 / (S.L.cp_schluessel_rot)

{end}


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


{trigger:kw_batterietrennschalter}
	1 (S.L.cp_taster_batterietrennschalter)

	(L.L.cp_schluessel_trans)
	{if}
		1 (S.L.elec_busbar_main_sw)
	{endif}

{end}

{trigger:kw_batterietrennschalter_off}
	0 (S.L.cp_taster_batterietrennschalter)
{end}



{trigger:cp_batterietrennschalter_toggle}
	(L.L.elec_busbar_main_sw) ! (S.L.elec_busbar_main_sw) 
			1 (S.L.cp_taster_batterietrennschalter)		
			(T.L.ev_kippschalter_aus)		
{end}
			
{trigger:cp_batterietrennschalter_toggle_off}	
	0 (S.L.cp_taster_batterietrennschalter)		
{end}			

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


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

{trigger:cp_klappfenster_OL2}
    (L.L.cp_klappfenster_UR2) 0 =
	{if}
	(L.L.cp_klappfenster_OL2) ! (S.L.cp_klappfenster_OL2) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL3}
    (L.L.cp_klappfenster_UR3) 0 =
	{if}
	(L.L.cp_klappfenster_OL3) ! (S.L.cp_klappfenster_OL3) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_OL4}
    (L.L.cp_klappfenster_UR4) 0 =
	{if}
	(L.L.cp_klappfenster_OL4) ! (S.L.cp_klappfenster_OL4) s1
	{endif}	
	(M.L.klappfenstersound)
{end}

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

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

{trigger:cp_klappfenster_UR3}
    (L.L.cp_klappfenster_OL3) 0 =
	{if}
	(L.L.cp_klappfenster_UR3) ! (S.L.cp_klappfenster_UR3) s1
	{endif}		
	(M.L.klappfenstersound)
{end}

{trigger:cp_klappfenster_UR4}
    (L.L.cp_klappfenster_OL4) 0 =
	{if}
	(L.L.cp_klappfenster_UR4) ! (S.L.cp_klappfenster_UR4) s1
	{endif}		
	(M.L.klappfenstersound)
{end}

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

{trigger:cp_odometr_sbros}

		(L.L.kmcounter_km) (S.L.odometer_kmlast)
		(L.L.kmcounter_m) (S.L.odometer_mlast)
		0 (S.L.odometr_sutki)
		0 (S.L.odometr_sutki_m)
	{endif}

	1 (S.L.cp_odometr_sbros)
{end}

{trigger:cp_odometr_sbros_off}
	0 (S.L.cp_odometr_sbros)
{end}

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

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

{trigger:cp_planshet_on}
        (L.L.cp_planshet_on) ! (S.L.cp_planshet_on) s1
	(T.L.ev_vibro)
{end}

{trigger:cp_planshet_timetable}
        (L.L.cp_planshet_timetable) ! (S.L.cp_planshet_timetable) s1
	(T.L.ev_vibro)
{end}

'Şçàíóë ïåğåìåííûå êëàïïôåíñòåğîâ,èáî òå ïğè ïåğåèìåíîâàíèè âû¸áûâàşòñÿ,ïèäîğû,ñóêà.Ïîõóé,áóäåì òàê õóÿğèòü

'âèäèìîñòü èáèñà
{trigger:cp_klappfenster_OR1}
	(L.L.cp_klappfenster_OR1) ! (S.L.cp_klappfenster_OR1) s1
	(T.L.ev_vibro)
{end}

'âèäèìîñòü ğàññïèñàíèÿ 
{trigger:cp_klappfenster_OR2}
	(L.L.cp_klappfenster_OR2) ! (S.L.cp_klappfenster_OR2) s1
	(T.L.ev_vibro)
{end}

'êàìåğà,áëåàòü 
{trigger:cp_klappfenster_OR3}
	(L.L.cp_klappfenster_OR3) ! (S.L.cp_klappfenster_OR3) s1
	(T.L.ev_vibro)
{end}

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

{trigger:cp_Fahrertuer_drag}

	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)
{end}


{trigger:cp_Fahrertuer_off}
	0 (S.L.cp_fahrertuer_dragged)
{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:cp_gitara_selector_drag}
		
		
		
		(L.S.mouse_y) -20 / (L.L.cp_gitara_rot1) + 0 max 1 min (S.L.cp_gitara_rot1) s1
		(L.S.mouse_y) 80 / (L.L.cp_gitara_rot2) + 0 max 1 min (S.L.cp_gitara_rot2) s2

		l1 1 =
		{if}
			1 (S.L.cp_gitara_rot_mode1)
			0 (S.L.cp_gitara_rot_mode2)
		{else}

			l2 0.2 <
			{if}
				0 (S.L.cp_gitara_rot_mode1) (S.L.cp_gitara_rot_mode2)
			{else}
				l2 0.5 <
				{if}
					0 (S.L.cp_gitara_rot_mode1)
					3 (S.L.cp_gitara_rot_mode2)
				{else}				
					l2 0.8 <
					{if}
						0 (S.L.cp_gitara_rot_mode1)
						6 (S.L.cp_gitara_rot_mode2)
					{else}
						l2 1 =
						{if}
							0 (S.L.cp_gitara_rot_mode1)
							8 (S.L.cp_gitara_rot_mode2)
						{endif}
					{endif}
				{endif}
			{endif}
		{endif}
		
'	(L.L.cp_gitara_rot_last) (L.L.cp_gitara_rot_mode2) =
'	{if}
'		
'	{else}
'		(T.L.ev_gitara)
'		(L.L.cp_gitara_rot_mode2) (S.L.cp_gitara_rot_last)
'	{endif}
'	(M.L.sound_frame)	
{end}


{trigger:cp_gitara_selector_off}
	0 (S.L.cp_gitara_rot_mode1) (S.L.cp_gitara_rot1)
	(L.L.cp_gitara_rot_mode2) 8 / (S.L.cp_gitara_rot2)
	
'	(T.L.ev_gitara)
{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:taster_nebelschluss}
	(L.L.cp_taster_nebelschluss_target) ! (S.L.cp_taster_nebelschluss_target)
	0 (S.L.cp_taster_nebelschluss)

	(M.L.kippschaltersound)	
{end}

{trigger:taster_nebelschluss_off}	
	(L.L.cp_taster_nebelschluss_target)
	{if}
		1 (S.L.cp_taster_nebelschluss)
	{endif}

{end}

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

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

{trigger:kn_EFU}
	(L.L.cockpit_light_EFU) ! (S.L.cockpit_light_EFU) s1
		1 (S.L.cp_EFU)
 
		(T.L.ev_kippschalter_ein)			
{end}
			
{trigger:kn_EFU_off}	
	0 (S.L.cp_EFU)		
{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_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_kluch_mov_drag}	
	
		(L.S.mouse_x) -30 / (L.L.cp_kluch_rot) + 0 max 1 min (S.L.cp_kluch_rot) s1

		l1 0.1 <
		{if}
			0 (S.L.cp_kluch_rot_mode)		
		{else} 
			l1 0.6 <
			{if}
				2 (S.L.cp_kluch_rot_mode)		
			{else}
			l1 0.8 <
			{if}
				3 (S.L.cp_kluch_rot_mode)				

				
				(L.L.elec_busbar_main)
				{if}
					1 (S.L.engine_injection_on)
				{endif}			
				4 (S.L.cp_kluch_rot_mode)
		{endif}
			l1 1 =
			{if}			
	    (L.L.engine_on) !
		(L.L.antrieb_getr_gangwahl) 1 = &&		
		(L.L.elec_busbar_main) && 
	      {if}
		    1 (S.L.engine_on) (S.L.engine_injection_on)
		    (S.L.engine_starter_antirepeat)
		    (C.L.engine_governed_idle_RPM) (S.L.engine_n)
	        {endif}	
		{endif}				
				4 (S.L.cp_kluch_rot_mode)
			{endif}
		{endif}
{end}

{trigger:cp_kluch_mov_off}
	(L.L.cp_kluch_rot_mode) 5 / (S.L.cp_kluch_rot)
{end}		
	
{trigger:kn_lamp_R}
	1 (S.L.cockpit_lamp_R)
	(T.L.ev_kippschalter_aus)	
{end}

{trigger:kn_lamp_R_off}
	0 (S.L.cockpit_lamp_R)
{end}

{trigger:kn_lamp_L}
	1 (S.L.cockpit_lamp_L)
	(T.L.ev_kippschalter_aus)	
{end}

{trigger:kn_lamp_L_off}
	0 (S.L.cockpit_lamp_L)
{end}

{trigger:kn_avari_ostanov_dvigatel} 
	(L.L.kn_avari_ostanov) !
	{if}
		1 (S.L.kn_avari_ostanov) 
		0 (S.L.engine_injection_on)
		0 (S.L.elec_busbar_main_sw)		
	{endif}
	
	(M.L.kippschaltersound)
{end}

{trigger:kn_avari_ostanov_dvigatel_off}
		0 (S.L.kn_avari_ostanov) 		
{end}
		
{trigger:kn_test_ABS} 	
		1 (S.L.test_ABS)

	(M.L.kippschaltersound)
{end}

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


{trigger:kn_test_ABS_off}
		0 (S.L.test_ABS) 
		(T.L.ev_kippschalter_aus)		
{end}

{trigger:cp_seatbutton1}
	1 (S.L.seat_button1)
	(L.L.seat_padshift) ! (S.L.seat_padshift)
	(T.L.luftsitz_rast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton1_off}
	0 (S.L.seat_button1)
{end}

{trigger:cp_seatbutton2}
	(L.L.seat_button2) ! (S.L.seat_button2)
	(T.L.luftsitz_tast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton3U}
	1 (S.L.seat_button3_u)
	(L.L.seat_slant) 0.25 + 1 min (S.L.seat_slant) 
	(T.L.luftsitz_rast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton3U_off}
	0 (S.L.seat_button3_u)
{end}

{trigger:cp_seatbutton3L}
	-1 (S.L.seat_button3)
	(L.L.seat_slant) 0.25 - 0 max (S.L.seat_slant) 
	(T.L.luftsitz_rast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton3L_off}
	0 (S.L.seat_button3) 
{end}

{trigger:cp_seatbutton4U}
	1 (S.L.seat_button4_u)
	(L.L.seat_height_setting) s0 0.9 <=
		{if}
			l0 0.2 + (S.L.seat_height_setting)			
		{endif}		
	(T.L.luftsitz_tast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton4U_off}
	0 (S.L.seat_button4_u) 
{end}

{trigger:cp_seatbutton4L}
	-1 (S.L.seat_button4) 
	(L.L.seat_height_setting) s0 0.2 >=
		{if}
			l0 0.2 - (S.L.seat_height_setting)
		{endif}
	(T.L.luftsitz_tast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton4L_off}
	0 (S.L.seat_button4)
{end}

{trigger:cp_seatbutton5U}
	1 (S.L.seat_button5_U)
	(L.L.seat_back) 2 - -8 max (S.L.seat_back) 
	(T.L.luftsitz_rast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton5U_off}
	0 (S.L.seat_button5_u) 
{end}

{trigger:cp_seatbutton5L}
	-1 (S.L.seat_button5)
	(L.L.seat_back) 2 + 4 min (S.L.seat_back) 
	(T.L.luftsitz_rast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:cp_seatbutton5L_off}
	0 (S.L.seat_button5)
{end}

{trigger:cp_seatbutton6}	
	(L.L.seat_springfactor) ! (S.L.seat_springfactor)
	(L.L.seat_springfactor) (S.L.seat_button6)
	(T.L.luftsitz_tast)

		(T.L.ev_kippschalter_ein)

{end}

{trigger:kn_diagnostik_dvigat} 	
		1 (S.L.diagnostik_dvigat)

	(M.L.kippschaltersound)
{end}

{trigger:kn_diagnostik_dvigat_off}
		0 (S.L.diagnostik_dvigat) 
		(T.L.ev_kippschalter_aus)		
{end}
		
{trigger:cp_podsvet_prib_drag}		
		(L.S.mouse_y) -50 / (L.L.cp_podsvet_prib_rot) + 0 max 1 min (S.L.cp_podsvet_prib_rot) s0		
{end}


{trigger:cp_vod1_mov_drag}		
		(L.S.mouse_x) -30 / (L.L.cp_vod1_rot) + 0 max 1 min (S.L.cp_vod1_rot) s1
{end}	
	
{trigger:cp_vod2_mov_drag}		
		(L.S.mouse_x) -30 / (L.L.cp_vod2_rot) + 0 max 1 min (S.L.cp_vod2_rot) s1
{end}


{trigger:gabarity_mov_drag}
			
      (L.S.mouse_y) 30 / (L.L.gabarity_rot) + 0 max 1 min (S.L.gabarity_rot) s0
	  
		l0 0.1 <
		{if}
			0 (S.L.gabarity_rot_mode) 
		{else} 
			l0 0.8 <
			{if}					
				1 (S.L.gabarity_rot_mode) 
			{else}
			    2 (S.L.gabarity_rot_mode)
			{endif}
		{endif}
	{endif}
	
{end}	

{trigger:gabarity_mov_off}
	(L.L.gabarity_rot_mode) 2 / (S.L.gabarity_rot)
{end}

{trigger:dalnyi_mov_drag}
		(L.S.mouse_y) -20 / (L.L.dalnyi_rot) + 0 max 1 min (S.L.dalnyi_rot) s0	

		l0 0 =
		{if}			
			0 (S.L.dalnyi_rot_mode)				
		{else}
			1 (S.L.dalnyi_rot_mode)				
		{else}				
			l0 0.7 <
			{if}
				1 (S.L.dalnyi_rot_mode)					
			{else}
				2 (S.L.dalnyi_rot_mode)
 	      {endif}			  
	{endif}
{end}

{trigger:dalnyi_mov_off}
	(L.L.dalnyi_rot_mode) 2 / (S.L.dalnyi_rot)
{end}

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


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


{trigger:otopitel_front1_mov_drag}
      (L.S.mouse_y) 30 / (L.L.otopitel_front_rot1) + 0 max 1 min (S.L.otopitel_front_rot1) s0
	  
		l0 0.1 <
		{if}
			0 (S.L.otopitel_front_rot_mode1) 
		{else} 
			l0 0.8 <
			{if}					
				1 (S.L.otopitel_front_rot_mode1) 
			{else}
			    2 (S.L.otopitel_front_rot_mode1)
			{endif}
		{endif}
	{endif}
{end}


{trigger:otopitel_front1_mov_off}
	(L.L.otopitel_front_rot_mode1) 2 / (S.L.otopitel_front_rot1)
{end}


{trigger:otopitel_front_mov_drag}	
      (L.S.mouse_y) 30 / (L.L.otopitel_front_rot) + 0 max 1 min (S.L.otopitel_front_rot) s0
	  
		l0 0.1 <
		{if}
			0 (S.L.otopitel_front_rot_mode) 
		{else} 
			l0 0.8 <
			{if}					
				1 (S.L.otopitel_front_rot_mode) 
			{else}
			    2 (S.L.otopitel_front_rot_mode)
			{endif}
		{endif}
	{endif}		
{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)
{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:otopitel_front_mov_off}
	(L.L.otopitel_front_rot_mode) 2 / (S.L.otopitel_front_rot)
{end}
	

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

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

{trigger:BK_08_toggle}
	1 (S.L.bt_bk08)
	
	(L.L.bk08_mode) !
	{if}
		1 (S.L.bk08_mode)
	{else}
		(L.L.bk08_mode) 1 =
		{if}
			2 (S.L.bk08_mode)
		{else}
			(L.L.bk08_mode) 2 =
			{if}
				3 (S.L.bk08_mode)
			{else}
				(L.L.bk08_mode) 3 =
				{if}
					0 (S.L.bk08_mode)
				{endif}
			{endif}
		{endif}
	{endif}

	(L.L.elec_busbar_main)
	{if}
		(T.L.ev_IBIS_piep)
	{endif}
{end}

{trigger:BK_08_toggle_off}
	0 (S.L.bt_bk08)
{end}

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

{macro:cockpit_init}
	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) (S.L.seat_springfactor)  (S.L.seat_button6)
	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)

	0.5 (S.L.dalnyi_rot)	
	
{end}

'----------------------
'	Frame
'----------------------
{macro:cockpit_frame}
'Ü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.cp_sound_frame)
	(M.L.light_frame)	
	(M.L.tacho_frame)
	(M.L.uhr_frame)
	(M.L.fahrersitz)
	(M.L.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.blinkerhebel_frame)
	(M.L.wischerhebel_frame)
	(M.L.wischer_drehschalter_frame)
	(M.L.oeldruck_frame)
	(M.L.planshet_display_frame)
	(M.L.tankuhr_frame)
	(M.L.cockpitlights_frame)
	(M.L.klimator_frame)
        (M.L.bagazniki_frame)
	(M.L.schluessel_frame)
	(M.L.odometer_frame)
        (M.L.windows_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.date_frame)
        (M.L.engine_val_frame)
	(M.L.bk08_frame)
	(M.L.Odometr_display)

{end}
		
{macro:cp_sound_frame}

	(L.L.cp_kluch_rot_lastmode) (L.L.cp_kluch_rot_mode) = !
	{if}
		(T.L.ev_key_insert)
	{endif}
	(L.L.cp_kluch_rot_mode) (S.L.cp_kluch_rot_lastmode)
	
	
	(L.L.gabarity_rot_lastmode) (L.L.gabarity_rot_mode) = !
	{if}
		(T.L.ev_kippschalter_aus)
	{endif}
	(L.L.gabarity_rot_mode) (S.L.gabarity_rot_lastmode)	

	
	(L.L.dalnyi_rot_lastmode) (L.L.dalnyi_rot_mode) = !
	{if}
		(T.L.ev_lights_blinker_swon)
	{endif}
	(L.L.dalnyi_rot_mode) (S.L.dalnyi_rot_lastmode) 		

	
	(L.L.otopitel_front_rot_lastmode) (L.L.otopitel_front_rot_mode) = !
	{if}
		(T.L.ev_kippschalter_aus)
	{endif}
	(L.L.otopitel_front_rot_mode) (S.L.otopitel_front_rot_lastmode)	

	
	(L.L.otopitel_front_rot_lastmode1) (L.L.otopitel_front_rot_mode1) = !
	{if}
		(T.L.ev_kippschalter_aus)
	{endif}
	(L.L.otopitel_front_rot_mode1) (S.L.otopitel_front_rot_lastmode1)	

{end}


{macro:light_frame}
	(L.L.gabarity_rot) 0.2 >
	(L.L.elec_busbar_main) &&	
	{if}
	(L.L.cp_podsvet_prib_rot) (F.L.podsvet_prib_light) (S.L.podsvet_prib_light)	
	{else}
	0 (S.L.podsvet_prib_light)
	{endif}	
{end}


{macro:tacho_frame}
	(L.L.Velocity) (F.L.cockpit_tacholinie) (S.L.cockpit_tachowinkel)	
	
{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) 2200 118 / / (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:blinkerhebel_frame}
	(L.L.lights_sw_blinker) 1 =
	{if}	
		-1 (S.L.cockpit_blinkerhebel)
	{else}
		(L.L.lights_sw_blinker) 2 =
		{if}
			1 (S.L.cockpit_blinkerhebel)
		{else}
			0 (S.L.cockpit_blinkerhebel)
		{endif}
	{endif}

'	Hebel-Animation für Fernlicht
	(L.L.lights_sw_fern)
	{if}	
		(L.L.cockpit_fernlichthebel) -1 = !
		{if}
			1 (S.L.cockpit_fernlichthebel)
		{endif}

		(L.L.cp_schluessel_rot) 0.8 >
		{if}
			-1 (S.L.cockpit_fernlichthebel)
		{endif}
	{else}
		0 (S.L.cockpit_fernlichthebel)
	{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}

'	Störungsmelder
	(L.L.engine_n) 100 <
	(L.L.bremse_p_tank01) 520000 < ||
	(L.L.bremse_p_tank02) 520000 < ||
	(L.L.bremse_p_tank03) 520000 < ||
	(L.L.bremse_p_tank04) 520000 < ||	
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_masterfailure)

	(L.L.bremse_p_tank01) 520000 < 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
	(S.L.cockpit_light_tank01)	
		
	(L.L.bremse_p_tank02) 520000 < 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
	(S.L.cockpit_light_tank02)	

	(L.L.bremse_p_tank03) 520000 < 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
	(S.L.cockpit_light_tank03)	
	
	(L.L.bremse_p_tank04) 520000 <
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) && 	
 	(S.L.cockpit_light_tank04)	

	(L.L.cp_ASOTP)
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_ASOTP)	
	
	(L.L.cockpit_lamp_L) 
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_filtr)
	
	(L.L.cockpit_lamp_R)
	(L.L.cockpit_EFU) || 
	(L.L.elec_busbar_main) &&	
	(S.L.light_EFU)	

	(L.L.cockpit_light_EFU) 1 =
	   {if}	
			(L.L.cockpit_light_EFU_timer) 4 <
		{if}
			0 (S.L.cockpit_EFU)			
			(L.L.cockpit_light_EFU_timer) (L.S.Timegap) + (S.L.cockpit_light_EFU_timer) 
		{else}	
			1 (S.L.cockpit_EFU) 
		{endif}
	{else}
			0 (S.L.cockpit_light_EFU_timer) (S.L.cockpit_EFU)
	{endif}		
	
	(L.L.cp_MKD)	
	(L.L.cockpit_lamp_R) ||
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_MKD)	

	(L.L.lights_blinker_l) 
	(L.L.lights_blinker_r) ||
	(L.L.cockpit_lamp_R) ||
	(L.L.elec_busbar_main) &&	
	(S.L.lights_blinkgeber)	
	
	(L.L.diagnostik_dvigat)	
	(L.L.elec_busbar_main) &&	
	(S.L.lights_diagnostik)	

	(L.L.test_ABS) 
	(L.L.cockpit_ABS) ||
	(L.L.bremse_ABS_eingriff) ||	
	(L.L.elec_busbar_main) &&
    (S.L.cockpit_light_ABS)	

	(L.L.elec_busbar_main) 1 =
	   {if}	
			(L.L.cockpit_light_ABS_timer) 2 < 
		{if}
			1 (S.L.cockpit_ABS)			
			(L.L.cockpit_light_ABS_timer) (L.S.Timegap) + (S.L.cockpit_light_ABS_timer) 
		{else}	
			0 (S.L.cockpit_ABS) 
		{endif}
	{else}
			0 (S.L.cockpit_light_ABS_timer) 
	{endif}				

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

'	Türkontrolle 
	(L.L.door_1) 0 = 
	(L.L.door_2) 0 = && !
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tuerkontrolle)

'	Kontrolle Feststellbremse
	(L.L.bremse_p_Brzyl_FBA) 650000 <
	(L.L.cockpit_lamp_L) ||
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_feststellbremse)

'	Geschwindigkeitswarnung
	(L.L.Velocity) 54 > (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_speedwarning)
	
'	Kinderwagenwunsch
	(L.L.door_kinderwagenwunsch) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_kinderwagenwunsch)

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

	(L.L.cp_kn_obduv) 1 = (L.L.elec_busbar_main) &&
	(S.L.obduv)

	(L.L.cp_fahrerlicht_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_fahrerlicht)

	(L.L.cp_licht_untenrechts_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_licht_untenrechts)

	(L.L.cp_licht_unterdeck_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_licht_unterdeck)

	(L.L.cp_licht_oberdeck_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_licht_oberdeck)

	(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_planshet_on) (L.L.cp_planshet_on) (L.L.cp_planshet_visible) &&
	(S.L.cp_planshet_on_light)

	(L.L.cp_planshet_timetable) (L.L.cp_planshet_visible) &&
	(S.L.cp_planshet_timetable_light)

	(L.L.cp_klappfenster_OR1) (L.L.cp_planshet_on_light) &&
	(S.L.cp_klappfenster_OR1_visible)

	(L.L.cp_klappfenster_OR2) (L.L.cp_planshet_on_light) &&
	(S.L.cp_klappfenster_OR2_visible)

	(L.L.cp_klappfenster_OR3) (L.L.cp_planshet_on_light) &&
	(S.L.cp_klappfenster_OR3_visible)

	(L.L.cp_heizluefter_sw) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_heizluefter)
	
	(L.L.cp_kn_zerkalo_podogrev) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_spiegelheizung)

	(L.L.cp_kn_tumanki) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_tumanki)

	(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_ASR_off) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_ASR_off)

	(L.L.cp_taster_nebelschluss) 
	(L.L.lights_stand) &&	
	(L.L.elec_busbar_main) &&
	(S.L.lights_nebelschluss)	

	(L.L.antrieb_getr_gangwahl) 2 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang1)

	(L.L.antrieb_getr_gangwahl) 3 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang2)
	
	(L.L.antrieb_getr_gangwahl) 4 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang3)

	(L.L.antrieb_getr_gangwahl) 5 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gang4)
	
	(L.L.antrieb_getr_gangwahl) 1 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gangN)

	(L.L.antrieb_getr_gangwahl) 0 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gangR)	
	
	(L.L.cockpit_gang1)
	(L.L.cockpit_gang2) ||	
	(L.L.cockpit_gang3) ||
	(L.L.cockpit_gang4) ||	
	(L.L.cockpit_gangR) ||	
	(L.L.elec_busbar_main) &&
	  {if}	
	  0 (S.L.cockpit_light_gangN)	
	   {else}	
	  1 (S.L.cockpit_light_gangN)	
	{endif}	

	(L.L.antrieb_getr_gangwahl) 0 = (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_gangR)	
	
	(L.L.marshrut_podsvetka) 	
	(L.S.Time) 25200 < ||
	(L.S.Time) 72000 > ||
	(L.L.elec_busbar_main) &&	
	  {if}	
	   1 (S.L.light_marshrut)	
	   {else}	
	   0 (S.L.light_marshrut)
	{endif}	

	(L.L.bremse_feststell) 
	(L.L.cockpit_lamp_L) ||	
	(L.L.elec_busbar_main) &&
	{if}
		(L.S.Timegap) (L.L.lights_blinker_runtime_feststellbremse) + (S.L.lights_blinker_runtime_feststellbremse)

		(L.L.lights_blinker_runtime_feststellbremse) (L.L.lights_blinkgeber_timegap_feststellbremse) >  
		{if}
			(L.L.lights_blinkgeber_feststellbremse) ! (S.L.lights_blinkgeber_feststellbremse)
			{if}			
				(C.L.lights_blinkertime_on)
			{else}			
				(C.L.lights_blinkertime_off)
			{endif}
			(S.L.lights_blinkgeber_timegap_feststellbremse)
			0 (S.L.lights_blinker_runtime_feststellbremse)
		{endif}
	{else}
		0 (S.L.lights_blinkgeber_feststellbremse)  (S.L.lights_blinker_runtime_feststellbremse) 
	{endif}	
	
'	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)

	(L.L.cp_dummy_sw05) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func05)

	(L.L.cp_dummy_sw06) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func06)

	(L.L.cp_dummy_sw07) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func07)

	(L.L.cp_dummy_sw08) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func08)

	(L.L.cp_dummy_sw09) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func09)

	(L.L.cp_dummy_sw10) (L.L.elec_busbar_main) &&
	(S.L.cp_dummy_func10)

{end}

{macro:oeldruck_frame}
	(L.L.engine_n) (F.L.cockpit_oeldruck) (F.L.cockpit_oelscale) s0

	(L.L.elec_busbar_main) 1 =	
	{if}
		(L.L.cockpit_oeldruck) 0.8 <
		{if}
			1 (S.L.light_maslo)
		{else}
			0 (S.L.light_maslo)
		{endif}
	{else}
		0 s0
		0 (S.L.light_maslo)
	{endif}	

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

{macro:tankuhr_frame}	
		
	(L.L.engine_tank_content) s0
	
	(L.L.elec_busbar_main) 1 =	
	{if}
		(L.L.engine_tank_content) 30 <
		{if}
			1 (S.L.light_toplivo)
		{else}
			0 (S.L.light_toplivo)
		{endif}
	{else}
		0 s0
		0 (S.L.light_toplivo)
	{endif}	
	
	(L.L.cockpit_tankuhr) s1
	5 s2
	5 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) 1 =	
	{if}
		(L.L.engine_temperature) 98 >
		{if}
			1 (S.L.light_voda)
		{else}
			0 (S.L.light_voda)
		{endif}
		(L.L.engine_temperature) (F.L.cockpit_engine_temperature) s0
	{else}
		0 s0
		0 (S.L.light_voda)
	{endif}	

	(L.L.cockpit_motortemperaturwinkel) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_motortemperaturwinkel)
{end}
	
{macro:ampermetr_frame}
	(L.L.elec_busbar_main) 0 =
	{if}
		(L.L.elec_V_battery) 0.8 <
		{if}
			1 (S.L.light_battery)
		{else}
			0 (S.L.light_battery)
		{endif}
		(L.L.elec_V_battery)  s0
	{else}
		0 s0
		0 (S.L.light_battery)
	{endif}	

	(L.L.cockpit_ampermetr) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (S.L.cockpit_ampermetr)
{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:schluessel_frame}

	(L.L.cp_schluessel_trans_lastmode) (L.L.cp_schluessel_trans_mode) = !
	{if}
		(T.L.ev_schluessel_steck)
	{endif}
	(L.L.cp_schluessel_trans_mode) (S.L.cp_schluessel_trans_lastmode)


	(L.L.cp_schluessel_rot_lastmode) (L.L.cp_schluessel_rot_mode) = !
	{if}
		(T.L.ev_schluessel_dreh)
	{endif}
	(L.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot_lastmode)
{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:odometer_frame}
	(L.L.kmcounter_km) (L.L.kmcounter_m) 1000 / + 10 *
	(S.L.cp_odometer_01)

	(L.L.cp_odometer_01) 10 / trunc 
	(L.L.cp_odometer_01) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_1)

	(L.L.cp_odometer_1) 10 / trunc 
	(L.L.cp_odometer_1) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_10)

	(L.L.cp_odometer_10) 10 / trunc 
	(L.L.cp_odometer_10) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_100)

	(L.L.cp_odometer_100) 10 / trunc 
	(L.L.cp_odometer_100) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_1000)

	(L.L.cp_odometer_1000) 10 / trunc 
	(L.L.cp_odometer_1000) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_10000)

	(L.L.cp_odometer_10000) 10 / trunc 
	(L.L.cp_odometer_10000) 10 / d trunc - (F.L.odometer_10er-uebertrag) +
	(S.L.cp_odometer_100000)


	(L.L.kmcounter_m) 100 / (S.L.cp_odometer_01)
{end}

{macro:Fan_frame}

	(M.L.speed)
	(M.L.cp_rotor)
{end}

{macro:speed}
	(L.L.cp_fan) 1 =
		{if}
			(L.L.speed) 5 <
			{if}
				(L.L.speed) (L.S.Timegap) + (S.L.speed)
			{endif}
			(L.L.speed) (F.L.speed) (S.L.spd)
		{endif}
	(L.L.cp_fan) 0 =
		{if}
			(L.L.speed) 0 >
			{if}
				(L.L.speed) (L.S.Timegap) - (S.L.speed)
			{endif}
			(L.L.speed) (F.L.speed_off) (S.L.spd)
		{endif}
	(L.L.cp_fan_spd) 1 =
			{if}
				(L.L.spd) 2 * (S.L.spd)
			{endif}
	(M.L.cp_rotor)
{end}

{macro:cp_rotor}

	(L.L.Rotor) (L.S.Timegap) (L.L.spd) * + (S.L.Rotor)
{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:fahrersitz}
		2 s0
	(L.L.bremse_p_Tank04) 650000 > (L.L.seat_button2) ! &&
		{if}	
			(L.L.seat_height) (L.L.Driver_Seat_VertTransl) (L.L.seat_springfactor) * + (L.L.seat_height_setting) 0.05 - <
				{if}
					(L.L.seat_height) 0.005 + (L.L.Driver_Seat_VertTransl) (L.L.seat_springfactor) * + s0 					
				{endif}	
				
			(L.L.seat_height) (L.L.Driver_Seat_VertTransl) - (L.L.seat_height_setting) 0.05 + >
				{if}
					(L.L.seat_height) 0.005 - (L.L.Driver_Seat_VertTransl) + s0 					
				{endif}					
		{else}		
			(L.L.seat_height) (L.S.Timegap) 30 / - 0 max s0				
		{endif}

		l0 0 >
		l0 1 < &&
			{if}
				l0 (S.L.seat_height)
			{endif}
	
	(L.L.seat_height) (L.L.seat_height_setting) - -0.15 < 0.15 > || (L.L.seat_height) 0.05 > &&
		{if}
			(L.L.seat_sound) 0.05 + 1 min (S.L.seat_sound)
		{else}
			(L.L.seat_sound) 0.3 - 0 max (S.L.seat_sound)
		{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_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)
					
		{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)
			{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}
	{endif}
	
	(L.L.cp_rollo_pos) 0.24 <=
	{if}
		(L.L.rollo_1) 1 =
		{if}
			0 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.5 <=
	{if}
		(L.L.rollo_2) 1 =
		{if}
			0 (S.L.rollo_2)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.73 <=
	{if}
		(L.L.rollo_3) 1 =
		{if}
			0 (S.L.rollo_3)
		{endif}
	{endif}
	(L.L.cp_rollo_pos) 0.9 <=
	{if}
		(L.L.rollo_4) 1 =
		{if}
			0 (S.L.rollo_4)
		{endif}
	{endif}
	
(L.L.cp_rollo2_pos) (L.L.cp_rollo2_rastpos) max (S.L.cp_rollo2_rastpos)

	(L.L.cp_rollo2_dragged) !
	{if}
		(L.L.cp_rollo2_retract)
		{if}
			(L.L.cp_rollo2_speed) (L.S.Timegap) (L.L.cp_rollo2_pos) 14 * * - (S.L.cp_rollo2_speed)
			(L.L.cp_rollo2_pos) (L.S.Timegap) (L.L.cp_rollo2_speed) * + (S.L.cp_rollo2_pos) (S.L.cp_rollo2_rastpos)
					
		{else}
			(L.L.cp_rollo2_pos) (L.L.cp_rollo2_rastpos) < 
			{if}
				(L.L.cp_rollo2_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo2_speed)
				(L.L.cp_rollo2_pos) (L.S.Timegap) (L.L.cp_rollo2_speed) * + (L.L.cp_rollo2_rastpos) min (S.L.cp_rollo2_pos)
			{else}
				0 (S.L.cp_rollo2_speed)
			{endif}
		{endif}

		(L.L.cp_rollo2_pos) 1 >
		{if}
			1 (S.L.cp_rollo2_pos) (S.L.cp_rollo2_rastpos)
		{else}
			(L.L.cp_rollo2_pos) 0 <
			{if}
			0 (S.L.cp_rollo2_pos) (S.L.cp_rollo2_retract) (S.L.cp_rollo2_rastpos)
			{endif}
		{endif}
	{endif}
	
	(L.L.cp_rollo2_pos) 0.24 <=
	{if}
		(L.L.rollo_1) 1 =
		{if}
			0 (S.L.rollo_1)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.5 <=
	{if}
		(L.L.rollo_2) 1 =
		{if}
			0 (S.L.rollo_2)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.73 <=
	{if}
		(L.L.rollo_3) 1 =
		{if}
			0 (S.L.rollo_3)
		{endif}
	{endif}
	(L.L.cp_rollo2_pos) 0.9 <=
	{if}
		(L.L.rollo_4) 1 =
		{if}
			0 (S.L.rollo_4)
		{endif}
	{endif}
	
{end}

{macro:luki_pos_rot}
	l0 0.5 <=
	{if}
		0 s1 s2
		(T.L.ev_luk1_close)
	{else}
	l0 1.5 <=
	{if}
		0.5 s1
		1 s2
		(T.L.ev_luk1_open)
	{else}
	l0 2.5 <=
	{if}
		1 s1
		0 s2
		(T.L.ev_luk1_change)
	{else}
		0.5 s1
		-1 s2
		(T.L.ev_luk1_change)
	{endif}
	{endif}
	{endif}

	l0 0.5 <=
	{if}
		0 s1 s2
		(T.L.ev_luk2_close)
	{else}
	l0 1.5 <=
	{if}
		0.5 s1
		1 s2
		(T.L.ev_luk2_open)
	{else}
	l0 2.5 <=
	{if}
		1 s1
		0 s2
		(T.L.ev_luk2_change)
	{else}
		0.5 s1
		-1 s2
		(T.L.ev_luk2_change)
	{endif}
	{endif}
	{endif}

	l0 0.5 <=
	{if}
		0 s1 s2
		(T.L.ev_luk3_close)
	{else}
	l0 1.5 <=
	{if}
		0.5 s1
		1 s2
		(T.L.ev_luk3_open)
	{else}
	l0 2.5 <=
	{if}
		1 s1
		0 s2
		(T.L.ev_luk3_change)
	{else}
		0.5 s1
		-1 s2
		(T.L.ev_luk3_change)
	{endif}
	{endif}
	{endif}
{end}

{macro:timer_frame}

		(L.S.Time) 3600 / trunc " 2" s0
		(L.S.Time) 60 / l0 60 * - s1
		(L.S.Time) 60 % s2
	{endif}

	l0 10 <
	{if}
		"0" l0 $IntToStr $+
	{else}
		l0 $IntToStr
	{endif}
	
	l1 10 <
	{if}
		":0" $+ l1 $IntToStr $+
	{else}
		":" $+ l1 $IntToStr $+
	{endif}
	
	l2 10 <
	{if}
		":0" $+ l2 $IntToStr $+
	{else}
		":" $+ l2 $IntToStr $+
	{endif}
	
	(S.$.Timer)
	{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)
  
{endif}

	(L.S.Weather_Temperature) s0 trunc " 3" $IntToStrEnh "." $+ 
	l0 abs l0 abs trunc - 10 * trunc " 1" $IntToStrEnh $+ "C" $+
	(S.$.cockpit_temperatur_out)
{end}
        {end}

{macro:planshet_display_frame}
	
(L.L.engine_reader_timer) (L.S.Timegap) 1 * + (S.L.engine_reader_timer)

(L.L.engine_reader_timer) 0.25 > 
{if}
(L.L.engine_n) (S.L.engine_reader)
0 (S.L.engine_reader_timer)
{endif}


		(L.L.engine_injection_on) 1 =
		{if}
'			"23456" $
			(L.L.engine_reader) trunc " 4" $IntToStrEnh
			(S.$.planshet_tahometr)
		{else}
			"    0" $
			(S.$.planshet_tahometr)
		{endif}
	        {else}	
"     " $
	(S.$.planshet_tahometr)
	{endif}

(L.L.Velocity) $IntToStr
(S.$.planshet_spidometr)

{endif}

	(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.$.planshet_timer)

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

	{end}	
	
{macro:Odometr_display}	
	
	(L.L.kmcounter_km) trunc " 6" $IntToStrEnh  "." $+
	(L.L.kmcounter_m) 100 / trunc " 1" $IntToStrEnh $+
        (S.$.odometr_disp)
		
		(L.L.kmcounter_km) (L.L.odometer_kmlast) - (S.L.odometr_sutki)
		(L.L.kmcounter_m) (L.L.odometer_mlast) - 100 / (S.L.odometr_sutki_m)		
		(L.L.odometr_sutki) trunc " 4"  $IntToStrEnh "." $+
		(L.L.odometr_sutki_m) trunc " 1" $IntToStrEnh $+
		(S.$.odometr_disp_sutki)
	
		(L.L.odometr_sutki) 9999 >=
		{if}
			(L.L.kmcounter_km) (S.L.odometer_kmlast)
			(L.L.kmcounter_m) (S.L.odometer_mlast)
			0 (S.L.odometr_sutki) (S.L.odometr_sutki_m)
		{endif}
		
	{else}
		" " $ (S.$.odometr_disp)
		" " $ (S.$.odometr_disp_sutki)
	{endif}	 	
{end}	

{macro:bk08_frame}
	(L.L.engine_injection_on) ! (L.L.engine_injection_on) &&
	{if}
		5 (S.L.bk_08_timer)
		(L.L.engine_timer) (S.L.engine_timer_last)
	{endif}
	(L.L.engine_injection_on)
	
	
	(L.L.engine_injection_on)
	{if}
		(L.L.engine_timer) (L.S.Timegap) + (S.L.engine_timer)
		0 (S.L.bk_08_timer)
	{else}

		(L.L.bk_08_timer) 0 >
		{if}
			(L.L.bk_08_timer) (L.S.Timegap) - (S.L.bk_08_timer)
		{endif}
		0 (S.L.engine_timer)
	{endif}

	(L.L.elec_busbar_main)
	{if}
'		test	
'		"2680...." (S.$.bk_08)
		(L.L.bk_08_timer) 0 >
		{if}
			(L.L.engine_timer_last) 3600 >
			{if}
				(L.L.engine_timer_last) 3600 / s0 trunc s1 " 2" $IntToStrEnh
				l0 l1 - 100 * trunc "02" $IntToStrEnh $+
				{if}
					" .  " $+
				{else}
					"    " $+
				{endif}
				(S.$.bk_08)
			{else}
				(L.L.engine_timer_last) 60 / trunc " 4" $IntToStrEnh
				"    " $+
				(S.$.bk_08)
			{endif}
		
		{else}
			(L.L.bk08_mode) 0 =
			{if}
				(L.L.engine_n) 1000 <
				{if}
					(L.L.engine_n) " 3" $IntToStrEnh "o    " $+ (S.$.bk_08)
				{else}
					(L.L.engine_n) $IntToStr 3 $SetLengthL "o.   " $+ (S.$.bk_08)
				{endif}
				(S.$.bk_08)
			{endif}
			
			(L.L.bk08_mode) 1 =
			{if}
				(L.L.elec_V_battery) s0 trunc s1 " 2" $IntToStrEnh
				l0 l1 - 10 * $IntToStr $+
				"v .  " $+
				(S.$.bk_08)
			{endif}
			
			(L.L.bk08_mode) 2 =
			{if}
				(L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh
				l0 l1 - 60 * trunc "02" $IntToStrEnh $+
				{if}
					" .  " $+
				{else}
					"    " $+
				{endif}
				(S.$.bk_08)
			{endif}
			
			(L.L.bk08_mode) 3 =
			{if}
				(L.L.Cabinair_Temp) 0 >=
				{if}
					(L.L.Cabinair_Temp) s0 trunc " 2" $IntToStrEnh
					l0 abs l0 abs trunc - 10 * " 1" $IntToStrEnh $+
					"c .  " $+
					(S.$.bk_08)
				{else}
					(L.L.Cabinair_Temp) s0 trunc " 3" $IntToStrEnh
					"c    " $+
					(S.$.bk_08)
				{endif}
			{endif}
		{endif}
	{else}
		"        " (S.$.bk_08)
		0 (S.L.bk_08_timer)
	{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 * + 0.8 min (S.L.Glass_pot)
			(L.L.cp_kn_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.cp_kn_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.cp_kn_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.cp_kn_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.cp_kn_zerkalo_podogrev) (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:engine_val_frame}

        (L.L.engine_val) (L.S.Timegap) (L.L.engine_n) * + (S.L.engine_val)

        360 >
        {if}
        (L.L.engine_val) 360 - (S.L.engine_val)  
 {endif}

	(L.L.A_Trans_Y) 9.81 / 1.5 min -1.5 max
	(L.L.cp_brizgovik) - 0.05 *
	(L.S.Timegap) /
	(L.S.Timegap) 6 * /-/ exp
	(L.L.cp_brizgovik_Speed) * + (S.L.cp_brizgovik_Speed)
	(L.S.Timegap) * (L.L.cp_brizgovik) + (S.L.cp_brizgovik)

 {endif}
{end}

{macro:bagazniki_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}

	(L.L.bagaznik1_pos) 0.1 >
	{if}
	(L.L.bagaznik1_speed) abs (S.L.bagaznik1_volcurve)
'		(L.L.bagaznik1_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik1_volcurve)
'		{else}
'			l0 (S.L.bagaznik1_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik1_dragged) !
	{if}
		(L.L.bagaznik1_pos) (L.S.Timegap) (L.L.bagaznik1_speed) * + (S.L.bagaznik1_pos)
		
		(L.L.bagaznik1_pos) 0.35 >
		{if}
			(L.L.bagaznik1_speed) (L.S.Timegap) + (S.L.bagaznik1_speed)
		{endif}
		
		(L.L.bagaznik1_pos) 0.35 <
		{if}
			(L.L.bagaznik1_speed) (L.S.Timegap) -1 * + (S.L.bagaznik1_speed)
		{endif}

		(L.L.bagaznik1_pos) 1 >
		{if}
			1 (S.L.bagaznik1_pos)
			(L.L.bagaznik1_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik1_speed)
		{endif}
		(L.L.bagaznik1_pos) 0 <
		{if}
			0 (S.L.bagaznik1_speed) (S.L.bagaznik1_pos)
		{endif}
	
		(L.L.bagaznik1_speed) 0 = !
		{if}
			(L.L.bagaznik1_pos) 0.005 < (L.L.bagaznik1_pos) 0.995 > ||
			{if}

		(L.L.empty_04) 1 <
				{if}
					(L.L.empty_04) (L.S.Timegap) + (S.L.empty_04)
				{else}
					0 (S.L.bagaznik1_speed)
				{endif}
			{else}
				0 (S.L.empty_04)
			{endif}
		{endif}
		(L.L.sumka_visible) 1 =
		{if}
			(L.L.bagaznik1_pos) 0.06 <
			{if}
				0.06 (S.L.bagaznik1_pos)
				(L.L.bagaznik1_speed) /-/ 0.1 * 0.2 min (S.L.bagaznik1_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik1_pos) 0 > (L.L.bagaznik1_open) ! &&
	{if}
		1 (S.L.bagaznik1_open)
	{endif}

	(L.L.bagaznik1_pos) 0 = (L.L.bagaznik1_open) &&
	{if}
		(T.L.ev_bagaznik1_cls)
		0 (S.L.bagaznik1_open)
	{endif}

	(L.L.bagaznik2_pos) 0.1 >
	{if}
	(L.L.bagaznik2_speed) abs (S.L.bagaznik2_volcurve)
'		(L.L.bagaznik2_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik2_volcurve)
'		{else}
'			l0 (S.L.bagaznik2_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik2_dragged) !
	{if}
		(L.L.bagaznik2_pos) (L.S.Timegap) (L.L.bagaznik2_speed) * + (S.L.bagaznik2_pos)
		
		(L.L.bagaznik2_pos) 0.35 >
		{if}
			(L.L.bagaznik2_speed) (L.S.Timegap) + (S.L.bagaznik2_speed)
		{endif}
		
		(L.L.bagaznik2_pos) 0.35 <
		{if}
			(L.L.bagaznik2_speed) (L.S.Timegap) -1 * + (S.L.bagaznik2_speed)
		{endif}

		(L.L.bagaznik2_pos) 1 >
		{if}
			1 (S.L.bagaznik2_pos)
			(L.L.bagaznik2_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik2_speed)
		{endif}
		(L.L.bagaznik2_pos) 0 <
		{if}
			0 (S.L.bagaznik2_speed) (S.L.bagaznik2_pos)
		{endif}
	
		(L.L.bagaznik2_speed) 0 = !
		{if}
			(L.L.bagaznik2_pos) 0.005 < (L.L.bagaznik2_pos) 0.995 > ||
			{if}

		(L.L.empty_05) 1 <
				{if}
					(L.L.empty_05) (L.S.Timegap) + (S.L.empty_05)
				{else}
					0 (S.L.bagaznik2_speed)
				{endif}
			{else}
				0 (S.L.empty_05)
			{endif}
		{endif}
		(L.L.sumka1_visible) 1 =
		{if}
			(L.L.bagaznik2_pos) 0.06 <
			{if}
				0.06 (S.L.bagaznik2_pos)
				(L.L.bagaznik2_speed) /-/ 0.1 * 0.2 min (S.L.bagaznik2_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik2_pos) 0 > (L.L.bagaznik2_open) ! &&
	{if}
		1 (S.L.bagaznik2_open)
	{endif}

	(L.L.bagaznik2_pos) 0 = (L.L.bagaznik2_open) &&
	{if}
		(T.L.ev_bagaznik2_cls)
		0 (S.L.bagaznik2_open)
	{endif}

	(L.L.bagaznik3_pos) 0.1 >
	{if}
	(L.L.bagaznik3_speed) abs (S.L.bagaznik3_volcurve)
'		(L.L.bagaznik3_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik3_volcurve)
'		{else}
'			l0 (S.L.bagaznik3_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik3_dragged) !
	{if}
		(L.L.bagaznik3_pos) (L.S.Timegap) (L.L.bagaznik3_speed) * + (S.L.bagaznik3_pos)
		
		(L.L.bagaznik3_pos) 0.35 >
		{if}
			(L.L.bagaznik3_speed) (L.S.Timegap) + (S.L.bagaznik3_speed)
		{endif}
		
		(L.L.bagaznik3_pos) 0.35 <
		{if}
			(L.L.bagaznik3_speed) (L.S.Timegap) -1 * + (S.L.bagaznik3_speed)
		{endif}

		(L.L.bagaznik3_pos) 1 >
		{if}
			1 (S.L.bagaznik3_pos)
			(L.L.bagaznik3_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik3_speed)
		{endif}
		(L.L.bagaznik3_pos) 0 <
		{if}
			0 (S.L.bagaznik3_speed) (S.L.bagaznik3_pos)
		{endif}
	
		(L.L.bagaznik3_speed) 0 = !
		{if}
			(L.L.bagaznik3_pos) 0.005 < (L.L.bagaznik3_pos) 0.995 > ||
			{if}

		(L.L.empty_06) 1 <
				{if}
					(L.L.empty_06) (L.S.Timegap) + (S.L.empty_06)
				{else}
					0 (S.L.bagaznik3_speed)
				{endif}
			{else}
				0 (S.L.empty_06)
			{endif}
		{endif}
		(L.L.sumka2_visible) 1 =
		{if}
			(L.L.bagaznik3_pos) 0.06 <
			{if}
				0.06 (S.L.bagaznik3_pos)
				(L.L.bagaznik3_speed) /-/ 0.1 * 0.2 min (S.L.bagaznik3_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik3_pos) 0 > (L.L.bagaznik3_open) ! &&
	{if}
		1 (S.L.bagaznik3_open)
	{endif}

	(L.L.bagaznik3_pos) 0 = (L.L.bagaznik3_open) &&
	{if}
		(T.L.ev_bagaznik3_cls)
		0 (S.L.bagaznik3_open)
	{endif}

	(L.L.bagaznik4_pos) 0.1 >
	{if}
	(L.L.bagaznik4_speed) abs (S.L.bagaznik4_volcurve)
'		(L.L.bagaznik4_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik4_volcurve)
'		{else}
'			l0 (S.L.bagaznik4_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik4_dragged) !
	{if}
		(L.L.bagaznik4_pos) (L.S.Timegap) (L.L.bagaznik4_speed) * + (S.L.bagaznik4_pos)
		
		(L.L.bagaznik4_pos) 0.35 >
		{if}
			(L.L.bagaznik4_speed) (L.S.Timegap) + (S.L.bagaznik4_speed)
		{endif}
		
		(L.L.bagaznik4_pos) 0.35 <
		{if}
			(L.L.bagaznik4_speed) (L.S.Timegap) -1 * + (S.L.bagaznik4_speed)
		{endif}

		(L.L.bagaznik4_pos) 1 >
		{if}
			1 (S.L.bagaznik4_pos)
			(L.L.bagaznik4_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik4_speed)
		{endif}
		(L.L.bagaznik4_pos) 0 <
		{if}
			0 (S.L.bagaznik4_speed) (S.L.bagaznik4_pos)
		{endif}
	
		(L.L.bagaznik4_speed) 0 = !
		{if}
			(L.L.bagaznik4_pos) 0.005 < (L.L.bagaznik4_pos) 0.995 > ||
			{if}

		(L.L.empty_07) 1 <
				{if}
					(L.L.empty_07) (L.S.Timegap) + (S.L.empty_07)
				{else}
					0 (S.L.bagaznik4_speed)
				{endif}
			{else}
				0 (S.L.empty_07)
			{endif}
		{endif}
		(L.L.sumka3_visible) 1 =
		{if}
			(L.L.bagaznik4_pos) 0.06 <
			{if}
				0.06 (S.L.bagaznik4_pos)
				(L.L.bagaznik4_speed) /-/ 0.1 * 0.2 min (S.L.bagaznik4_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik4_pos) 0 > (L.L.bagaznik4_open) ! &&
	{if}
		1 (S.L.bagaznik3_open)
	{endif}

	(L.L.bagaznik4_pos) 0 = (L.L.bagaznik4_open) &&
	{if}
		(T.L.ev_bagaznik4_cls)
		0 (S.L.bagaznik4_open)
	{endif}

	(L.L.bagaznik5_pos) 0.1 >
	{if}
	(L.L.bagaznik5_speed) abs (S.L.bagaznik5_volcurve)
'		(L.L.bagaznik5_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik5_volcurve)
'		{else}
'			l0 (S.L.bagaznik5_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik5_dragged) !
	{if}
		(L.L.bagaznik5_pos) (L.S.Timegap) (L.L.bagaznik5_speed) * + (S.L.bagaznik5_pos)
		
		(L.L.bagaznik5_pos) 0.35 >
		{if}
			(L.L.bagaznik5_speed) (L.S.Timegap) + (S.L.bagaznik5_speed)
		{endif}
		
		(L.L.bagaznik5_pos) 0.35 <
		{if}
			(L.L.bagaznik5_speed) (L.S.Timegap) -1 * + (S.L.bagaznik5_speed)
		{endif}

		(L.L.bagaznik5_pos) 1 >
		{if}
			1 (S.L.bagaznik5_pos)
			(L.L.bagaznik5_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik5_speed)
		{endif}
		(L.L.bagaznik5_pos) 0 <
		{if}
			0 (S.L.bagaznik5_speed) (S.L.bagaznik5_pos)
		{endif}
	
		(L.L.bagaznik5_speed) 0 = !
		{if}
			(L.L.bagaznik5_pos) 0.005 < (L.L.bagaznik5_pos) 0.995 > ||
			{if}

		(L.L.empty_08) 1 <
				{if}
					(L.L.empty_08) (L.S.Timegap) + (S.L.empty_08)
				{else}
					0 (S.L.bagaznik5_speed)
				{endif}
			{else}
				0 (S.L.empty_08)
			{endif}
		{endif}
		(L.L.sumka4_visible) 1 =
		{if}
			(L.L.bagaznik5_pos) 0.06 <
			{if}
				0.06 (S.L.bagaznik5_pos)
				(L.L.bagaznik5_speed) /-/ 0.1 * 0.2 min (S.L.bagaznik5_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik5_pos) 0 > (L.L.bagaznik5_open) ! &&
	{if}
		1 (S.L.bagaznik5_open)
	{endif}

	(L.L.bagaznik5_pos) 0 = (L.L.bagaznik5_open) &&
	{if}
		(T.L.ev_bagaznik5_cls)
		0 (S.L.bagaznik5_open)
	{endif}

	(L.L.bagaznik6_pos) 0.1 >
	{if}
	(L.L.bagaznik6_speed) abs (S.L.bagaznik6_volcurve)
'		(L.L.bagaznik6_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik6_volcurve)
'		{else}
'			l0 (S.L.bagaznik6_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik6_dragged) !
	{if}
		(L.L.bagaznik6_pos) (L.S.Timegap) (L.L.bagaznik6_speed) * + (S.L.bagaznik6_pos)
		
		(L.L.bagaznik6_pos) 0.35 >
		{if}
			(L.L.bagaznik6_speed) (L.S.Timegap) + (S.L.bagaznik6_speed)
		{endif}
		
		(L.L.bagaznik6_pos) 0.35 <
		{if}
			(L.L.bagaznik6_speed) (L.S.Timegap) -1 * + (S.L.bagaznik6_speed)
		{endif}

		(L.L.bagaznik6_pos) 1 >
		{if}
			1 (S.L.bagaznik6_pos)
			(L.L.bagaznik6_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik6_speed)
		{endif}
		(L.L.bagaznik6_pos) 0 <
		{if}
			0 (S.L.bagaznik6_speed) (S.L.bagaznik6_pos)
		{endif}
	
		(L.L.bagaznik6_speed) 0 = !
		{if}
			(L.L.bagaznik6_pos) 0.005 < (L.L.bagaznik6_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.bagaznik6_speed)
				{endif}
			{else}
				0 (S.L.empty_01)
			{endif}
		{endif}
		(L.L.sumka5_visible) 1 =
		{if}
			(L.L.bagaznik6_pos) 0.06 <
			{if}
				0.06 (S.L.bagaznik6_pos)
				(L.L.bagaznik6_speed) /-/ 0.1 * 0.2 min (S.L.bagaznik6_speed) 
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik6_pos) 0 > (L.L.bagaznik6_open) ! &&
	{if}
		1 (S.L.bagaznik6_open)
	{endif}

	(L.L.bagaznik6_pos) 0 = (L.L.bagaznik6_open) &&
	{if}
		(T.L.ev_bagaznik6_cls)
		0 (S.L.bagaznik6_open)
	{endif}

	(L.L.bagaznik7_pos) 0.1 >
	{if}
	(L.L.bagaznik7_speed) abs (S.L.bagaznik7_volcurve)
'		(L.L.bagaznik7_speed) s0 0 <
'		{if}
'			l0 /-/ (S.L.bagaznik7_volcurve)
'		{else}
'			l0 (S.L.bagaznik7_volcurve)
'		{endif}
	{endif}

	(L.L.bagaznik7_dragged) !
	{if}
		(L.L.bagaznik7_pos) (L.S.Timegap) (L.L.bagaznik7_speed) * + (S.L.bagaznik7_pos)
		
		(L.L.bagaznik7_pos) 0.35 >
		{if}
			(L.L.bagaznik7_speed) (L.S.Timegap) + (S.L.bagaznik7_speed)
		{endif}
		
		(L.L.bagaznik7_pos) 0.35 <
		{if}
			(L.L.bagaznik7_speed) (L.S.Timegap) -1 * + (S.L.bagaznik7_speed)
		{endif}

		(L.L.bagaznik7_pos) 1 >
		{if}
			1 (S.L.bagaznik7_pos)
			(L.L.bagaznik7_speed) /-/ 0.2 * 0.2 min (S.L.bagaznik7_speed)
		{endif}
		(L.L.bagaznik7_pos) 0 <
		{if}
			0 (S.L.bagaznik7_speed) (S.L.bagaznik7_pos)
		{endif}
	
		(L.L.bagaznik7_speed) 0 = !
		{if}
			(L.L.bagaznik7_pos) 0.005 < (L.L.bagaznik7_pos) 0.995 > ||
			{if}

		(L.L.empty_03) 1 <
				{if}
					(L.L.empty_03) (L.S.Timegap) + (S.L.empty_03)
				{else}
					0 (S.L.bagaznik7_speed)
				{endif}
			{else}
				0 (S.L.empty_03)
			{endif}
		{endif}
	{endif}

	(L.L.bagaznik7_pos) 0 > (L.L.bagaznik7_open) ! &&
	{if}
		1 (S.L.bagaznik7_open)
	{endif}

	(L.L.bagaznik7_pos) 0 = (L.L.bagaznik7_open) &&
	{if}
		(T.L.ev_bagaznik7_cls)
		0 (S.L.bagaznik7_open)
	{endif}
{end}

'{macro:wheels_frame}

'	(L.L.door_1) 1 =
'       {if}
'          (L.L.Axle_Steering_0_R) 0 >
'      {if}

'      > 0.6 (S.L.Axle_Steering_0_R) 
'	{endif}
'{end}
	
