'##############
'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

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


'----------------------
'	Trigger
'----------------------
{trigger:horn}

	(L.L.cp_duda_sw) 0 =
	{if}
		(L.L.cockpit_hupe) ! (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe_an)
		{endif}
		1 (S.L.cockpit_hupe)
	{else}
		(L.L.cockpit_hupe) ! (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe2_an)
		{endif}
		1 (S.L.cockpit_hupe2)
	{endif}
	1 (S.L.dudakapcsolo)
{end}

{trigger:horn_off}
	
	(L.L.cp_duda_sw) 0 =
	{if}
		(L.L.cockpit_hupe) (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe_aus)
		{endif}
		0 (S.L.cockpit_hupe)
	{else}
		(L.L.cockpit_hupe) (L.L.elec_busbar_main) &&
		{if}
			(T.L.ev_hupe2_aus)
		{endif}
		0 (S.L.cockpit_hupe2)
	{endif}
	0 (S.L.dudakapcsolo)
{end}

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

{trigger:cp_tanksapka_toggle}
	(L.L.cp_tanksapka_sw) ! (S.L.cp_tanksapka_sw) s1
	(M.L.tanksapkasound)
{end}

{trigger:cp_kulcs_toggle}
	(L.L.cp_kulcs_rot) 0 =
	{if}
	(L.L.cp_kulcs_sw) ! (S.L.cp_kulcs_sw) s1
	{endif}
	(T.L.ev_schluessel_steck)
{end}

{trigger:cp_kijelzo_toggle}
	(L.L.cp_kijelzo_sw) ! (S.L.cp_kijelzo_sw) s1
	(T.L.ev_kattanas)
{end}

{trigger:cp_dobozajto_toggle}
	(L.L.cp_dobozajto_sw) ! (S.L.cp_dobozajto_sw) s1
	(M.L.ladaajtosound)
{end}

{trigger:cp_menetrend_toggle}
	(L.L.cp_menetrend_sw) ! (S.L.cp_menetrend_sw) s1
	(T.L.ev_kattanas)
{end}

{trigger:cp_fuggony_toggle}
	(L.L.cp_fuggony_sw) ! (S.L.cp_fuggony_sw) s1
	(M.L.fuggonysound)
{end}

{trigger:cp_tabla_toggle}
	(L.L.cp_tabla_sw) ! (S.L.cp_tabla_sw) s1
	(T.L.ev_kattanas)
{end}

{trigger:cp_tabla1_toggle}
	(L.L.cp_tabla1_sw) ! (S.L.cp_tabla1_sw) s1
	(T.L.ev_kattanas)
{end}

{trigger:cp_bor_toggle}
	(L.L.cp_bor_sw) ! (S.L.cp_bor_sw) s1
	(T.L.ev_kattanas)
{end}

{trigger:cp_tetovent_toggle}
	(L.L.cp_tetovent_sw) ! (S.L.cp_tetovent_sw) s1
	(M.L.tetoventsound)
{end}

{trigger:cp_uzemoraszamlalo_toggle}
	(L.L.cp_uzemoraszamlalo_sw) ! (S.L.cp_uzemoraszamlalo_sw) s1
	(M.L.kippschaltersound1)
{end}

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

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

{trigger:cp_kapcsolokar1_toggle}
	(L.L.cp_kapcsolokar1_sw) ! (S.L.cp_kapcsolokar1_sw) s1
	(M.L.kapcskarsound)
{end}

{trigger:cp_kapcsolokar2_toggle}
	(L.L.cp_kapcsolokar2_sw) ! (S.L.cp_kapcsolokar2_sw) s1
	(M.L.kapcskarsound)
{end}

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

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

{trigger:taster_erosito}
	(L.L.cp_taster_erosito_target) ! (S.L.cp_taster_erosito_target) s1
	(T.L.ev_gomb_ein)
	1 (S.L.cp_taster_erosito)
{end}

{trigger:taster_erosito_off}
	(L.L.cp_taster_erosito_target)
	{if}
		0.6 (S.L.cp_taster_erosito)
	{else}
		0 (S.L.cp_taster_erosito)
	{endif}
	(T.L.ev_gomb_aus)
{end}

{trigger:cp_ladavilagitas_toggle}
	(L.L.cp_ladavil_sw) ! (S.L.cp_ladavil_sw) s1
	(M.L.kippschaltersound1)
{end}

{trigger:cp_batterietrennschalter_toggle}
	(L.L.cp_billentyuzetaram_sw) !
	(L.L.cp_kulcs_rot) 0 = &&
	{if}
	1 (S.L.cp_kulcs_sw)
	1 (S.L.cp_fokapcsolo_sw)
	1 (S.L.cp_megszakito_sw)
	(T.L.ev_kippschalter_ein)
	{endif}

	(L.L.cp_billentyuzetaram_sw)
	(L.L.cp_kulcs_rot) 0 = &&
	{if}
	0 (S.L.cp_kulcs_sw)
	0 (S.L.cp_fokapcsolo_sw)
	0 (S.L.cp_megszakito_sw)
	(T.L.ev_kippschalter_aus)
	{endif}
	(T.L.ev_schluessel_steck)
{end}

{trigger:blinker_warn_toggle}
	(L.L.lights_sw_warnblinker) ! (S.L.lights_sw_warnblinker) s1
	(M.L.kippschaltersound1)
{end}

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

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

{trigger:cp_retarder_direkt}
	1 (S.L.cp_retarder_sw_direkt)
	(T.L.ev_kippschalter2_ein)
{end}

{trigger:cp_retarder_direkt_off}
	0 (S.L.cp_retarder_sw_direkt)
	(T.L.ev_kippschalter2_aus)
{end}

{trigger:cp_veszjelzo}
	1 (S.L.cp_veszjelzo_sw)
	1 (S.L.cp_veszjelzo)
	(T.L.ev_gomb_ein)
{end}

{trigger:cp_veszjelzo_off}
	0 (S.L.cp_veszjelzo_sw)
	(T.L.ev_gomb_aus)
{end}

{trigger:cp_veszjelzo1}
	1 (S.L.cp_veszjelzo2_sw)
	1 (S.L.cp_veszjelzo)
	(T.L.ev_gomb_ein)
{end}

{trigger:cp_veszjelzo1_off}
	0 (S.L.cp_veszjelzo2_sw)
	(T.L.ev_gomb_aus)
{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_wischer_wascher_button}
	1 (S.L.cp_wischer_wascher_sw) s1
		l1 (M.L.gombsound)
{end}

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

{trigger:cp_heizluefter_toggle}
	(L.L.cp_heizluefter_sw) s0
	0 >
	0.6 <
	{if}
		0.5 (S.L.cp_heizluefter_sw) 
		(T.L.ev_kippschalter_ein)
	{else}
		l0 0.6 <
		{if}
			1 (S.L.cp_heizluefter_sw) 
			(T.L.ev_kippschalter_ein)
		{else}
			0 (S.L.cp_heizluefter_sw)
			(T.L.ev_kippschalter_aus)
		{endif}
	{endif}
{end}

{trigger:cp_heizluefter1_toggle}
	(L.L.cp_heizluefter1_sw) s0
	0 >
	0.6 <
	{if}
		0.5 (S.L.cp_heizluefter1_sw)
		(T.L.ev_kippschalter_ein)
	{else}
		l0 0.6 <
		{if}
			1 (S.L.cp_heizluefter1_sw)
			(T.L.ev_kippschalter_ein)
		{else}
			0 (S.L.cp_heizluefter1_sw) 
			(T.L.ev_kippschalter_aus)
		{endif}
	{endif}
{end}

{trigger:cp_klimator_toggle}
	(L.L.cp_klimator_sw) s0
	0 >
	0.6 <
	{if}
		0.5 (S.L.cp_klimator_sw)
		(T.L.ev_kippschalter_ein)
	{else}
		l0 0.6 <
		{if}
			1 (S.L.cp_klimator_sw)
			(T.L.ev_kippschalter_ein)
		{else}
			0 (S.L.cp_klimator_sw)
			(T.L.ev_kippschalter_aus)
		{endif}
	{endif}
{end}

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

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

{trigger:cp_csap_toggle}
	(L.L.cp_csap_sw) ! (S.L.cp_csap_sw) s1
	(M.L.csapsound)
{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_rollo_bal_drag}

	(L.L.cp_rollo_bal_pos) (S.L.cp_rollo_bal_lastpos)

	1 (S.L.cp_rollo_bal_dragged)
	0 (S.L.cp_rollo_bal_speed)
	(L.S.mouse_y) 800 / (L.L.cp_rollo_bal_pos) + (S.L.cp_rollo_bal_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo_bal_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo_bal_pos)
	{endif}
	(L.L.cp_rollo_bal_pos) 0.075 >=
	{if}
		(L.L.rollo_bal_1_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_1_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.17 >=
	{if}
		(L.L.rollo_bal_2_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_2_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.262 >=
	{if}
		(L.L.rollo_bal_3_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_3_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.356 >=
	{if}
		(L.L.rollo_bal_4_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_4_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.45 >=
	{if}
		(L.L.rollo_bal_5_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_5_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.543 >=
	{if}
		(L.L.rollo_bal_6_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_6_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.636 >=
	{if}
		(L.L.rollo_bal_7_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_7_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.729 >=
	{if}
		(L.L.rollo_bal_8_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_8_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.822 >=
	{if}
		(L.L.rollo_bal_9_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_9_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.914 >=
	{if}
		(L.L.rollo_bal_10_visibility) 0 =
		{if}
			1 (S.L.rollo_bal_10_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) (L.L.cp_rollo_bal_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo_bal_speed)

{end}

{trigger:cp_rollo_bal_off}
	0 (S.L.cp_rollo_bal_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo_bal_retract}
	(L.L.cp_rollo_bal_bommel) 0 = (L.L.cp_rollo_bal_pos) &&
	{if}
		(T.L.ev_rollo_retract_bal)
	{endif}
	1 (S.L.cp_rollo_bal_bommel) (S.L.cp_rollo_bal_retract)

{end}

{trigger:cp_rollo_bal_retract_off}
	0 (S.L.cp_rollo_bal_bommel) (S.L.cp_rollo_bal_retract) (S.L.cp_rollo_bal_speed)
{end}

{trigger:cp_rollo_jobb_drag}

	(L.L.cp_rollo_jobb_pos) (S.L.cp_rollo_jobb_lastpos)

	1 (S.L.cp_rollo_jobb_dragged)
	0 (S.L.cp_rollo_jobb_speed)
	(L.S.mouse_y) 800 / (L.L.cp_rollo_jobb_pos) + (S.L.cp_rollo_jobb_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_rollo_jobb_pos)
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_rollo_jobb_pos)
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.075 >=
	{if}
		(L.L.rollo_jobb_1_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_1_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.17 >=
	{if}
		(L.L.rollo_jobb_2_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_2_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.262 >=
	{if}
		(L.L.rollo_jobb_3_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_3_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.356 >=
	{if}
		(L.L.rollo_jobb_4_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_4_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.45 >=
	{if}
		(L.L.rollo_jobb_5_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_5_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.543 >=
	{if}
		(L.L.rollo_jobb_6_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_6_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.636 >=
	{if}
		(L.L.rollo_jobb_7_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_7_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.729 >=
	{if}
		(L.L.rollo_jobb_8_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_8_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.822 >=
	{if}
		(L.L.rollo_jobb_9_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_9_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.914 >=
	{if}
		(L.L.rollo_jobb_10_visibility) 0 =
		{if}
			1 (S.L.rollo_jobb_10_visibility) (T.L.ev_rollo_end)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) (L.L.cp_rollo_jobb_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo_jobb_speed)

{end}

{trigger:cp_rollo_jobb_off}
	0 (S.L.cp_rollo_jobb_dragged)
	(T.L.ev_rollo_end)
{end}

{trigger:cp_rollo_jobb_retract}
	(L.L.cp_rollo_jobb_bommel) 0 = (L.L.cp_rollo_jobb_pos) &&
	{if}
		(T.L.ev_rollo_retract_jobb)
	{endif}
	1 (S.L.cp_rollo_jobb_bommel) (S.L.cp_rollo_jobb_retract)

{end}

{trigger:cp_rollo_jobb_retract_off}
	0 (S.L.cp_rollo_jobb_bommel) (S.L.cp_rollo_jobb_retract) (S.L.cp_rollo_jobb_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_fahrerfenster2_opn_drag}

	(L.L.cp_fahrerfenster2_pos) (S.L.cp_fahrerfenster2_lastpos)

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

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


	(L.L.cp_fahrerfenster2_pos) (L.L.cp_fahrerfenster2_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{end}


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

{trigger:cp_dachluke_1}
	(L.L.cp_dachluke_1) 1 + (S.L.cp_dachluke_1) 3 >
	{if}
		0 (S.L.cp_dachluke_1)
	{endif}
	(L.L.cp_dachluke_1) s0
	(M.L.dachluke_pos_rot)
	l1 (S.L.cp_dachluke_1_pos)
	l2 (S.L.cp_dachluke_1_rot)
{end}

{trigger:cp_dachluke_2}
	(L.L.cp_dachluke_2) 1 + (S.L.cp_dachluke_2) 3 >
	{if}
		0 (S.L.cp_dachluke_2)
	{endif}
	(L.L.cp_dachluke_2) s0
	(M.L.dachluke_pos_rot)
	l1 (S.L.cp_dachluke_2_pos)
	l2 (S.L.cp_dachluke_2_rot)
{end}

{trigger:cp_dachluke_3}
	(L.L.cp_dachluke_3) 1 + (S.L.cp_dachluke_3) 3 >
	{if}
		0 (S.L.cp_dachluke_3)
	{endif}
	(L.L.cp_dachluke_3) s0
	(M.L.dachluke_pos_rot)
	l1 (S.L.cp_dachluke_3_pos)
	l2 (S.L.cp_dachluke_3_rot)
{end}

{trigger:cp_kulcs_mov_drag}
	(L.S.mouse_y) abs (L.S.mouse_x) abs >=
	{if}

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

		l1 0.2 <
		{if}
			0 (S.L.cp_kulcs_rot_mode)
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_kulcs_rot_mode)
			{else}
				2 (S.L.cp_kulcs_rot_mode)
			{endif}
		{endif}
	{endif}
{end}

{trigger:cp_kulcs_mov_off}
	(L.L.cp_kulcs_rot) 0.2 <
	{if}
	0 (S.L.cp_kulcs_rot)
	{endif}

	(L.L.cp_kulcs_rot) 0.2 >=
	(L.L.cp_kulcs_rot) 0.8 < &&
	{if}
	0.5 (S.L.cp_kulcs_rot)
	{endif}

	(L.L.cp_kulcs_rot) 0.8 >=
	{if}
	1 (S.L.cp_kulcs_rot)
	{endif}
{end}

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

{trigger:cp_jegyadofiok_drag}

	(L.L.cp_jegyadofiok_pos) (S.L.cp_jegyadofiok_lastpos)

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

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


	(L.L.cp_jegyadofiok_pos) (L.L.cp_jegyadofiok_lastpos) - abs (L.S.Timegap) / (S.L.cp_fahrerfenster_speed)
{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:nebelschluss_toggle}
	(L.L.cp_taster_nebelschluss_target) ! (S.L.cp_taster_nebelschluss_target) s1
	(M.L.kippschaltersound)
{end}

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

{trigger:cp_vizeskalyha_kapcs_drag}
	(L.S.mouse_y) -150 / (L.L.cockpit_vizeskalyha) + -1 max 1 min (S.L.cockpit_vizeskalyha)
{end}

{trigger:cp_vizeskalyha_kapcs_off}

	(L.L.cockpit_vizeskalyha) 0.5 >
	{if}
	1 (S.L.cockpit_vizeskalyha)
	(T.L.ev_kalyha)
	{endif}

	(L.L.cockpit_vizeskalyha) -0.5 <
	{if}
	-1 (S.L.cockpit_vizeskalyha)
	(T.L.ev_kalyha)
	{endif}

	(L.L.cockpit_vizeskalyha) -0.5 >
	(L.L.cockpit_vizeskalyha) 0.5 < &&
	{if}
	0 (S.L.cockpit_vizeskalyha)
	(T.L.ev_kalyha)
	{endif}
{end}

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

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

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

	0 (S.L.cp_kulcs_rot) (S.L.cp_veszjelzo)

{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.tacho_frame)
	(M.L.uhr_frame)
	(M.L.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.blinkerhebel_frame)
	(M.L.oeldruck_frame)
	(M.L.tankuhr_frame)
	(M.L.toltes_frame)
	(M.L.cockpitlights_frame)
	(M.L.klimator_frame)
	(M.L.odometer_frame)
	(M.L.fahrertuer_frame)
	(M.L.timer_frame)
	(M.L.rollo_bal_frame)
	(M.L.rollo_jobb_frame)
	(M.L.engine_thermometer_frame)
	(M.L.microphone_frame)
	(M.L.pressure_warning_needle_frame)
	(M.L.zentralschmierung_frame)
	(M.L.kapcsoloelektromossag_frame)
	(M.L.Thermometer_frame)
	(M.L.kulcs_frame)
	(M.L.parasodas_frame)
	(M.L.parasodas_szelvedo_frame)
	(M.L.tukorfagyas_frame)

	(L.L.cp_megszakito_sw) (L.L.elec_busbar_main_sw) &&
	{if}
	1 (S.L.cp_billentyuzetaram_sw)
	{else}
	0 (S.L.cp_billentyuzetaram_sw)
	{endif}
{end}

{macro:kapcsoloelektromossag_frame}

	(L.L.engine_on)
	{if}
	(L.L.cp_heizluefter_sw) (S.L.futes_sw)
	{else}
	0 (S.L.futes_sw)
	{endif}

	(L.L.engine_on)
	{if}
	(L.L.cp_heizluefter1_sw) (S.L.futes1_sw)
	{else}
	0 (S.L.futes1_sw)
	{endif}

	(L.L.cp_ladavil_sw)
	(L.L.elec_megszakito) &&
	{if}
	1 (S.L.ladavilagitas)
	{else}
	0 (S.L.ladavilagitas)
	{endif}

	(L.L.cp_taster_erosito_target) (L.L.elec_busbar_main) &&
	(S.L.erositolampa)

	(L.L.cp_jegyado_sw) (L.L.elec_busbar_main) &&
	(S.L.jegyado_sw)

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

	(L.L.cp_kijelzovil_sw) (L.L.elec_busbar_main) &&
	(S.L.kijelzovilagitas)

	(L.L.cp_parklampa_sw) (L.L.elec_megszakito) &&
	(S.L.parklampa)

'Ládaajtó lófasz mozgató (semmi köze az áramhoz de hova a tökömbe írjam?!)

	(L.L.cp_dobozajto_sw)
	{if}
	2 / (L.S.Timegap) * (L.L.cp_ladaajto_sw) + 0 max 1 min (S.L.cp_ladaajto_sw)
	{else}
	(L.L.cp_ladaajto_sw) (L.S.Timegap) 2 / - 0 max 1 min (S.L.cp_ladaajto_sw)
	{endif}

'Érted
	(L.L.cp_ladaajto_sw) (F.L.ladaajto_mozgato) (S.L.ladaajtotarto)

	(L.L.cp_ladaajto_sw) (F.L.ladaajto_mozgato1) (S.L.ladaajtotarto1)


'	Üzemóra

	(L.L.cp_uzemoraszamlalo_sw) (L.L.elec_megszakito) &&
	{if}
	1 (S.L.uzemora_be)
	{else}
	0 (S.L.uzemora_be)
	{endif}

	(L.L.uzemora_be)
	{if}
		(L.L.uzemora_time) 1 <
		{if}
			(L.L.uzemora_time) (L.S.Timegap) + (S.L.uzemora_time)
		{endif}
		(L.L.uzemora_time) (F.L.uzemora_speed_on) (S.L.uzemora_speed)
	{else}
		(L.L.uzemora_time) 0 >
		{if}
			(L.L.uzemora_time) (L.S.Timegap) - (S.L.uzemora_time)
		{endif}
		(L.L.uzemora_time) (F.L.uzemora_speed_off) (S.L.uzemora_speed)
	{endif}
	
	(L.L.uzemora_mutato) (L.S.Timegap) (L.L.uzemora_speed) * + (S.L.uzemora_mutato)	
{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) (F.L.cockpit_fordulat) s0

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

	(L.L.cockpit_drehzahlwinkel) s1
	5 s2
	5 s3
	(M.L.traegheit)	
	l1 (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}

	(L.L.elec_busbar_main)
	{if}
		(L.L.cockpit_hupe2) 1 =
		{if}
			(L.L.cockpit_hupe2_volume) 1 <
			{if}
				(L.L.cockpit_hupe2_volume) (L.S.Timegap) 10 * + (S.L.cockpit_hupe2_volume)
			{else}
				1 (S.L.cockpit_hupe2_volume)
			{endif}
		{else}
			(L.L.cockpit_hupe2_volume) 0 >
			{if}
				(L.L.cockpit_hupe2_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe2_volume)
			{else}
				0 (S.L.cockpit_hupe2_volume)
			{endif}
		{endif}
	{else}
		(L.L.cockpit_hupe2_volume) 0 >
		{if}
			(L.L.cockpit_hupe2_volume) (L.S.Timegap) 10 * - (S.L.cockpit_hupe2_volume)
		{else}
			0 (S.L.cockpit_hupe2_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_kulcs_rot) 0.8 >
		{if}
			-1 (S.L.cockpit_fernlichthebel)
		{endif}
	{else}
		0 (S.L.cockpit_fernlichthebel)
	{endif}


{end}

{macro:cockpitlights_frame}

'	Störungsmelder
	(L.L.engine_n) 300 <
	(L.L.bremse_p_tank01) 550000 < ||
	(L.L.bremse_p_tank02) 550000 < ||
	(L.L.bremse_p_tank03) 550000 < ||
	(L.L.bremse_p_tank04) 550000 < ||
	(L.L.engine_temperature) 92 > ||
	(L.L.elec_busbar_main) &&
	(L.L.engine_starter) ! &&
	(S.L.cockpit_light_masterfailure)

'	Batterie
	(L.L.elec_V_generator) 0.7 < (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_batterie)

'	Izzítás
	(L.L.izzitogyertya) 1 <
	(L.L.izzitogyertya) 0 > &&
	(L.L.engine_n) 10 < &&
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_izzitas)

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

'	Kontrolle Feststellbremse
	(L.L.bremse_p_Brzyl_FBA) 550000 <
	(L.L.elec_busbar_main) &&
	(S.L.cockpit_light_feststellbremse)

'	Geschwindigkeitswarnung
	(L.L.Velocity) 79 > (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)

'	Vészjelzõ
	(L.L.cp_veszjelzo) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_veszjelzo)

'	Leszállásjelzõ
	(L.L.haltewunschlampe) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_leszallas)

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


'	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) (L.L.elec_busbar_main) * s0

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

{macro:toltes_frame}
	(L.L.elec_V_battery) (F.L.cockpit_toltes0) (L.L.elec_busbar_main) * (S.L.cockpit_toltes0)


	(L.L.engine_n) (F.L.cockpit_toltes) (L.L.cockpit_toltes0) * s0

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

{macro:tankuhr_frame}
	(L.L.engine_tank_content) (F.L.cockpit_uzemanyag) (L.L.elec_busbar_main) * s0

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

{macro:engine_thermometer_frame}
	(L.L.engine_temperature) (F.L.cockpit_engine_temperature) (L.L.elec_busbar_main) * s0

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

{macro:parasodas_frame}
	(L.L.Cabinair_Temp) 16 >
	{if}
	(L.L.parasodas) 0.1 >
	{if}
	(L.L.parasodas) 0.00005 - (S.L.parasodas)
	{endif}
	{endif}
	
	(L.L.Cabinair_Temp) 15 <
	(L.L.Rain_Window_Norm_Wetness) &&
	{if}
	(L.L.parasodas) 0.7 < 
	{if}
	(L.L.parasodas) 0.00005 + (S.L.parasodas)
	{endif}
	{endif}
	{endif}
{end}

{macro:parasodas_szelvedo_frame}
	(L.L.Cabinair_Temp) 16 >
	(L.L.ablakpallas) ||
	{if}
	(L.L.parasodas_szelvedo) 0.1 >
	{if}
	(L.L.parasodas_szelvedo) 0.00005 - (S.L.parasodas_szelvedo)
	{endif}
	{endif}
	
	(L.L.Cabinair_Temp) 15 <
	(L.L.Rain_Window_Norm_Wetness) &&
	(L.L.ablakpallas) ! &&
	{if}
	(L.L.parasodas_szelvedo) 0.7 < 
	{if}
	(L.L.parasodas_szelvedo) 0.00005 + (S.L.parasodas_szelvedo)
	{endif}
	{endif}
	{endif}

	(L.L.cp_klimator_RPM) 30 >
	(L.L.cp_kapcsolokar1_sw) &&
	{if}
	1 (S.L.ablakpallas)
	{else}
	0 (S.L.ablakpallas)
	{endif}
{end}

{macro:tukorfagyas_frame}

	(L.L.cp_spiegelheizung_sw) (L.L.elec_busbar_main) &&
	(S.L.tukorfagyas_sw)

	(L.L.tukorfagyas_sw) 1 = 
	{if}
	(L.L.tukorfagyas) 0.1 >
	{if}
	(L.L.tukorfagyas) 0.0001 - (S.L.tukorfagyas)
	{endif}
	{endif}
	
	(L.L.tukorfagyas_sw) 0 = 
	{if}
	(L.S.Weather_Temperature) 0 < 
	(L.L.tukorfagyas) 1 < &&
	{if}
	(L.L.tukorfagyas) 0.0001 + (S.L.tukorfagyas)
	{endif}
	{endif}
	{endif}
	
	(L.S.Weather_Temperature) 4 > 
	{if}
	(L.L.tukorfagyas) 0.1 >
	{if}
	(L.L.tukorfagyas) 0.0001 - (S.L.tukorfagyas)
	{endif}
	{endif}
	
{end}

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

{macro:tetoventsound}
	l1
	{if}
		(T.L.ev_tetovent_ein)
	{else}
		(T.L.ev_tetovent_aus)
	{endif}	
{end}

{macro:fuggonysound}
	l1
	{if}
		(T.L.ev_fuggony_ein)
	{else}
		(T.L.ev_fuggony_aus)
	{endif}	
{end}

{macro:ladaajtosound}
	l1
	{if}
		(T.L.ev_lada_ein)
	{else}
		(T.L.ev_lada_aus)
	{endif}	
{end}

{macro:tanksapkasound}
	l1
	{if}
		(T.L.ev_tank_ein)
	{else}
		(T.L.ev_tank_aus)
	{endif}	
{end}

{macro:kippschaltersound1}
	l1
	{if}
		(T.L.ev_kippschalter1_ein)
	{else}
		(T.L.ev_kippschalter1_aus)
	{endif}
{end}

{macro:gombsound}
	l1
	{if}
		(T.L.ev_gomb_ein)
	{else}
		(T.L.ev_gomb_aus)
	{endif}	
{end}

{macro:csapsound}
	l1
	{if}
		(T.L.ev_csap_ein)
	{else}
		(T.L.ev_csap_aus)
	{endif}	
{end}

{macro:kapcskarsound}
	l1
	{if}
		(T.L.ev_kapcskar_ein)
	{else}
		(T.L.ev_kapcskar_aus)
	{endif}	
{end}

{macro:klimator_frame}

'Raumheizgerat:
	(L.L.futes_sw) (L.L.elec_busbar_main) * s1

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_cabinheater_RPM) > 
	{if}
		1.5 s0
	{else}
		1 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)

'Leitwert generieren:

	(L.L.cp_cabinheater_RPM) 10 >
	{if}
		(L.L.cp_heizluefter_sw) 0.6 >
		{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_cabinheater_Rinv) + (S.L.elec_busbar_Rinv_summe)
		{else}
			(L.L.cp_heizluefter_sw) 0.6 <
			(L.L.cp_heizluefter_sw) 0 > &&
			{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_cabinheater_Rinv) 0.6 * + (S.L.elec_busbar_Rinv_summe)
			{endif}
		{endif}
	{endif}

'Zweite Raumheizgerat:
	(L.L.futes1_sw) (L.L.elec_busbar_main) * s1

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

' Berechnung der Luefterbeschleunigung:

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

'Leitwert generieren:

	(L.L.cp_cabinheater1_RPM) 10 >
	{if}
		(L.L.cp_heizluefter1_sw) 0.6 >
		{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_cabinheater1_Rinv) + (S.L.elec_busbar_Rinv_summe)
		{else}
			(L.L.cp_heizluefter1_sw) 0.6 <
			(L.L.cp_heizluefter1_sw) 0 > &&
			{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_cabinheater1_Rinv) 0.6 * + (S.L.elec_busbar_Rinv_summe)
			{endif}
		{endif}
	{endif}

'Frontheizgerät:
	(L.L.cp_klimator_sw) (L.L.elec_busbar_main) * s1

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_klimator_RPM) > 
	{if}
		1.5 s0
	{else}
		1 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)

'Leitwert generieren:

	(L.L.cp_klimator_RPM) 10 >
	{if}
		(L.L.cp_klimator_sw) 0.6 >
		{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_klimator_Rinv) + (S.L.elec_busbar_Rinv_summe)
		{else}
			(L.L.cp_klimator_sw) 0.6 <
			(L.L.cp_klimator_sw) 0 > &&
			{if}
				(L.L.elec_busbar_Rinv_summe) (C.L.cp_klimator_Rinv) 0.6 * + (S.L.elec_busbar_Rinv_summe)
			{endif}
		{endif}
	{endif}

'Dachlüfter:

	(L.L.cp_dachluefter_sw) (L.L.elec_busbar_main) * s1

'Anlauf oder Auslauf?
	l1 100 * (L.L.cp_dachluefter_RPM) > 
	{if}
		1 s0
	{else}
		0.25 s0
	{endif}

' Berechnung der Luefterbeschleunigung:

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

'Leitwert generieren:
	(L.L.cp_dachluefter_RPM) 10 >
	{if}
		(L.L.cp_dachluefter_sw) 0.5 >
		{if}
			(L.L.elec_busbar_Rinv_summe) (C.L.cp_dachluefter_Rinv) + (S.L.elec_busbar_Rinv_summe)
		{else}
			(L.L.cp_dachluefter_sw) -0.5 <
			{if}
				(L.L.elec_busbar_Rinv_summe) (C.L.cp_dachluefter_Rinv) 0.6 * + (S.L.elec_busbar_Rinv_summe)
			{endif}
		{endif}
	{endif}

	(L.L.cp_dachluefter_sw)
	(L.L.elec_busbar_main) &&
	(L.L.cp_tetovent_sw) &&
	{if}
	(L.L.cp_dachluefter_RPM) 100 / (S.L.tetoventillator_RPM)
	{else}
	0 (S.L.tetoventillator_RPM)
	{endif}
{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: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:rollo_bal_frame}
	(L.L.cp_rollo_bal_pos) (L.L.cp_rollo_bal_rastpos) max (S.L.cp_rollo_bal_rastpos)

	(L.L.cp_rollo_bal_dragged) !
	{if}
		(L.L.cp_rollo_bal_retract)
		{if}
			(L.L.cp_rollo_bal_speed) (L.S.Timegap) (L.L.cp_rollo_bal_pos) 14 * * - (S.L.cp_rollo_bal_speed)
			(L.L.cp_rollo_bal_pos) (L.S.Timegap) (L.L.cp_rollo_bal_speed) * + (S.L.cp_rollo_bal_pos) (S.L.cp_rollo_bal_rastpos)
					
		{else}
			(L.L.cp_rollo_bal_pos) (L.L.cp_rollo_bal_rastpos) < 
			{if}
				(L.L.cp_rollo_bal_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo_bal_speed)
				(L.L.cp_rollo_bal_pos) (L.S.Timegap) (L.L.cp_rollo_bal_speed) * + (L.L.cp_rollo_bal_rastpos) min (S.L.cp_rollo_bal_pos)
			{else}
				0 (S.L.cp_rollo_bal_speed)
			{endif}
		{endif}

		(L.L.cp_rollo_bal_pos) 1 >
		{if}
			1 (S.L.cp_rollo_bal_pos) (S.L.cp_rollo_bal_rastpos)
		{else}
			(L.L.cp_rollo_bal_pos) 0 <
			{if}
			0 (S.L.cp_rollo_bal_pos) (S.L.cp_rollo_bal_retract) (S.L.cp_rollo_bal_rastpos)
			{endif}
		{endif}

	{endif}
	(L.L.cp_rollo_bal_pos) 0.075 <=
	{if}
		(L.L.rollo_bal_1_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_1_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.17 <=
	{if}
		(L.L.rollo_bal_2_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_2_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.262 <=
	{if}
		(L.L.rollo_bal_3_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_3_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.356 <=
	{if}
		(L.L.rollo_bal_4_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_4_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.45 <=
	{if}
		(L.L.rollo_bal_5_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_5_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.543 <=
	{if}
		(L.L.rollo_bal_6_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_6_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.636 <=
	{if}
		(L.L.rollo_bal_7_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_7_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.729 <=
	{if}
		(L.L.rollo_bal_8_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_8_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.822 <=
	{if}
		(L.L.rollo_bal_9_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_9_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_bal_pos) 0.914 <=
	{if}
		(L.L.rollo_bal_10_visibility) 1 =
		{if}
			0 (S.L.rollo_bal_10_visibility)
		{endif}
	{endif}
{end}

{macro:rollo_jobb_frame}
	(L.L.cp_rollo_jobb_pos) (L.L.cp_rollo_jobb_rastpos) max (S.L.cp_rollo_jobb_rastpos)

	(L.L.cp_rollo_jobb_dragged) !
	{if}
		(L.L.cp_rollo_jobb_retract)
		{if}
			(L.L.cp_rollo_jobb_speed) (L.S.Timegap) (L.L.cp_rollo_jobb_pos) 14 * * - (S.L.cp_rollo_jobb_speed)
			(L.L.cp_rollo_jobb_pos) (L.S.Timegap) (L.L.cp_rollo_jobb_speed) * + (S.L.cp_rollo_jobb_pos) (S.L.cp_rollo_jobb_rastpos)
					
		{else}
			(L.L.cp_rollo_jobb_pos) (L.L.cp_rollo_jobb_rastpos) < 
			{if}
				(L.L.cp_rollo_jobb_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo_jobb_speed)
				(L.L.cp_rollo_jobb_pos) (L.S.Timegap) (L.L.cp_rollo_jobb_speed) * + (L.L.cp_rollo_jobb_rastpos) min (S.L.cp_rollo_jobb_pos)
			{else}
				0 (S.L.cp_rollo_jobb_speed)
			{endif}
		{endif}

		(L.L.cp_rollo_jobb_pos) 1 >
		{if}
			1 (S.L.cp_rollo_jobb_pos) (S.L.cp_rollo_jobb_rastpos)
		{else}
			(L.L.cp_rollo_jobb_pos) 0 <
			{if}
			0 (S.L.cp_rollo_jobb_pos) (S.L.cp_rollo_jobb_retract) (S.L.cp_rollo_jobb_rastpos)
			{endif}
		{endif}

	{endif}
	(L.L.cp_rollo_jobb_pos) 0.075 <=
	{if}
		(L.L.rollo_jobb_1_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_1_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.17 <=
	{if}
		(L.L.rollo_jobb_2_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_2_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.262 <=
	{if}
		(L.L.rollo_jobb_3_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_3_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.356 <=
	{if}
		(L.L.rollo_jobb_4_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_4_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.45 <=
	{if}
		(L.L.rollo_jobb_5_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_5_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.543 <=
	{if}
		(L.L.rollo_jobb_6_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_6_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.636 <=
	{if}
		(L.L.rollo_jobb_7_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_7_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.729 <=
	{if}
		(L.L.rollo_jobb_8_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_8_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.822 <=
	{if}
		(L.L.rollo_jobb_9_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_9_visibility)
		{endif}
	{endif}
	(L.L.cp_rollo_jobb_pos) 0.914 <=
	{if}
		(L.L.rollo_jobb_10_visibility) 1 =
		{if}
			0 (S.L.rollo_jobb_10_visibility)
		{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:kulcs_frame}
	(L.L.cp_kulcs_sw)
	(L.L.cp_fokapcsolo_sw) &&
	{if}
	1 (S.L.elec_busbar_main_sw)
	{else}
	0 (S.L.elec_busbar_main_sw)
	{endif}

	(L.L.cp_kulcs_rot_lastmode) (L.L.cp_kulcs_rot_mode) = !
	{if}
		(T.L.ev_schluessel_dreh)
	{endif}
	(L.L.cp_kulcs_rot_mode) (S.L.cp_kulcs_rot_lastmode)
{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:dachluke_pos_rot}
	l0 0.5 <=
	{if}
		0 s1 s2
		(T.L.ev_dachluke_close)
	{else}
	l0 1.5 <=
	{if}
		0.5 s1
		1 s2
		(T.L.ev_dachluke_open)
	{else}
	l0 2.5 <=
	{if}
		1 s1
		0 s2
		(T.L.ev_dachluke_change)
	{else}
		0.5 s1
		-1 s2
		(T.L.ev_dachluke_change)
	{endif}
	{endif}
	{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)
{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}