'##############
'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
' modified for Hamburg addon Darius Bode 2012
' modified for VDV-cockpit Darius Bode 2013

'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:vdv_hatch1_L}

	1 (S.L.vdv_hatch1_sw)		
	(T.L.ev_wippschaltereinsound)
	
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.S.PrecipRate) 0.4 < &&
		{if}
			0 (S.L.vdv_hatch1_set)
		{endif}

{end}

{trigger:vdv_hatch1_L_off}

	0 (S.L.vdv_hatch1_sw)
	(T.L.ev_wippschalteraussound)
	
{end}


{trigger:vdv_hatch1_U}
		
	-1 (S.L.vdv_hatch1_sw)		
	(T.L.ev_wippschaltereinsound)

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.S.PrecipRate) 0.4 < &&
		{if}
			(L.L.vdv_hatch1_set) s0 
			l0 0 <= {if} 1 s1 {endif}
			l0 -1 = {if} 1 s1 {endif}
			l0 2 = {if} -1 s1 {endif}
			l0 1 = {if} 2 s1 {endif}
			l1 (S.L.vdv_hatch1_set)
		{endif}
{end}

{trigger:vdv_hatch1_U_off}

	0 (S.L.vdv_hatch1_sw)
	(T.L.ev_wippschalteraussound)
	
{end}




{trigger:vdv_hatch2_L}

	1 (S.L.vdv_hatch2_sw)		
	(T.L.ev_wippschaltereinsound)
	
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.S.PrecipRate) 0.4 < &&
		{if}
			0 (S.L.vdv_hatch2_set)
		{endif}

{end}

{trigger:vdv_hatch2_L_off}

	0 (S.L.vdv_hatch2_sw)
	(T.L.ev_wippschalteraussound)
	
{end}


{trigger:vdv_hatch2_U}
		
	-1 (S.L.vdv_hatch2_sw)		
	(T.L.ev_wippschaltereinsound)

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.S.PrecipRate) 0.4 < &&
		{if}
			(L.L.vdv_hatch2_set) s0 
			l0 0 <= {if} 1 s1 {endif}
			l0 -1 = {if} 1 s1 {endif}
			l0 2 = {if} -1 s1 {endif}
			l0 1 = {if} 2 s1 {endif}
			l1 (S.L.vdv_hatch2_set)
		{endif}
{end}

{trigger:vdv_hatch2_U_off}

	0 (S.L.vdv_hatch2_sw)
	(T.L.ev_wippschalteraussound)
	
{end}



{trigger:automatic_R}
	
		(L.L.antrieb_getr_gangvorwahl) 1 <= 
		{if}
			(L.L.antrieb_getr_gangvorwahl) 0 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			
			0 (S.L.antrieb_getr_gangvorwahl) (S.L.cockpit_gangN)
			-1 (S.L.cockpit_gang_sw)
			1 (S.L.cockpit_gangR)
		{endif}

{end}

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


{trigger:automatic_N}
	
	(L.L.antrieb_getr_gangvorwahl) 1 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) -  - (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
		1 (S.L.antrieb_getr_gangvorwahl) (S.L.cockpit_gangN)
		0 (S.L.cockpit_gangR) (S.L.cockpit_gangD) (S.L.cockpit_gang_sw)

{end}

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

{trigger:automatic_D}
	(L.L.cockpit_gang_sw) 4 = !
	(L.L.cockpit_gang_sw) -1 = ! &&
		{if}
			(T.L.ev_gangwahltaster)
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			4 (S.L.cockpit_gang_sw)
			5 (S.L.antrieb_getr_gangvorwahl)		
			1 (S.L.cockpit_gangD)
			0 (S.L.cockpit_gangN)	
	{endif}
{end}

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



{trigger:klappsitzR}
	(L.L.klappsitzR_pax) !
	{if}
	(L.L.klappsitzR) ! (S.L.klappsitzR)	
	{if} (T.L.ev_klappsitz_runter) {else} (T.L.ev_klappsitz_hoch) {endif}
	{endif}
{end}

{trigger:klappsitzL}
	(L.L.klappsitzL_pax) !
	{if}
	(L.L.klappsitzL) ! (S.L.klappsitzL)	
	{if} (T.L.ev_klappsitz_runter) {else} (T.L.ev_klappsitz_hoch) {endif}
	{endif}
{end}

{trigger:klappsitz3}
	(L.L.klappsitz3_pax) !
	{if}
	(L.L.klappsitz3) ! (S.L.klappsitz3)	
	{if} (T.L.ev_klappsitz_runter) {else} (T.L.ev_klappsitz_hoch) {endif}
	{endif}
{end}

{trigger:seat_armlehneL}
	(L.L.seat_armlehneL) ! (S.L.seat_armlehneL)	
{end}

{trigger:seat_armlehneR}
	(L.L.seat_armlehneR) ! (S.L.seat_armlehneR)	
{end}

{trigger:seat_armlehneL}
	(L.L.seat_armlehneL) ! (S.L.seat_armlehneL)	
{end}

{trigger:seat_armlehneR}
	(L.L.seat_armlehneR) ! (S.L.seat_armlehneR)	
{end}

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

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

' Wippschalter Saegezahnlicht ------------------------------------------------------------------------------

{trigger:cp_saegezahn_licht}
	(L.L.cp_saegezahn_licht) ! (S.L.cp_saegezahn_licht)
	{if}
		(M.L.wippschaltereinsound)	
	{else}
		(M.L.wippschalteraussound)		
	{endif}
	
{end}


' Wippschalter Dieselpartikelfilter ------------------------------------------------------------------------------

{trigger:c2_sw_dpf_U}
	1 (S.L.c2_sw_dpf_set)
	-1 (S.L.c2_sw_dpf)	
	(M.L.wippschaltereinsound)	
{end}

{trigger:c2_sw_dpf_U_off}
	0 (S.L.c2_sw_dpf) 	
	(M.L.wippschalteraussound)	
{end}

{trigger:c2_sw_dpf_L}
	0 (S.L.c2_sw_dpf_set)	
	1 (S.L.c2_sw_dpf)
	(M.L.wippschaltereinsound)	
{end}

{trigger:c2_sw_dpf_L_off}
	0  (S.L.c2_sw_dpf) 	
	(M.L.wippschalteraussound)	
{end}



{trigger:vdv_radio_sw}
	
	(L.L.elec_busbar_main_sw)
		{if}
			(L.L.vdv_radio) ! s0 (S.L.vdv_radio)
		{endif}
		
	(T.L.ev_vdv_radio)		
		
{end}

{trigger:cp_mikrofon}
	(L.L.cp_mikrofon) ! (S.L.cp_mikrofon)
{end}

{trigger:cp_notloese_kneeling}
	(L.L.elec_busbar_main_sw)
		{if}
			(L.L.cp_notloese_kneeling) ! (S.L.cp_notloese_kneeling)
		{endif}
	1 (S.L.cp_notloese_kneeling_sw)
	(M.L.wippschaltereinsound)	
{end}

{trigger:cp_notloese_kneeling_off}
	0 (S.L.cp_notloese_kneeling_sw)
	(M.L.wippschalteraussound)	
{end}


{trigger:cp_tuertot}
	1 (S.L.cp_tuertot_sw)
	(L.L.elec_busbar_main_sw)
		{if}
			(L.L.doorEntriegelung_01_aussen)
			(L.L.doorEntriegelung_23_aussen) +
			(L.L.doorEntriegelung_45_aussen) +
			(L.L.doorEntriegelung_67_aussen) +
			(L.L.doorEntriegelung_89_aussen) +
			0 >
				{if}
					(T.L.ev_tuertot_an)	
					0 (S.L.doorEntriegelung_01_aussen) (S.L.doorEntriegelung_23_aussen) (S.L.doorEntriegelung_45_aussen) (S.L.doorEntriegelung_67_aussen) (S.L.doorEntriegelung_89_aussen)
				{else}
					(L.L.doorEntriegelung_aussen_tot) !			
						{if}
							(T.L.ev_tuertot_an)
							1 (S.L.doorEntriegelung_aussen_tot)
						{else}
							(T.L.ev_tuertot_aus)
							0 (S.L.doorEntriegelung_aussen_tot) (S.L.doorEntriegelung_aussen_tot_timer)
						{endif}	
				{endif}				
		{endif}
		
	(M.L.wippschaltereinsound)	
{end}

{trigger:cp_tuertot_off}
	0 (S.L.cp_tuertot_sw)
	(M.L.wippschalteraussound)
{end}

{trigger:kw_wipermode_up}

	1 (S.L.cp_wischersw_change)
	
{end}


{trigger:cp_wiper_turnswitch_drag}

		(L.S.mouse_y) -50 / (L.L.cockpit_wischer_drehschalter) + 0 max 1 min (S.L.cockpit_wischer_drehschalter) s0
	
'		Stufen:
'		0: Intervall
'		1: Aus
'		2: Langsam
'		3: Schnell

		l0 0.15 <
		{if}
			0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_intervall2_sw)
			0 (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)	
			(L.L.cockpit_wischer_drehschalter_mode) 0 = !
				 {if}
					(T.L.ev_wischerdrehschalter_dreh)	
					0 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischer_drehschalter_lastmode)
				 {endif}
			
		{else} 
			l0 0.35 <
			{if}
				0 (S.L.cp_wischer_intervall2_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
				(L.L.cockpit_wischer_drehschalter_mode) s0 0 = {if} 0 (S.L.cockpit_wischer_drehschalter_lastmode) (T.L.ev_wischerdrehschalter_dreh) {else} l0 2 = {if} 2 (S.L.cockpit_wischer_drehschalter_lastmode) (T.L.ev_wischerdrehschalter_dreh) {endif} {endif}
				1 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cp_wischer_intervall_sw)	 			
			{else}
				l0 0.55 <
					{if}
						1 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_intervall2_sw) 
						0 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
						(L.L.cockpit_wischer_drehschalter_mode) s0 1 = {if} 1 (S.L.cockpit_wischer_drehschalter_lastmode) (T.L.ev_wischerdrehschalter_dreh) {else} l0 3 = {if} 3 (S.L.cockpit_wischer_drehschalter_lastmode) (T.L.ev_wischerdrehschalter_dreh) {endif} {endif}
						2 (S.L.cockpit_wischer_drehschalter_mode)				
					{else}
						l0 0.83 <
						{if}
							(L.L.cockpit_wischer_drehschalter_mode) s0 4 = {if} 4 (S.L.cockpit_wischer_drehschalter_lastmode) (T.L.ev_wischerdrehschalter_dreh) {else} l0 2 = {if} 2 (S.L.cockpit_wischer_drehschalter_lastmode) (T.L.ev_wischerdrehschalter_dreh) {endif} {endif}
							3 (S.L.cockpit_wischer_drehschalter_mode)
							1 (S.L.cp_wischer_einaus_sw)
							0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_intervall2_sw) (S.L.cp_wischer_schnell_sw)
						{else}
							(L.L.cockpit_wischer_drehschalter_mode) s0 3 = {if} (T.L.ev_wischerdrehschalter_dreh) 3 (S.L.cockpit_wischer_drehschalter_lastmode) {endif}
							4 (S.L.cockpit_wischer_drehschalter_mode)
							1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
							0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_intervall2_sw)
						{endif}
				{endif}
			{endif}
		{endif}

{end}

{trigger:cp_wiper_turnswitch_off}

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

{trigger:cp_rollo2_drag}

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

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


' Sonnenblende

{trigger:cp_blende_opn_drag}

	(L.L.cp_blende_pos) (S.L.cp_blende_lastpos)

	(L.S.mouse_x) 400 / (L.L.cp_blende_pos) + (S.L.cp_blende_pos) s0
	l0 0 <
	{if}
		0 (S.L.cp_blende_pos)
		(L.L.cp_blende_endanschlag) !
		{if}
			(T.L.ev_blende_cls)
		{endif}
		1 (S.L.cp_blende_endanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.cp_blende_pos)
		(L.L.cp_blende_endanschlag) !
		{if}
			(T.L.ev_blende_opn)
		{endif}
		1 (S.L.cp_blende_endanschlag)
	{endif}

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


	(L.L.cp_blende_pos) (L.L.cp_blende_lastpos) - abs (L.S.Timegap) / (S.L.cp_blende_speed)
{end}


' Verstellung Armaturenbrett

{trigger:vdv_verstellbar_sw}

	(L.L.vdv_verstellbar_sw) ! (S.L.vdv_verstellbar_sw)
	{if} (T.L.ev_wippschaltereinsound) {else} (T.L.ev_wippschalteraussound) {endif}
		
{end}



{trigger:vdv_move_drag}

(L.L.vdv_verstellbar)
{if}
	(L.S.mouse_y) -300 / (L.L.vdv_move_y) + (S.L.vdv_move_y) s0
	l0 -1 <
	{if}
		-1 (S.L.vdv_move_y)
		(L.L.vdv_move_yendanschlag) !
		{if}
			(T.L.vdv_move_up)
		{endif}
		1 (S.L.vdv_move_yendanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.vdv_move_y)
		(L.L.vdv_move_yendanschlag) !
		{if}
			(T.L.vdv_move_down)
		{endif}
		1 (S.L.vdv_move_yendanschlag)
	{endif}

	(L.L.vdv_move_y) s0 -1 > l0 1 < &&
	{if}
		0 (S.L.vdv_move_yendanschlag)
	{endif}
	
	(L.S.mouse_x) 400 / (L.L.vdv_move_x) + (S.L.vdv_move_x) s0
	l0 -1 <
	{if}
		-1 (S.L.vdv_move_x)
		(L.L.vdv_move_xendanschlag) !
		{if}
			(T.L.vdv_move_up)
		{endif}
		1 (S.L.vdv_move_xendanschlag)
		
	{endif}
	l0 1 >
	{if}
		1 (S.L.vdv_move_x)
		(L.L.vdv_move_xendanschlag) !
		{if}
			(T.L.vdv_move_down)
		{endif}
		1 (S.L.vdv_move_xendanschlag)
	{endif}

	(L.L.vdv_move_x) s0 -1 > l0 1 < &&
	{if}
		0 (S.L.vdv_move_xendanschlag)
	{endif}
	
{endif}
{end}



' Lichtdrehschalter

{trigger:cp_lichtschalter_mov_drag}

(L.S.mouse_y) abs (L.S.mouse_x) abs  > 
	
	{if}
	
'	Translation
		(L.S.mouse_y) 150 / (L.L.vdv_lichtschalter_trans) + 0 max 1 min (S.L.vdv_lichtschalter_trans) s0
				
				l0 0.25 <
					{if}
						(L.L.vdv_lichtschalter_trans_mode) 0 > {if} (T.L.ev_lichtdrehschalter_zieh) {endif}
						0 (S.L.vdv_lichtschalter_trans_mode) (S.L.cp_nebel_targeton) (S.L.cp_taster_nebelschluss_target)					
					{endif}
				
				l0 0.25 >= l0 0.75 < &&
					{if}
						(L.L.vdv_lichtschalter_trans_mode) 0.5 = ! {if} (T.L.ev_lichtdrehschalter_zieh) {endif}
						0 (S.L.cp_taster_nebelschluss_target)
						0.5 (S.L.vdv_lichtschalter_trans_mode)
						1 (S.L.cp_nebel_targeton)
					{endif}
					
				l0 0.75 >
					{if}
						(L.L.vdv_lichtschalter_trans_mode) 1 < {if} (T.L.ev_lichtdrehschalter_zieh) {endif}
						1 (S.L.vdv_lichtschalter_trans_mode) (S.L.cp_nebel_targeton) (S.L.cp_taster_nebelschluss_target)
					{endif}	
				
		
	{else}
	
'	Rotation		
		(L.S.mouse_x) 70 / (L.L.vdv_lichtschalter_rot) + 0 max 1 min (S.L.vdv_lichtschalter_rot) s0
				
				l0 0.25 <
					{if}
						(L.L.lights_mode) 0 = !
							{if}
								(T.L.ev_lichtdrehschalter_aus)	
							{endif}
						0 (S.L.vdv_lichtschalter_rot_mode) (S.L.lights_mode)					
					{endif}
				
				l0 0.25 >= l0 0.75 < &&
					{if}
						(L.L.lights_mode) 1 = !
							{if}
								(T.L.ev_lichtdrehschalter_dreh)	
							{endif}	
						0.5 (S.L.vdv_lichtschalter_rot_mode) 
						1 (S.L.lights_mode)							
					{endif}
					
				l0 0.75 >
					{if}
						(L.L.lights_mode) 2 = !
							{if}
								(T.L.ev_lichtdrehschalter_an)	
							{endif}	
						1 (S.L.vdv_lichtschalter_rot_mode) 
						2 (S.L.lights_mode)							
					{endif}	
	{endif}	
{end}

{trigger:cp_lichtschalter_mov_drag_off}
' 	Einrasten
	(L.L.vdv_lichtschalter_trans_mode)  (S.L.vdv_lichtschalter_trans)
	(L.L.vdv_lichtschalter_rot_mode)  (S.L.vdv_lichtschalter_rot)
{end}


' Zuendschluessel

{trigger:cp_schluessel_mov_drag}

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

'		Zunächst Translation (Einstecken)
		(L.L.cp_schluessel_rot) 0 = 
			{if}
				(L.S.mouse_x) -10 / (L.L.cp_schluessel_trans) + 0 max 1 min (S.L.cp_schluessel_trans) s0
		
				l0 0.5 < 
					{if}			
						0 (S.L.cp_schluessel_trans_mode)			
					{else} 
						1 (S.L.cp_schluessel_trans_mode) 	 
					{endif}
			{endif}
		
	{else}

'		Sonst Rotation
		
		(L.L.cp_schluessel_trans_mode) 1 =
			{if} 
			
				(L.S.mouse_y) -50 / (L.L.cp_schluessel_rot) + 0 max 1 min (S.L.cp_schluessel_rot) 
	
'				Stufen:
'				0: Aus
'				0.33: Elektrik / Motor Stop
'				0.66: Motor an
'				1: Anlasser

				(L.L.cp_schluessel_rot) 0.17 <
				(L.L.cp_schluessel_rot_mode) 0 = ! &&
				(L.L.engine_injection_on) ! &&
					{if}
						0 (S.L.cp_schluessel_rot_mode) (S.L.elec_busbar_main_sw)					
					{endif}
		
				(L.L.cp_schluessel_rot) 0.17 > (L.L.cp_schluessel_rot) 0.48 < && 
				(L.L.cp_schluessel_rot_mode) 0.5 = ! &&
					{if}
						0.33 (S.L.cp_schluessel_rot_mode)
						(L.L.elec_busbar_main_sw) !
							{if}
								(L.L.globaltimer) (S.L.cockpit_schluesselzeit) 
								0 (S.L.cockpit_engineshutdowntime)
								1 (S.L.elec_busbar_main_sw) 1 (S.L.cockpit_relaissound)
							{endif}
					{endif}
		
				(L.L.cp_schluessel_rot) 0.48 >= (L.L.cp_schluessel_rot) 0.88 < &&
				(L.L.cp_schluessel_rot_mode) 0.66 = ! &&
					{if}
						0.66 (S.L.cp_schluessel_rot_mode)	
						(L.L.elec_busbar_main_sw) !
							{if}
								(L.L.globaltimer) (S.L.cockpit_schluesselzeit) 
								0 (S.L.cockpit_engineshutdowntime)
								1 (S.L.elec_busbar_main_sw)
							{endif}					
					{endif}		

				(L.L.cp_schluessel_rot) 0.88 >
				(L.L.cp_schluessel_rot_mode) 1 = ! &&
					{if}
						1 (S.L.cp_schluessel_rot_mode)
						(L.L.elec_busbar_main_sw) !
							{if}
								(L.L.globaltimer) (S.L.cockpit_schluesselzeit) 
								0 (S.L.cockpit_engineshutdowntime)
								1 (S.L.elec_busbar_main_sw)
							{endif}
						(L.L.engine_ignition) 3 =
						(L.L.elec_busbar_avail) &&
						(L.L.engine_ign_failure) ! &&
						(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1.2 + > &&
						(L.L.antrieb_getr_gangvorwahl) 1 = && (L.L.cockpit_gang_sw) 0 = &&
							{if}
								(T.L.ev_enginestart)
								(L.L.globaltimer) (S.L.engine_ignitiontime)  
								1 (S.L.engine_ignition) (S.L.c2klima_fahrgast)  (S.L.c2klima_zusatz)
								(T.L.ev_schluessel_dreh)
							{endif}								
					{endif}	
							
			{endif}
	
	{endif}
	
	(L.L.cp_schluessel_rot_mode) 0.66 <					
	(L.L.engine_on) &&
	(L.L.Velocity) 15 < &&
	(L.L.antrieb_getr_aktugang) 2 < && 
	(L.L.engine_ignition) 0 = &&
		{if}
			2 (S.L.engine_ignition)
			(L.L.globaltimer) (S.L.intlights_counter)
			(T.L.ev_cp_engineoff)
		{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.engine_injection_on) (L.L.engine_stopwait) 0 = &&
		{if}	
			0.66 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot)
		{else}
			(L.L.cp_schluessel_rot) 0.17 >
			{if}
				0.33 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot)
			{else}
				0 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot)
			{endif}
			
			(L.L.engine_ignition) 1 = {if} 3 (S.L.engine_ignition) {endif}
		{endif}
	
	
{end}



'Trigger für Tastaturbedienung:

{trigger:kw_m_enginestart}

	(L.L.cp_schluessel_trans_mode) 1 =
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
		
			(L.L.cp_schluessel_rot_mode) 1 <					
			(L.L.engine_on) &&
			(L.L.Velocity) 15 < &&
			(L.L.antrieb_getr_aktugang) 2 < && 
			(L.L.engine_ignition) 0 = &&
				{if}
					2 (S.L.engine_ignition)
					(T.L.ev_cp_engineoff)
					0.33 (S.L.cp_schluessel_rot) (S.L.cp_schluessel_rot_mode)
					(L.L.globaltimer) (S.L.intlights_counter)
				{endif}	
		
			(L.L.engine_on) !
			(L.L.engine_ignition) 3 = &&
			(L.L.elec_busbar_avail) &&
			(L.L.engine_ign_failure) ! &&
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1.2 + > &&
			(L.L.antrieb_getr_gangvorwahl) 1 = && (L.L.cockpit_gang_sw) 0 = &&
				{if}
					(T.L.ev_enginestart)
					(L.L.globaltimer) (S.L.engine_ignitiontime)  
					1 (S.L.engine_ignition) (S.L.cp_schluessel_rot) (S.L.cp_schluessel_rot_mode) (S.L.c2klima_fahrgast) (S.L.c2klima_zusatz)
					(T.L.ev_schluessel_dreh)
				{endif}		
		{endif}	
		
{end}

{trigger:kw_m_enginestart_off}
	(L.L.cp_schluessel_trans_mode) 1 =
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
	(L.L.elec_busbar_main_sw) &&
		{if}
			(L.L.engine_injection_on) (L.L.engine_stopwait) 0 = &&
				{if}
					0.66 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot) 
				{else}
					0.33 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot)
				{endif}
			(L.L.engine_ignition) 1 = {if} 3 (S.L.engine_ignition) {endif}
		{endif}
{end}

{trigger:cp_batterietrennschalter_toggle}

	(L.L.elec_busbar_main_sw) !
		{if}
			1 (S.L.cp_schluessel_trans_mode) (S.L.cp_schluessel_trans) (S.L.elec_busbar_main_sw) (S.L.cockpit_relaissound)
			0.33 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot)
			(L.L.globaltimer) (S.L.cockpit_schluesselzeit) 
			0 (S.L.cockpit_engineshutdowntime)
		{else}
			(L.L.cp_schluessel_rot_mode) 0.33 <=
			(L.L.engine_injection_on) ! &&
				{if}
					0 (S.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot) (S.L.elec_busbar_main_sw)
				{endif}
		{endif}
	
{end}


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

{trigger:cp_kombiU_toggle}
	(L.L.cp_kombiU_visible) ! (S.L.cp_kombiU_visible)
{end}

{trigger:cp_kombiM_toggle}
	(L.L.cp_kombiM_visible) ! (S.L.cp_kombiM_visible)
{end}

{trigger:cp_kombiL_toggle}
	(L.L.cp_kombiL_visible) ! (S.L.cp_kombiL_visible)
{end}

{trigger:cp_hornU_toggle}
	(L.L.cp_hornU_visible) ! (S.L.cp_hornU_visible)
{end}

{trigger:cp_hornM_toggle}
	(L.L.cp_hornM_visible) ! (S.L.cp_hornM_visible)
{end}

{trigger:cp_hornL_toggle}
	(L.L.cp_hornL_visible) ! (S.L.cp_hornL_visible)
{end}

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

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

{trigger:cp_klappfenster2R}
	(L.L.cp_klappfenster2R) ! (S.L.cp_klappfenster2R) s1
	(M.L.klappfenster2sound)
{end}

{trigger:cp_klappfenster2L}
	(L.L.cp_klappfenster2L) ! (S.L.cp_klappfenster2L) s1
	(M.L.klappfenster2sound)
{end}

{trigger:cp_klappfenster_ht_L}
	(L.L.cp_klappfenster_ht_L) ! (S.L.cp_klappfenster_ht_L) s1
	(M.L.klappfenstersound_ht)
{end}

{trigger:cp_klappfenster_ht_R}
	(L.L.cp_klappfenster_ht_R) ! (S.L.cp_klappfenster_ht_R) s1
	(M.L.klappfenstersound_ht)
{end}

{trigger:cp_wechsler_toggle}
	(L.L.almex_dienst_aktiviert) ! (L.L.almex_pause) ! &&
	(L.L.cp_wechsler_visible) ! ||
		{if}		
			(L.L.cp_wechsler_visible) ! (S.L.cp_wechsler_visible)
			(T.L.ev_wechsler_showhide)
		{endif}
{end}

{trigger:cp_zahltisch_schublade_drag}

  (L.L.almex_pause) ! (L.L.almex_set_entriegelt) && 
	{if}
		(L.S.mouse_x) -200 / (L.L.cp_zahltisch_schublade_pos) +  1 min 0 max (S.L.cp_zahltisch_schublade_pos) 
	{endif}
	
{end}

{trigger:cp_Fahrertuer_drag}

(L.L.cp_fahrertuer_entriegelt)
{if}

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

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

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


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

{trigger:cp_Fahrertuer1_drag}

	1 (S.L.cp_fahrertuer1_dragged)
	(L.L.cp_fahrertuer1_pos) (S.L.cp_fahrertuer1_lastpos)

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

	(L.L.cp_fahrertuer1_pos) (L.L.cp_fahrertuer1_lastpos) - (L.S.Timegap) / (S.L.cp_fahrertuer1_speed)
{end}


{trigger:cp_Fahrertuer1_off}
	0 (S.L.cp_fahrertuer1_dragged)
{end}




{trigger:cp_tacho2_off}
	0 (S.L.cp_tacho2_dragged)
{end}


{trigger:cp_funk_toggle}
	(M.L.wippschaltereinsound)	
	1 (S.L.cp_funk_targeton)	
{end}

{trigger:cp_funk_toggle_off}
	0 (S.L.cp_funk_targeton)	
	(M.L.wippschalteraussound)
{end}

{trigger:cp_video_toggle}
	(M.L.wippschaltereinsound)
	 1 (S.L.cp_video_targeton)	
{end}

{trigger:cp_video_toggle_off}
	(M.L.wippschalteraussound)
	 0 (S.L.cp_video_targeton)	
{end}

{trigger:cp_rollo_wippL}

	(M.L.wippschaltereinsound)
	 1 (S.L.cp_rollo_sw)

{end}

{trigger:cp_rollo_wippL_off}

	(M.L.wippschalteraussound)
	 0 (S.L.cp_rollo_sw)

{end}

{trigger:cp_rollo_wippU}

	(M.L.wippschaltereinsound)
	-1 (S.L.cp_rollo_sw)

{end}

{trigger:cp_rollo_wippU_off}

	(M.L.wippschalteraussound)
	 0 (S.L.cp_rollo_sw)

{end}

{trigger:cp_schiebefenster_wippL}
	(M.L.wippschaltereinsound)
	 1 (S.L.cp_schiebefenster_sw)	
{end}

{trigger:cp_schiebefenster_wippL_off}
	(M.L.wippschalteraussound)
	 0 (S.L.cp_schiebefenster_sw)	
{end}

{trigger:cp_schiebefenster_wippU}
	(M.L.wippschaltereinsound)
	 -1 (S.L.cp_schiebefenster_sw)	
{end}

{trigger:cp_schiebefenster_wippU_off}
	(M.L.wippschalteraussound)
	 0 (S.L.cp_schiebefenster_sw)	
{end}

{trigger:cp_lautstaerke_wippL}
	(M.L.wippschaltereinsound)
	 1 (S.L.cp_lautstaerke_sw)	
{end}

{trigger:cp_lautstaerke_wippU}
	(M.L.wippschaltereinsound)
	 -1 (S.L.cp_lautstaerke_sw)	
{end}

{trigger:cp_haus_sw}
	(M.L.wippschaltereinsound)
	 1 (S.L.cp_haus_sw)	
	 
	(L.L.c2_display_an) 
	(L.L.c2_display_rot) ! &&
	(L.L.c2_display_seq) ! &&
	(L.L.c2_display_menu) 2 = ! &&
	(L.L.c2_display_menu) 1 = ! &&
		{if}
			1 (S.L.c2_display_menu) 0 (S.L.c2_display_haltemenu_override)									
		{endif}	
{end}

{trigger:cp_haus_sw_off}
	(M.L.wippschalteraussound)
	 0 (S.L.cp_haus_sw)	
{end}

{trigger:cp_locksingledoor_wippL}

	(L.L.cp_locksingledoor_sw) 0 =
		{if}
			1 (S.L.cp_locksingledoor_sw)
			(M.L.wippschaltereinsound)
		{endif}
	
	(L.L.cp_locksingledoor_sw) -1 =
		{if}
			0 (S.L.cp_locksingledoor_sw)			
			(M.L.wippschalteraussound)
		{endif}		
			
{end}

{trigger:cp_locksingledoor_wippU}

	(L.L.cp_locksingledoor_sw) 0 =
		{if}
			-1 (S.L.cp_locksingledoor_sw)
			(M.L.wippschaltereinsound)
		{endif}
	
	(L.L.cp_locksingledoor_sw) 1 =
		{if}
			0 (S.L.cp_locksingledoor_sw)			
			(M.L.wippschalteraussound)
		{endif}		
			
{end}

{trigger:cp_lockdoors_toggle}
	
	(L.L.cp_lockdoors_targeton)
		0 =
			{if} 
				1 (S.L.cp_lockdoors_targeton) (M.L.wippschaltereinsound)
			{else} 
				0 (S.L.cp_lockdoors_targeton) (M.L.wippschalteraussound)			
			{endif}	
		
{end}

{trigger:cp_fahrertuer_toggle}
	1 (S.L.cp_fahrertuer_sw)
	(M.L.wippschaltereinsound)
{end}

{trigger:cp_fahrertuer_toggle_off}
	0 (S.L.cp_fahrertuer_sw)
	(M.L.wippschalteraussound)	
{end}

{trigger:cp_kinderwagen_toggleon}

	(M.L.wippschaltereinsound)

	(L.L.door_kinderwagenwunsch) (L.L.door_kinderwagen) (L.L.door_kinderwagenwunsch2) (L.L.door_kinderwagen2) || ||	||
	
		{if}		
			-1 (S.L.cp_kinderwagen_targeton)			
			
			(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
				{if}
					0 (S.L.door_kinderwagenwunsch) (S.L.door_kinderwagen) (S.L.door_kinderwagen2) (S.L.door_kinderwagenwunsch2)
				{endif}
				
		{else}		
			1 (S.L.cp_kinderwagen_targeton)
			
			(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
				{if}
					1 (S.L.door_kinderwagenwunsch) (S.L.door_kinderwagen) (S.L.door_kinderwagen2)  (S.L.door_kinderwagenwunsch2)
				{endif}
				
		{endif}	
		
{end}	

{trigger:cp_kinderwagen_toggleon_off}

	(M.L.wippschalteraussound)		
	0 (S.L.cp_kinderwagen_targeton)
	
{end}	

	

{trigger:cp_stopbrake_toggle}
	(L.L.cp_stopbrake_targeton) 0 = 	
	 {if} 
	  (M.L.wippschaltereinsound)
     {else}
      (M.L.wippschalteraussound) 
	 {endif}
	(L.L.cp_stopbrake_targeton) ! (S.L.cp_stopbrake_targeton) (S.L.bremse_halte_sw)
{end}



{trigger:vdv_sw_tuerfreigabe}
	(L.L.vdv_sw_tuerfreigabe) 0 =
	{if}
		(M.L.wippschaltereinsound)
		1 (S.L.vdv_sw_tuerfreigabe)

		(L.L.elec_busbar_main)
		(L.L.Velocity) (C.L.doors_maxvspeed) < &&
			{if}
				1 (S.L.door_freigabe)
			{endif}
	{else}
		(M.L.wippschalteraussound)	
		0 (S.L.vdv_sw_tuerfreigabe)	(S.L.door_freigabe)
	{endif}
{end}


{trigger:vdv_sw_schulbetrieb}		
		
	(L.L.vdv_sw_schulbetrieb) ! (S.L.vdv_sw_schulbetrieb) 
	{if}
		(M.L.wippschaltereinsound)
	{else}
		(M.L.wippschalteraussound)
	{endif}
		 
{end}


{trigger:vdv_sw_klingel}		
		
	(L.L.vdv_sw_klingel) ! (S.L.vdv_sw_klingel) 
	{if}
		(M.L.wippschaltereinsound)
	{else}
		(M.L.wippschalteraussound)
	{endif}
		 
{end}

{trigger:cp_fahrerlicht_toggle}

	(L.L.cp_intlightsdriver_targeton) ! s0
	(S.L.cp_intlightsdriver_targeton)
	
	l0 1 = {if} (M.L.wippschaltereinsound) {else} (M.L.wippschalteraussound) {endif}

	
{end}

{trigger:cp_innenlicht_swL}	
	
	(L.L.cp_intlights_targeton) s0
	
	l0 1 = 
		{if}
			0 (S.L.cp_intlights_1) (S.L.cp_intlights_2) (S.L.cp_intlights_targeton)
			(M.L.wippschalteraussound)	
		{endif}	
	
	l0 -1 = 
		{if}
			0 (S.L.cp_intlights_1) (S.L.cp_intlights_2) (S.L.cp_intlights_targeton)
			(M.L.wippschalteraussound)	
		{endif}

	l0 0 = 
		{if}
			-1 (S.L.cp_intlights_targeton) 
			1 (S.L.cp_intlights_2) 
			(M.L.wippschaltereinsound)	
		{endif}

{end}

{trigger:cp_innenlicht_swU}	
	
	(L.L.cp_intlights_targeton) s0
	
	l0 -1 = 
		{if}
			0 (S.L.cp_intlights_1) (S.L.cp_intlights_2) (S.L.cp_intlights_targeton)
			(M.L.wippschalteraussound)	
		{endif}	
	
	l0 1 = 
		{if}
			0 (S.L.cp_intlights_1) (S.L.cp_intlights_2) (S.L.cp_intlights_targeton)
			(M.L.wippschalteraussound)	
		{endif}

	l0 0 = 
		{if}				
			1 (S.L.cp_intlights_1) (S.L.cp_intlights_targeton) 
			0 (S.L.cp_intlights_2) 
			(M.L.wippschaltereinsound)
		{endif}

{end}

{trigger:vdv_niveau_swL}
	0 (S.L.niveau_setlevel_dir)
	1 (S.L.cp_airride_targeton)
	(M.L.wippschaltereinsound)
{end}

{trigger:vdv_niveau_swL_off}
	0 (S.L.cp_airride_targeton)
	(M.L.wippschalteraussound)
{end}

{trigger:vdv_niveau_swU}
	1 (S.L.niveau_setlevel_dir)
	-1 (S.L.cp_airride_targeton)
	(M.L.wippschaltereinsound)
{end}

{trigger:vdv_niveau_swU_off}
	0 (S.L.cp_airride_targeton)
	(M.L.wippschalteraussound)
{end}

{trigger:cp_licht_untenrechts_toggle}	

	(L.L.cp_intlights_targeton) s0
	
	l0 0 =
		{if}
			 1 (S.L.cp_intlights_targeton)
			 1 (S.L.cp_intlights_1)
			 0 (S.L.cp_intlights_2)
			 (M.L.wippschalteraussound)
		{endif}
		
	l0 1 =
		{if}
			0 (S.L.cp_intlights_1) (S.L.cp_intlights_2) (S.L.cp_intlights_targeton)
			(M.L.wippschalteraussound)
		{endif}

{end}


{trigger:cp_licht_oberdeck_toggle}
	(L.L.cp_intlights_targeton) s0
	
	l0 -1 >
		{if}
			 -1 (S.L.cp_intlights_targeton)
			 1 (S.L.cp_intlights_2)
			 (M.L.wippschaltereinsound) 	
		{endif}
		
	l0 -1 =
		{if}
			0 (S.L.cp_intlights_1) (S.L.cp_intlights_2) (S.L.cp_intlights_targeton)
			(M.L.wippschalteraussound)
		{endif}	
{end}

{trigger:cp_asroffsw_toggle}
	(L.L.cp_asroffsw_targeton) 0 = 	
	{if}
		(M.L.wippschaltereinsound)		
	{else}
		(M.L.wippschalteraussound)		
	{endif}
	(L.L.cp_asroffsw_targeton) ! (S.L.cp_asroffsw_targeton)
{end}

{trigger:cp_nebel_toggleon}
	(L.L.cp_nebel_targeton) 0 =
	{if}
		(M.L.wippschaltereinsound)
	{endif}
	1 (S.L.cp_nebel_targeton)		
		
{end}

{trigger:cp_nebel_toggleoff}
	(L.L.cp_nebel_targeton) 1 =
	{if}
		(M.L.wippschalteraussound)
	{endif}
	(L.L.cp_nebel_targetoff) 
	0 (S.L.cp_nebel_targeton)	
		
{end}

{trigger:notloese_anfahrsperre}	
	(L.L.cp_notloese_anfahrsperre) ! (S.L.cp_notloese_anfahrsperre) 
	(L.L.cp_notloese_anfahrsperre) 
		{if} 	
			0 (S.L.bremse_anfahrsperre) (S.L.bremse_halte) (S.L.bremse_halte_sw) 
		{endif}		
	(M.L.wippschaltereinsound)	
	{endif}	
{end}

{trigger:notloese_EMR}
	(L.L.cp_notloese_EMR) ! (S.L.cp_notloese_EMR)
	(M.L.wippschaltereinsound)	
	{endif}
{end}


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

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

{trigger:cp_radiopedal}
	1 (S.L.cp_radiopedal_sw)	
	(T.L.ev_wippschaltereinsound)
{end}

{trigger:cp_radiopedal_off}
	0 (S.L.cp_radiopedal_sw)
	(T.L.ev_wippschalteraussound)
{end}


'Verstellung der Luftdüsen

{trigger:cp_luefterR_drag}		
		(L.L.cp_luefterR_rot) (L.S.mouse_x) 800 / + (S.L.cp_luefterR_rot)
		(L.L.cp_luefterR_klapp) (L.S.mouse_y) -60 / + s0
			l0 0 > l0 1 < && 
				{if} 
					l0 (S.L.cp_luefterR_klapp) 
				{endif}			
{end}

{trigger:cp_luefterL_drag}		
		(L.L.cp_luefterL_rot) (L.S.mouse_x) 800 / + (S.L.cp_luefterL_rot)
		(L.L.cp_luefterL_klapp) (L.S.mouse_y) -60 / + s0
			l0 0 > l0 1 < && 
				{if} 
					l0 (S.L.cp_luefterL_klapp) 
				{endif}			
{end}

{trigger:vdv_niveau_toggle}
	(L.L.niveau_setlevel_dir) ! (S.L.niveau_setlevel_dir)
	1 (S.L.cp_airride_targeton)
	(M.L.wippschaltereinsound)	
{end}	

{trigger:vdv_niveau_toggle_off}    
	0 (S.L.cp_airride_targeton) 	
	(M.L.wippschalteraussound)
{end}	


{trigger:timetable_hide}
		(L.L.timetable_hide) ! (S.L.timetable_hide)
{end}


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

{macro:cockpit_init}
	0 (S.L.cockpit_hupe_volume) (S.L.door_handsteuerung) (S.L.cockpit_gang_sw) (S.L.cockpit_wischer_drehschalter)
	1 (S.L.cp_lenkrad_visible) (S.L.seat_springfactor) (S.L.mt_ruhezeit) (S.L.trans_dauer)
	-0.22 (S.L.vdv_move_x) 0.40 (S.L.vdv_move_y)
	0.7 (S.L.cockpit_gangN) (S.L.seat_height_setting)
	-1 (S.L.cp_lautstaerke_sw)
	(C.L.cockpit_zentralschmierung_dist) random (S.L.cp_zentralschmierung_nextkm)

{end}

'----------------------
'	Frame
'----------------------
{macro:cockpit_frame}


' 	Timer fuer alle zeitbezogenen Bedingungen
	(L.L.globaltimer) (L.S.Timegap) + (S.L.globaltimer)
	
'	Uebertragen der Schalterstellungen:

	(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.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.blinkerhebel_frame)
	(M.L.wischerhebel_frame)
	(M.L.wischer_drehschalter_frame)
	(M.L.cockpitlights_frame)
	(M.L.schluessel_frame)
	(M.L.fahrertuer_frame) 
	(M.L.fahrertuer1_frame) 
	(M.L.kombi_frame)
	(M.L.horn_frame)
	(M.L.microphone_frame)
	(M.L.zentralschmierung_frame)
	(M.L.Fahrgastpendel)
	(M.L.fahrersitz)
	(M.L.oeldruck_frame)
	(M.L.tankuhr_frame)
	(M.L.phys_animation)
	(M.L.c2_display)
	(M.L.mt_tachograph)
	
'	Elektr. Schiebefenster
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
	(L.L.elec_failure_general) ! &&
		{if}	
		 (L.L.cp_schiebefenster_sw) 0 >
			{if}			
				 (L.L.cp_fahrerfenster_pos) 0 <=	
					{if}
						(T.L.ev_fahrerfenster_auf_anfang)
					{endif}
					
				 (L.L.cp_fahrerfenster_pos) 1 >= (L.L.cp_fahrerfenster_mov_auf)	&&
					{if}
						(T.L.ev_fahrerfenster_auf_ende)
					{endif}
					
				 (L.L.cp_fahrerfenster_pos) 1 <
					{if}
						1 (S.L.cp_fahrerfenster_mov_auf)
					{else}
						0 (S.L.cp_fahrerfenster_mov_auf)
					{endif}	
					
				(L.L.cp_fahrerfenster_pos) (L.L.cp_schiebefenster_sw) 100 / + 1 min (S.L.cp_fahrerfenster_pos)
									
			{endif}		
			
		(L.L.cp_schiebefenster_sw) 0 <
			{if}	 			
				 (L.L.cp_fahrerfenster_pos) 1 >=	
					{if}
						(T.L.ev_fahrerfenster_zu_anfang)
					{endif}
					
				 (L.L.cp_fahrerfenster_pos) 0 <= (L.L.cp_fahrerfenster_mov_zu) &&
					{if}
						(T.L.ev_fahrerfenster_zu_ende)
					{endif}
					
				 (L.L.cp_fahrerfenster_pos) 0 >
					{if}
						1 (S.L.cp_fahrerfenster_mov_zu)
					{else}
						0 (S.L.cp_fahrerfenster_mov_zu)
					{endif}	
			
				(L.L.cp_fahrerfenster_pos) (L.L.cp_schiebefenster_sw) 100 / + 0 max (S.L.cp_fahrerfenster_pos)
	
			{endif}
			
		(L.L.cp_schiebefenster_sw) 0 =
			{if}			
				0 (S.L.cp_fahrerfenster_mov_zu) (S.L.cp_fahrerfenster_mov_auf)				
			{endif}
		
		{else}
			0 (S.L.cp_fahrerfenster_mov_zu) (S.L.cp_fahrerfenster_mov_auf)
		{endif}	
		
'	Elektr. Sonnenrollo

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
	(L.L.elec_failure_general) ! &&
		{if}	
		 (L.L.cp_rollo_sw) 0 >
			{if}			
				 (L.L.cp_rollo_pos) 0 <=	
					{if}
						(T.L.ev_rollo_auf_anfang)
					{endif}
					
				 (L.L.cp_rollo_pos) 1 >= (L.L.cp_rollo_mov_auf)	&&
					{if}
						(T.L.ev_rollo_auf_ende)
					{endif}
					
				 (L.L.cp_rollo_pos) 1 <
					{if}
						1 (S.L.cp_rollo_mov_auf)
					{else}
						0 (S.L.cp_rollo_mov_auf)
					{endif}	
					
				(L.L.cp_rollo_pos) (L.L.cp_rollo_sw) 75 / + 1 min (S.L.cp_rollo_pos)
									
			{endif}		
			
		(L.L.cp_rollo_sw) 0 <
			{if}	 			
				 (L.L.cp_rollo_pos) 1 >=	
					{if}
						(T.L.ev_rollo_zu_anfang)
					{endif}
					
				 (L.L.cp_rollo_pos) 0 <= (L.L.cp_rollo_mov_zu) &&
					{if}
						(T.L.ev_rollo_zu_ende)
					{endif}
					
				 (L.L.cp_rollo_pos) 0 >
					{if}
						1 (S.L.cp_rollo_mov_zu)
					{else}
						0 (S.L.cp_rollo_mov_zu)
					{endif}	
			
				(L.L.cp_rollo_pos) (L.L.cp_rollo_sw) 75 / + 0 max (S.L.cp_rollo_pos)
	
			{endif}
			
		(L.L.cp_rollo_sw) 0 =
			{if}			
				0 (S.L.cp_rollo_mov_zu) (S.L.cp_rollo_mov_auf)				
			{endif}
		
		{else}
			0 (S.L.cp_rollo_mov_zu) (S.L.cp_rollo_mov_auf)
		{endif}				
	
'	Magnetentriegelung Fahrertür
	(L.L.cp_fahrertuer_sw) 
	(L.L.cp_fahrertuer_pos) 0 > (L.L.cp_fahrertuer_pos) 0.07 <= && || 
	(L.L.elec_V_battery) 0 > &&
	(L.L.cp_fahrertuer_entriegelt) ! &&
		{if}			
			(L.L.cp_fahrertuer_pos) s0 			
			 0.065 < 
				{if}
					l0 0.005 + (S.L.cp_fahrertuer_pos)
				{else}
					1 (S.L.cp_fahrertuer_entriegelt)
				{endif}				
		{endif}
		
	(L.L.cp_fahrertuer_pos) 0 =	(L.L.cp_fahrertuer_sw) ! &&
		{if}
			0 (S.L.cp_fahrertuer_entriegelt)
		{endif}
		
'	Schublade: Euro anzeigen
	(L.L.cp_wechsler_visible) (L.L.almex_hamburg) &&
		{if}	
			1 (S.L.cp_euro_visible)
		{else}
			0 (S.L.cp_euro_visible)
		{endif}
		
'	Schublade: Sound
	(L.L.cp_zahltisch_schublade_pos) 0 =
		{if} 
			(L.L.cp_zahltisch_schublade_status) 0 >
				{if}
					(T.L.ev_schublade_zu)
					0 (S.L.cp_zahltisch_schublade_status)
				{endif}			 
		{endif}
		
	(L.L.cp_zahltisch_schublade_pos) 0 >
	(L.L.cp_zahltisch_schublade_pos) 1 < &&
		{if} 
			(L.L.cp_zahltisch_schublade_status) 0 =
				{if}
					(T.L.ev_schublade_auf)
					1 (S.L.cp_zahltisch_schublade_status)
				{endif}			
			(L.L.cp_zahltisch_schublade_status) 2 =
				{if}
					1 (S.L.cp_zahltisch_schublade_status)
				{endif}			
		{endif}
		
	(L.L.cp_zahltisch_schublade_pos) 1 =
		{if} 
			(L.L.cp_zahltisch_schublade_status) 1 =
				{if}
					(T.L.ev_schublade_anschlag)
					2 (S.L.cp_zahltisch_schublade_status)
				{endif}			 
		{endif}	

		
	(L.L.cp_schluessel_rot) 0 =
	(L.L.cp_schluessel_rot_mode) 0 =  &&
	(L.L.engine_injection_on) ! &&
		{if}
			0 (S.L.elec_busbar_main_sw)	(S.L.engine_stopwait)			
		{endif}		
		
	(L.L.engine_stopwait) 0 >
	(L.L.cp_schluessel_rot) 0.17 > (L.L.cp_schluessel_rot) 0.48 < && &&
	(L.L.cp_schluessel_rot_mode) 0.5 = ! &&
		{if}
			0.33 (S.L.cp_schluessel_rot_mode)
			(L.L.elec_busbar_main_sw) !
				{if}
					(L.L.globaltimer) (S.L.cockpit_schluesselzeit) 
					0 (S.L.cockpit_engineshutdowntime)
					1 (S.L.elec_busbar_main_sw) 1 (S.L.cockpit_relaissound)
				{endif}
		{endif}


'   Summer
	(L.L.doorEntriegelung_23)
	(L.L.doorEntriegelung_45) ||	
	(L.L.doorEntriegelung_67) ||	
	(L.L.doorEntriegelung_89) ||	
	(L.L.doorEntriegelung_01) (L.L.Velocity) 2 > && ||	
	(L.L.knickschutz_aktiv) ||
	(L.L.klingel) ||
	(L.L.door_2) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_3) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_4) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_5) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_6) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_7) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_8) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.door_9) 0.05 > (L.L.Velocity) 2 > && ||
	(L.L.cp_notloese_kneeling) (L.L.Velocity) 2 > && ||
	(L.L.cp_notloese_anfahrsperre) (L.L.Velocity) 2 > && ||	
	(L.L.elec_busbar_main_sw) 1 = (L.L.engine_injection_on) || &&
	(L.L.cp_fahrertuer_pos) 0 > (L.L.elec_busbar_main_sw) ! || (L.L.bremse_feststell) ! && (L.L.elec_busbar_avail) && ||
		{if}
			(L.L.nothahn3_summer) 0.4 + 1 min (S.L.nothahn3_summer) 
		{else}
			(L.L.nothahn3_summer) 0.7 - 0 max (S.L.nothahn3_summer) 
		{endif}
	
'   Radiosound ein-/ausblenden
		(L.L.vdv_radio) !
			{if}
				(L.L.vdv_radio_fade) 0.05 - 0 max (S.L.vdv_radio_fade)
			{else}
				(L.L.vdv_radio_fade) 0.05 + 1 min (S.L.vdv_radio_fade)
			{endif}

	
'	Verstellung VDV-Armaturen

	(L.L.elec_busbar_main_sw)
		{if}
			(L.L.vdv_verstellbar_sw) (S.L.vdv_verstellbar_sw_set)
		{endif}

	(L.L.vdv_verstellbar_sw_set) (L.L.elec_busbar_main_sw) (L.L.vdv_verstellbar) ! (L.L.Velocity) 1 < && && &&
		{if}
			1 (S.L.vdv_verstellbar)
			(T.L.vdv_verstellung_an)
		{endif}
		
	(L.L.vdv_verstellbar_sw_set) ! (L.L.elec_busbar_main_sw) ! || (L.L.Velocity) 1 >= || (L.L.vdv_verstellbar) &&
		{if}
			0 (S.L.vdv_verstellbar)
			(T.L.vdv_verstellung_aus)
		{endif}
		
'	Soundtrigger
'	Relaissound: 0 = Schlüssel ab, 1 = Schlüssel drin wartet auf Timersignal, 2 = Motor an wartet auf Motor aus, 3 = Motor aus wartet auf Timersignal

	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + >
	(L.L.cockpit_relaissound) 1 = &&	
		{if}
		(T.L.ev_stroman)
		0 (S.L.cockpit_relaissound)
		{endif}
		
	(L.L.globaltimer) (L.L.cockpit_engineshutdowntime) 4 + >
	(L.L.cockpit_relaissound) 3 = &&
		{if}
		(T.L.ev_stromaus)
		0 (S.L.cockpit_relaissound)		
		{endif}

'	Beleuchtung Taster

			
(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1 + > && 
(L.L.elec_failure_general) ! &&
	{if}		
		(L.L.antrieb_einleg_lock) 0 >
			{if}				
				(L.L.cockpit_gang_blinktime) (L.S.Timegap) + (S.L.cockpit_gang_blinktime)
				1 > 
					{if}
						(L.L.cockpit_gang_blinken) ! (S.L.cockpit_gang_blinken) 0 (S.L.cockpit_gang_blinktime)
					{endif}					
				
				(L.L.antrieb_getr_gangwahl) 1 >
					{if}
						(L.L.cockpit_gang_blinken) (S.L.cockpit_gang_lichtD)
						0 (S.L.cockpit_gang_lichtR) (S.L.cockpit_gang_lichtN)
					{else}
					
						(L.L.antrieb_getr_gangwahl) 1 <
							{if}
								(L.L.cockpit_gang_blinken) (S.L.cockpit_gang_lichtR)
								0 (S.L.cockpit_gang_lichtD) (S.L.cockpit_gang_lichtN)
							{else}
								0 (S.L.cockpit_gang_lichtD) (S.L.cockpit_gang_lichtR) 1 (S.L.cockpit_gang_lichtN)
							{endif}
						
					{endif}						
							
			{else}				
				
				(L.L.antrieb_getr_gangwahl) 1 >
					{if}
						1 (S.L.cockpit_gang_lichtD) 0 (S.L.cockpit_gang_lichtN) (S.L.cockpit_gang_lichtR)
					{else}
						(L.L.antrieb_getr_gangwahl) 1 <
							{if}
								0 (S.L.cockpit_gang_lichtD) (S.L.cockpit_gang_lichtN) 1 (S.L.cockpit_gang_lichtR)
							{else}
								0 (S.L.cockpit_gang_lichtD) 1 (S.L.cockpit_gang_lichtN) 0 (S.L.cockpit_gang_lichtR)
							{endif}
					{endif}
				
				
				0 (S.L.cockpit_gang_blinktime)
				
			{endif}		
		
		1 (S.L.cockpit_gang_licht)
	
		(L.L.cp_lockdoors_targeton) (S.L.cp_licht_lockdoors)
		(L.L.cp_fahrertuer_entriegelt) ! (S.L.cp_licht_fahrertuer)
		(L.L.klingel) (S.L.cp_licht_klingel)
		(L.L.lights_schulbetrieb) (L.L.lights_warnblinkgeber) && (S.L.cp_licht_schulfahr)
						
	{else}
		0 (S.L.cockpit_gang_lichtD) (S.L.cockpit_gang_lichtN) (S.L.cockpit_gang_lichtR) (S.L.cp_licht_lockdoors) (S.L.cp_licht_fahrertuer) (S.L.cp_licht_schulfahr) (S.L.cockpit_gang_licht) (S.L.cockpit_gang_blinktime) (S.L.cp_licht_klingel)
	{endif}
		

'	Beleuchtung Warnblinker
	(L.L.elec_busbar_avail)
	(L.L.elec_failure_general) ! &&
	(L.L.lights_warnblinkgeber) (L.L.lights_stand) || &&		
	(S.L.vdv_warnblinklicht)		
		
'	Klappsitz durch Fahrgast

'	21 (M.V.GetHumanCountOnSeat) 0 > (L.L.klappsitzR) ! && {if} 1 (S.L.klappsitzR_pax) (S.L.klappsitzR) (T.L.ev_klappsitz_runter) {endif}	
'	21 (M.V.GetHumanCountOnSeat) 0 = (L.L.klappsitzR_pax) && (L.L.klappsitzR) && {if} 0 (S.L.klappsitzR_pax) (S.L.klappsitzR) (T.L.ev_klappsitz_hoch) {endif}

{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:phys_animation}
		
		(L.L.A_Trans_X) 16 / s0
		(L.L.schlaufen_swing) s1
		10 s2
		10 s3
		(M.L.traegheit)	
		(S.L.schlaufen_swing)
		
		(L.L.A_Trans_Y) 4 / s0
		(L.L.showdiagram_shift) s1
		2 s2
		2 s3
		(M.L.traegheit)	
		(S.L.showdiagram_shift)
		
{end}

{macro:tacho_frame}


	(L.L.elec_busbar_main_sw) (L.L.elec_failure_general) ! &&
		{if}
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1 + >
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 3 + < &&
			(L.L.c2_display_standby) ! &&
				{if}
					228 (S.L.cockpit_tachowinkel)
				{else}
					(L.L.Velocity) (F.L.cockpit_tacholinie) (S.L.cockpit_tachowinkel)
				{endif}
			
		{else}
			0 (S.L.cockpit_tachowinkel)
		{endif}
	
{end}


{macro:drehzahlmesser_frame}	
	
	(L.L.elec_busbar_main_sw) (L.L.elec_failure_general) ! &&
		{if}
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1 + >
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 3 + < &&
			(L.L.c2_display_standby) ! &&
				{if}
					228 (S.L.cockpit_drehzahlwinkel)
				{else}
					(L.L.engine_n) 2500 232 / / (S.L.cockpit_drehzahlwinkel)
				{endif}
			
		{else}
			0 (S.L.cockpit_drehzahlwinkel)
		{endif}		
				
{end}

{macro:hupe_frame}
	(L.L.engine_injection_on)
	{if}
	
		(L.L.vdv_sw_klingel) (S.L.klingel)
	
		(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}
		
		0 (S.L.klingel)
	{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}
	
	
	{end}
	
{macro:kombi_frame}
	(L.L.cockpit_blinkerhebel) 1 =
	{if}	
		1 (S.L.cp_kombiU_visible) &&
		0 (S.L.cp_kombiM_visible) &&
		0 (S.L.cp_kombiL_visible)
	{else}
		(L.L.cockpit_blinkerhebel) -1 =
		{if}
			0 (S.L.cp_kombiU_visible) &&
			0 (S.L.cp_kombiM_visible) &&
			1 (S.L.cp_kombiL_visible)
		{else}
			0 (S.L.cp_kombiU_visible) &&
			1 (S.L.cp_kombiM_visible) &&
			0 (S.L.cp_kombiL_visible)
		{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}

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
		{if}
		(L.L.lights_sw_fern) 1 = (L.L.vdv_all_lights) ||		
			{if}		
				1 (S.L.cockpit_light_fernlicht)
			{else}
				0 (S.L.cockpit_light_fernlicht)
			{endif}
		{else}
			0 (S.L.cockpit_light_fernlicht)
		{endif}		
		
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
		{if}
		(L.L.lights_abbl) 1 = (L.L.lights_fern) ! &&
		(L.L.vdv_all_lights) ||	
			{if}		
				1 (S.L.cockpit_light_abblend)
			{else}
				0 (S.L.cockpit_light_abblend)
			{endif}
		{else}
			0 (S.L.cockpit_light_abblend)
		{endif}			
	{end}
	
{macro:horn_frame}
	(L.L.cockpit_blinkerhebel) 1 =
	{if}	
		1 (S.L.cp_hornU_visible) &&
		0 (S.L.cp_hornM_visible) &&
		0 (S.L.cp_hornL_visible)
	{else}
		(L.L.cockpit_blinkerhebel) -1 =
		{if}
			0 (S.L.cp_hornU_visible) &&
			0 (S.L.cp_hornM_visible) &&
			1 (S.L.cp_hornL_visible)
		{else}
			0 (S.L.cp_hornU_visible) &&
			1 (S.L.cp_hornM_visible) &&
			0 (S.L.cp_hornL_visible)
		{endif}
	{endif}



{end}

{macro:wischerhebel_frame}
	
'	Wischerhebel

	(L.L.cp_wischersw_change)
		{if}		

			(L.L.cockpit_wischer_drehschalter_mode) 2 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 3 = &&
				{if}	
					1 (S.L.cockpit_wischer_drehschalter_mode) 
					0.25 (S.L.cockpit_wischer_drehschalter) 
					5 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}
				
			(L.L.cockpit_wischer_drehschalter_mode) 3 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 4 = &&
				{if}	
					2 (S.L.cockpit_wischer_drehschalter_mode) 
					0.5 (S.L.cockpit_wischer_drehschalter) 
					3 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}		
				
			(L.L.cockpit_wischer_drehschalter_mode) 4 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 3 = &&
				{if}	
					3 (S.L.cockpit_wischer_drehschalter_mode) 
					0.75 (S.L.cockpit_wischer_drehschalter) 
					4 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}		
				
			(L.L.cockpit_wischer_drehschalter_mode) 3 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 2 = &&
				{if}	
					4 (S.L.cockpit_wischer_drehschalter_mode) 
					1 (S.L.cockpit_wischer_drehschalter) 
					3 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}	

			(L.L.cockpit_wischer_drehschalter_mode) 2 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 1 = &&
				{if}	
					3 (S.L.cockpit_wischer_drehschalter_mode) 
					0.75 (S.L.cockpit_wischer_drehschalter) 
					2 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}

			(L.L.cockpit_wischer_drehschalter_mode) 1 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 0 = &&
				{if}	
					2 (S.L.cockpit_wischer_drehschalter_mode) 
					0.5 (S.L.cockpit_wischer_drehschalter) 
					1 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}
			
			(L.L.cockpit_wischer_drehschalter_mode) 0 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 1 = &&
				{if}	
					1 (S.L.cockpit_wischer_drehschalter_mode) 
					0.25 (S.L.cockpit_wischer_drehschalter) 
					0 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}
				
			(L.L.cockpit_wischer_drehschalter_mode) 1 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 2 = &&
				{if}	
					0 (S.L.cockpit_wischer_drehschalter_mode) 
					0 (S.L.cockpit_wischer_drehschalter) 
					1 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}
				
			(L.L.cockpit_wischer_drehschalter_mode) 0 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 0 = &&
				{if}	
					1 (S.L.cockpit_wischer_drehschalter_mode) 
					0.25 (S.L.cockpit_wischer_drehschalter) 
					0 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}
				
			(L.L.cockpit_wischer_drehschalter_mode) 1 =
			(L.L.cockpit_wischer_drehschalter_lastmode) 6 = &&
				{if}	
					0 (S.L.cockpit_wischer_drehschalter_mode) 
					0 (S.L.cockpit_wischer_drehschalter) 
					1 (S.L.cockpit_wischer_drehschalter_lastmode) 
				{endif}
			
			(L.L.cockpit_wischer_drehschalter_lastmode) 5 = 
			{if} 6 (S.L.cockpit_wischer_drehschalter_lastmode) {endif}

			(T.L.ev_wischerdrehschalter_dreh)
			
			0 (S.L.cp_wischersw_change)
			
		{endif}
	
	(L.L.cockpit_wischer_drehschalter_mode) 0 = (L.L.cockpit_wischer_drehschalter_lastmode) 1 = &&
		{if}
			0 (S.L.cockpit_wischer_drehschalter_lastmode)
		{endif}
		
	(L.L.cockpit_wischer_drehschalter_mode) 0 =
		{if}
		0 (S.L.wiper_schnell_sw) (S.L.wiper_einaus_sw) (S.L.wiper_intervall_sw)
		{endif}

	(L.L.cockpit_wischer_drehschalter_mode) 1 =
		{if}
			0 (S.L.wiper_schnell_sw) 
			0 (S.L.wiper_einaus_sw) 
			1 (S.L.wiper_intervall_sw)
			0 (S.L.wiper_intervall2_sw)
		{endif}	
		
	(L.L.cockpit_wischer_drehschalter_mode) 2 =
		{if}
			0 (S.L.wiper_schnell_sw) 
			0 (S.L.wiper_einaus_sw) 
			1 (S.L.wiper_intervall_sw)
			1 (S.L.wiper_intervall2_sw)
		{endif}		
			
	(L.L.cockpit_wischer_drehschalter_mode) 3 =	
		{if}
			0 (S.L.wiper_schnell_sw) 
			1 (S.L.wiper_einaus_sw) 
			0 (S.L.wiper_intervall_sw)
			0 (S.L.wiper_intervall2_sw)
		{endif}	

	(L.L.cockpit_wischer_drehschalter_mode) 4 =
		{if}
			1 (S.L.wiper_schnell_sw) 
			1 (S.L.wiper_einaus_sw) 
			0 (S.L.wiper_intervall_sw)
			0 (S.L.wiper_intervall2_sw)
		{endif}			
	
{end}

{macro:wischer_drehschalter_frame}					
			
{end}

{trigger:cp_wischer_intervall_toggle}

	(L.L.cockpit_wischer_drehschalter_mode) 1 = (L.L.cockpit_wischer_drehschalter_mode) 2 = ||
		{if}
			0 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cockpit_wischer_drehschalter)
			1 (S.L.cockpit_wischer_drehschalter_lastmode)
		{else}
			1 (S.L.cockpit_wischer_drehschalter_mode) 
			0.25 (S.L.cockpit_wischer_drehschalter)
			0 (S.L.cockpit_wischer_drehschalter_lastmode)
		{endif}			

	(T.L.ev_wischerdrehschalter)

{end}

{trigger:cp_wischer_wascher_button}
	1 (S.L.cp_wischer_wascher_sw) s1	
		(T.L.ev_wischerdrehschalter)
		1 (S.L.cockpit_wischerhebel_x)	
{end}

{trigger:cp_wischer_wascher_button_off}
	0 (S.L.cp_wischer_wascher_sw) s1
	(S.L.wiper_wascher_sw)	
		(T.L.ev_wischerdrehschalter)
		0 (S.L.cockpit_wischerhebel_x)	
{end}


{trigger:showdiagram_pullout}
	(L.L.showdiagram_pullout) ! (S.L.showdiagram_pullout)
{end}



{macro:cockpitlights_frame}

(L.L.elec_failure_general) ! {if}

'	Kontrollleuchte Motor (im DZM)

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >	
		{if}
			(L.L.engine_on) !
				{if}
					(L.L.cockpit_light_motorkontrolle_timer) 2 <
						{if}								
							(L.S.Timegap) (L.L.cockpit_light_motorkontrolle_timer) + (S.L.cockpit_light_motorkontrolle_timer) 										
						{else}
							0 (S.L.cockpit_light_motorkontrolle_timer) 	
							(L.L.cockpit_light_motorkontrolle) ! (S.L.cockpit_light_motorkontrolle)				
						{endif}
					
				{else}
					(L.L.engine_failure_general)  (L.L.antrieb_EMR_failure) ||						
						{if}							
							1 (S.L.cockpit_light_motorkontrolle)
						{else}
							0 (S.L.cockpit_light_motorkontrolle) (S.L.cockpit_light_motorkontrolle_timer) 
						{endif}
				{endif}						
		{else}
			0 (S.L.cockpit_light_motorkontrolle) (S.L.cockpit_light_motorkontrolle_timer) 		
		{endif}

'	Schalterbeleuchtung Wippschalter Verstellung

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
		{if}
			(L.L.vdv_verstellbar_sw) (S.L.vdv_verstellbar_sw_licht)
		{else}
			0 (S.L.vdv_verstellbar_sw_licht)
		{endif}	

		

'	Schalterbeleuchtung Wippschalter Niveauregelung

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
	(L.L.niveau_on) &&
		{if}
			(L.L.niveau_setlevel_active) (S.L.vdv_niveau_licht)
		{else}
			0 (S.L.vdv_niveau_licht)
		{endif}			
	
'	Initialisierung der Kontrollleuchten
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + >
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 3.5 + < &&
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
			1 (S.L.vdv_all_lights) (S.L.rampe_aktiv_licht)
		{else}
			0 (S.L.vdv_all_lights)
		{endif}

	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 3.5 + >
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 6.5 + < &&
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&	
		{if}
			1 (S.L.vdv_all_lights_2)
		{else}
			0 (S.L.vdv_all_lights_2)
		{endif}
	
'	Roter Stoerungsmelder (STOP)
	
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + >
	(L.L.c2_display_rot) (L.L.engine_injection_on) && (L.L.vdv_all_lights) || &&
	(L.L.elec_failure_general) ! &&
		{if}						
			
			 (L.L.vdv_all_lights) ! 
				{if} 
					1 (S.L.cockpit_light_masterfailure_overlay) 
				{endif}
			
			(L.L.cockpit_light_masterfailure) !
				{if}
					 (L.L.vdv_all_lights) !
						{if} 
							(T.L.ev_fehler_rot)	
						{endif}
					1 (S.L.cockpit_light_masterfailure)
				{endif}
				
		{else}
			0 (S.L.cockpit_light_masterfailure) (S.L.cockpit_light_masterfailure_overlay) 
		{endif}
	
'	Gelber Stoerungsmelder (STOP)
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + >
	(L.L.c2_display_gelb) (L.L.engine_injection_on) && (L.L.vdv_all_lights) || &&
	(L.L.elec_failure_general) ! &&
		{if}						
			 (L.L.vdv_all_lights) ! 
				{if} 
					1 (S.L.cockpit_light_yellowfailure_overlay) 
				{endif}
			
			(L.L.cockpit_light_yellowfailure) !
				{if}
					 (L.L.vdv_all_lights) !
						{if} 
							(T.L.ev_fehler_gelb)	
						{endif}	
					1 (S.L.cockpit_light_yellowfailure)
				{endif}
		{else}
			0 (S.L.cockpit_light_yellowfailure) (S.L.cockpit_light_yellowfailure_overlay)
		{endif}	
		
'	ABS/ASR-Kontrolle
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.engine_injection_on) ||
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + > &&
	(L.L.bremse_ABS_eingriff) (L.L.engine_ASR_eingriff) (L.L.bremse_ABS_selftest) ! && || && (L.L.vdv_all_lights) ||		
		{if}
			1 (S.L.cockpit_light_ABSASR)
		{else}
			0 (S.L.cockpit_light_ABSASR)
		{endif}
		
'	Funk-Leuchtmelder
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.engine_injection_on) ||
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + > &&
	(L.L.cp_funk_targeton) (L.L.vdv_all_lights) || &&	
		{if}
			1 (S.L.cockpit_light_funk)
		{else}
			0 (S.L.cockpit_light_funk)
		{endif}
		
'	Blinker-Leuchtmelder
	(L.L.vdv_all_lights)
	(L.L.lights_blinker_l) ||
		{if}
			1 (S.L.cockpit_light_blinker_l)
		{else}
			0 (S.L.cockpit_light_blinker_l)
		{endif}
		
	(L.L.vdv_all_lights)
	(L.L.lights_blinker_r) ||
		{if}
			1 (S.L.cockpit_light_blinker_r)
		{else}
			0 (S.L.cockpit_light_blinker_r)
		{endif}

'	Haltewunsch-Leuchtmelder		
	(L.L.haltewunsch) (L.L.haltewunsch_2) ||
'	(L.L.vdv_all_lights) ||
	(L.L.elec_busbar_main_sw) &&
	(S.L.c2_display_haltewunsch)			
		
'	Bremsstörung (rot)
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.engine_injection_on) ||
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + > &&
	{if}
		(L.L.bremse_feststell)
		(L.L.bremse_p_Tank03) 600000 < ||
		(L.L.vdv_all_lights) ||	
			{if}		
				1 (S.L.cockpit_light_feststellbremse)
			{else}
				0 (S.L.cockpit_light_feststellbremse)
			{endif}	
	{else}
		0 (S.L.cockpit_light_feststellbremse)
	{endif}
	
'	Bremsstörung (gelb)
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.engine_injection_on) ||
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + > &&
	{if}
		(L.L.bremse_p_Tank01) 600000 < 
		(L.L.bremse_p_Tank02) 600000 < ||
		(L.L.bremse_p_Tank03) 600000 < ||
		(L.L.bremse_ABS_failure) ||
		(L.L.bremse_ABS_eingriff) ||
		(L.L.bremse_leck_2) ||
		(L.L.bremse_leck_3) ||
		(L.L.engine_injection_on) &&
		(L.L.vdv_all_lights) ||	
		(S.L.cockpit_light_feststellgelb)	
	{else}
		0 (S.L.cockpit_light_feststellgelb)
	{endif}		
	
'	Rampenleuchtmelder			
	(L.L.door_handrampe) 
'	(L.L.vdv_all_lights) ||
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.engine_injection_on) || &&
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + > &&	
			{if}		
				1 (S.L.rampe_aktiv_licht)		
			{else}
				0 (S.L.rampe_aktiv_licht)
			{endif}			

		
'	ASR aus	
	(L.L.cp_asroffsw_targeton) (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > (L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1 + > && (L.L.globaltimer) (L.L.cockpit_schluesselzeit) 3 + < && (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) < && ||		
		{if}	
			1 (S.L.cockpit_light_ASR_off)	
		{else}
			0 (S.L.cockpit_light_ASR_off)	
		{endif}	
		
'	Tuerkontrolle
	
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
	{if}
		(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 0.5 + >   
			{if}					
					(L.L.door_0) 0.1 > 	
					(L.L.door_1) 0.1 > ||	
					(L.L.door_2) 0.1 > || 					
					(L.L.door_3) 0.1 > ||
					(L.L.door_4) 0.1 > ||
					(L.L.door_5) 0.1 > ||
					(L.L.door_6) 0.1 > ||
					(L.L.door_7) 0.1 > ||
					(L.L.door_8) 0.1 > ||
					(L.L.door_9) 0.1 > ||
'					(L.L.door_freigabe) ||
					(L.L.bremse_p_Tank04) 550000 < ||			
'					(L.L.vdv_all_lights) ||						
					{if}
						1 (S.L.cockpit_light_tuerkontrolle)				
					{else}
						0 (S.L.cockpit_light_tuerkontrolle)														
					{endif}	
					
					(L.L.door_freigabe_licht) (S.L.cockpit_light_tuerfreigabe)
					
					(L.L.doorEntriegelung_45)
					{if}
					0 (S.L.cockpit_light_tuerenzu)
					(L.L.cockpit_light_tuerkontrolle_timer) 1 <
						{if}								
							(L.S.Timegap) (L.L.cockpit_light_tuerkontrolle_timer) + (S.L.cockpit_light_tuerkontrolle_timer) 										
						{else}
							0 (S.L.cockpit_light_tuerkontrolle_timer) 	
							(L.L.cockpit_light_tuerkontrolle_blinken) ! (S.L.cockpit_light_tuerkontrolle_blinken)				
						{endif}
					
					(L.L.cockpit_light_tuerkontrolle_blinken) 0 =
						{if}
							1 (S.L.cockpit_light_tuerkontrolle)							
						{else}
							0 (S.L.cockpit_light_tuerkontrolle)
						{endif}		
					{endif}
			{endif}
    {else}
		0 (S.L.cockpit_light_tuerkontrolle)	(S.L.cockpit_light_tuerfreigabe)		
	{endif}				

'Blinken Tuerschalter bei zu wenig Druck oder Fehler	

'Vorn	

	(L.L.bremse_p_Tank04) 550000 < (L.L.doorEntriegelung_01) ||
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
		(L.L.cockpit_light_tuertimer) 0.7 <
				{if}					
					(L.S.Timegap) (L.L.cockpit_light_tuertimer) + (S.L.cockpit_light_tuertimer) 										
				{else}
					0 (S.L.cockpit_light_tuertimer) 	
					(L.L.cockpit_light_tuerblinken) ! (S.L.cockpit_light_tuerblinken)				
				{endif}
			(L.L.cockpit_light_tuerblinken) 0 =
				{if}
				1 (S.L.cockpit_light_tuervorn)	
				{else}				
				0 (S.L.cockpit_light_tuervorn)
				{endif}
		{else}
			(L.L.door_0) 0.2 > (L.L.door_1) 0.2 > || (L.L.door_memory0) (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > || && 
				{if}
					1 (S.L.cockpit_light_tuervorn)
				{else}
					0 (S.L.cockpit_light_tuervorn)
				{endif}				
		{endif}
	
	
			
' Tuertaster 2

	(L.L.doorEntriegelung_23)
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
			(L.L.cockpit_light_tuertimer) 0.7 <
				{if}					
					(L.S.Timegap) (L.L.cockpit_light_tuertimer) + (S.L.cockpit_light_tuertimer) 										
				{else}
					0 (S.L.cockpit_light_tuertimer) 	
					(L.L.cockpit_light_tuerblinken) ! (S.L.cockpit_light_tuerblinken)				
				{endif}
				
			(L.L.cockpit_light_tuerblinken) 0 =
				{if}
					1 (S.L.cockpit_light_tuerhinten)	
				{else}				
					0 (S.L.cockpit_light_tuerhinten)
				{endif}
		{else}
			(L.L.door_2) 0.2 > (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > && 
				{if}
					1 (S.L.cockpit_light_tuerhinten)
				{else}
					0 (S.L.cockpit_light_tuerhinten)
				{endif}
		{endif}	
		

			
' Tuertaster 3

	(L.L.bremse_p_Tank04) 550000 < (L.L.doorEntriegelung_45) ||
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
			(L.L.cockpit_light_tuertimer) 0.7 <
				{if}					
					(L.S.Timegap) (L.L.cockpit_light_tuertimer) + (S.L.cockpit_light_tuertimer) 										
				{else}
					0 (S.L.cockpit_light_tuertimer) 	
					(L.L.cockpit_light_tuerblinken) ! (S.L.cockpit_light_tuerblinken)				
				{endif}
				
			(L.L.cockpit_light_tuerblinken) 0 =
				{if}
					1 (S.L.cockpit_light_tuer3)	
				{else}				
					0 (S.L.cockpit_light_tuer3)
				{endif}
		{else}
			(L.L.door_4) 0.2 > (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > && 
				{if}
					1 (S.L.cockpit_light_tuer3)
				{else}
					0 (S.L.cockpit_light_tuer3)
				{endif}
		{endif}	
		
			
' Tuertaster 4

	(L.L.doorEntriegelung_67)
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
			(L.L.cockpit_light_tuertimer) 0.7 <
				{if}					
					(L.S.Timegap) (L.L.cockpit_light_tuertimer) + (S.L.cockpit_light_tuertimer) 										
				{else}
					0 (S.L.cockpit_light_tuertimer) 	
					(L.L.cockpit_light_tuerblinken) ! (S.L.cockpit_light_tuerblinken)				
				{endif}
				
			(L.L.cockpit_light_tuerblinken) 0 =
				{if}
					1 (S.L.cockpit_light_tuer4)	
				{else}				
					0 (S.L.cockpit_light_tuer4)
				{endif}
		{else}
			(L.L.door_6) 0.2 > (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > && 
				{if}
					1 (S.L.cockpit_light_tuer4)
				{else}
					0 (S.L.cockpit_light_tuer4)
				{endif}
		{endif}			

			
' Tuertaster 5

	(L.L.doorentriegelung_89)
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > &&
		{if}
			(L.L.cockpit_light_tuertimer) 0.7 <
				{if}					
					(L.S.Timegap) (L.L.cockpit_light_tuertimer) + (S.L.cockpit_light_tuertimer) 										
				{else}
					0 (S.L.cockpit_light_tuertimer) 	
					(L.L.cockpit_light_tuerblinken) ! (S.L.cockpit_light_tuerblinken)				
				{endif}
				
			(L.L.cockpit_light_tuerblinken) 0 =
				{if}
					1 (S.L.cockpit_light_tuer5)	
				{else}				
					0 (S.L.cockpit_light_tuer5)
				{endif}
		{else}
			(L.L.door_8) 0.2 > (L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) > && 
				{if}
					1 (S.L.cockpit_light_tuer5)
				{else}
					0 (S.L.cockpit_light_tuer5)
				{endif}
		{endif}	
		

'	Door Memory erlaubt, die Tuer noch zu schliessen, wenn der Bus abgestellt wurde
	(L.L.door_0) 0 > (L.L.engine_injection_on) (L.L.elec_busbar_main) || &&
		{if}
			(L.L.door_memory0_zeit) 0 =
				{if}
					(L.L.globaltimer) (S.L.door_memory0_zeit)
				{endif}
				
			1 (S.L.door_memory0)
		{endif}
		
	(L.L.globaltimer) (L.L.door_memory0_zeit) (C.L.door_memory) + >	
		{if}
			0 (S.L.door_memory0) (S.L.door_memory0_zeit)
		{endif}
		
{else}

' Bei Stoerung der Gesamtelektrik

	0 (S.L.cockpit_oeldruck) (S.L.cockpit_light_ASR_off) (S.L.cockpit_light_retarder) (S.L.cockpit_light_feststellbremse) (S.L.cockpit_light_masterfailure)
	(S.L.cockpit_light_batterie) (S.L.cockpit_light_tuerenzu) (S.L.cockpit_light_tuerkontrolle) (S.L.cockpit_light_tuerhinten) (S.L.cockpit_light_tuervorn) (S.L.cockpit_light_tuer3) (S.L.cockpit_light_tuer4) (S.L.cockpit_light_tuer5) (S.L.cockpit_light_funk)  
	(S.L.rampe_aktiv_licht) (S.L.cockpit_light_EMR) (S.L.cockpit_light_blinker)
	(S.L.cockpit_light_klima) (S.L.bremse_halte_licht)  (S.L.cockpit_light_oelstand) (S.L.cockpit_light_ABSASR) (S.L.cockpit_light_motorkontrolle)

	
{endif}

{end}

	

{macro:wippschaltereinsound}	
		(T.L.ev_wippschaltereinsound)		
		{end}

{macro:wippschalteraussound}
	(T.L.ev_wippschalteraussound)	
		{end}


{macro:druckschaltersound}	
		(T.L.ev_druckschaltersound)		
{end}

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

{macro:klappfenster2sound}
	l1
	{if}
		(T.L.ev_klappfenster2_opn)
	{else}
		(T.L.ev_klappfenster2_cls)
	{endif}	
{end}

{macro:klappfenstersound_ht}
	l1
	{if}
		(T.L.ev_klappfenster_opn_ht)
	{else}
		(T.L.ev_klappfenster_cls_ht)
	{endif}	
{end}

{macro:schluessel_frame}

	(L.L.cp_schluessel_trans_mode) s0 (L.L.cp_schluessel_trans_lastmode) = !
		{if}
			l0 1 = {if} (T.L.ev_schluessel_steck) {endif}
			l0 0 = {if} (T.L.ev_schluessel_raus) {endif}
			l0 (S.L.cp_schluessel_trans_lastmode)			
		{endif}

	(L.L.cp_schluessel_rot_lastmode) (L.L.cp_schluessel_rot_mode) = !
	{if}
		(T.L.ev_schluessel_dreh)
		(L.L.cp_schluessel_rot_mode) (S.L.cp_schluessel_rot_lastmode)
	{endif}
	

{end}


{macro:oeldruck_frame}

	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) <	
		{if}
			0 (S.L.cockpit_oeldruck)	
		{endif}
	
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >=
		{if}
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1 + >
				{if}	
					(L.L.engine_n) (F.L.cockpit_oeldruck) 
					(S.L.cockpit_oeldruck)		
				{endif}		
		{endif}
{end}

{macro:tankuhr_frame}

	(L.L.elec_busbar_main_sw) (L.L.elec_failure_general) ! &&
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1 + > &&
		{if}
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 3 + <
			(L.L.c2_display_standby) ! &&
				{if}
					235 (S.L.cockpit_tankuhr) (S.L.cockpit_adblue)
				{else}
					(L.L.engine_tank_content) (C.L.engine_tank_capacity) / 235 * (S.L.cockpit_tankuhr)
					(L.L.adblue_content) 46 / 235 * (S.L.cockpit_adblue)
				{endif}
			
		{else}
			0 (S.L.cockpit_tankuhr) (S.L.cockpit_adblue)
		{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: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:fahrertuer1_frame}

	(L.L.cp_fahrertuer1_dragged) !
	{if}
		(L.L.cp_fahrertuer1_pos) (L.S.Timegap) (L.L.cp_fahrertuer1_speed) * + (S.L.cp_fahrertuer1_pos)

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

		(L.L.cp_fahrertuer1_pos) 0 >
		{if}
			(L.L.cp_fahrertuer1_speed) (L.S.Timegap) (L.L.A_Trans_Y) (C.L.cp_fahrertuer1_anschlagseite) * (L.L.A_Trans_X) /-/ + 0.3 * (L.L.cp_fahrertuer1_globalangle) * * + (S.L.cp_fahrertuer1_speed)
		{endif}
	
		(L.L.cp_fahrertuer1_speed) s0 (S.L.cp_fahrertuer1_lastspeed)
		l0 0 >
		{if}
			l0 (L.S.Timegap) 0.2 * - (S.L.cp_fahrertuer1_speed)
		{endif}
		l0 0 <
		{if}
			l0 (L.S.Timegap) 0.2 * + (S.L.cp_fahrertuer1_speed)
		{endif}


		(L.L.cp_fahrertuer1_speed) 0 > (L.L.cp_fahrertuer1_lastspeed) 0 < &&
		(L.L.cp_fahrertuer1_speed) 0 < (L.L.cp_fahrertuer1_lastspeed) 0 > && ||
		{if}
			0 (S.L.cp_fahrertuer1_speed)
		{endif}	 
	
	{endif}

	(L.L.cp_fahrertuer1_pos) 0 > (L.L.cp_fahrertuer1_open) ! &&
	{if}
		(T.L.ev_fahrertuer1_auf)
		1 (S.L.cp_fahrertuer1_open)
	{endif}

	(L.L.cp_fahrertuer1_pos) 0 = (L.L.cp_fahrertuer1_open) &&
	{if}
		(T.L.ev_fahrertuer1_zu)
		0 (S.L.cp_fahrertuer1_open)
	{endif}

	(L.L.cp_fahrertuer1_pos) 140 * 27 + 3.14 * 180 / sin (S.L.cp_fahrertuer1_globalangle) 

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

{end}


{macro:microphone_frame}

	(L.L.cp_microphone_sw)
	(L.L.engine_injection_on) && 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: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}


{trigger:cp_FahrgastpendelR}
	1 (S.L.cp_FahrgastpendelR_drag)
{end}

{trigger:cp_FahrgastpendelR_off}
	0 (S.L.cp_FahrgastpendelR_drag)
{end}

{trigger:cp_FahrgastpendelR_drag}
	(L.L.cp_FahrgastpendelR_drag)
	{if}
		(L.L.cp_FahrgastpendelR_Pos) (L.S.mouse_y) 500 / + 1 min -1 max s0
		l0 (L.L.cp_FahrgastpendelR_Pos) - (L.S.Timegap) / (S.L.cp_FahrgastpendelR_Speed)
		l0 (S.L.cp_FahrgastpendelR_Pos)
	{endif}
{end}

{macro:Fahrgastpendel}

'Sollwert: (wenn mindestens ein Typ an der Stelle durchgeht)
	1 (M.V.GetHumanCountOnPathLink) 3 (M.V.GetHumanCountOnPathLink) + 1 min s4
'Differenz * InvTrägheit = Beschleunigung
	(L.L.cp_FahrgastpendelR_Pos) - 10 * s1

'Wenn ein Fahrgast durchwill, dann überschreibe die "Drag"-Eigenschaft:
	l4 {if} 0 (S.L.cp_FahrgastpendelR_drag) {endif}

	(L.L.cp_FahrgastpendelR_drag) !
	
	{if}

'Anwendung einer Reibungskraft:
		l1 (L.L.cp_FahrgastpendelR_Speed) sgn 1.3 * - s0
'Prüfen, ob sich die Beschleunigung infolge der Reibung umkehrt - dann wird sie auf 0 gesetzt:
		l0 l1 * 0 < {if} 0 s0 {endif}
'Anwenden der Beschleunigung:
		(L.L.cp_FahrgastpendelR_Speed) l0 (L.S.Timegap) * + (S.L.cp_FahrgastpendelR_Speed)
'Anwenden der Position:
		(L.L.cp_FahrgastpendelR_Pos) (L.L.cp_FahrgastpendelR_Speed) (L.S.Timegap) * + (S.L.cp_FahrgastpendelR_Pos) s0
	{else}
		(L.L.cp_FahrgastpendelR_Pos) s0
	{endif}

'Limits: (Anschlag an Haltestange mit 10% Abprallstärke)
	l0 -1 <
	{if}
		0 (S.L.cp_FahrgastpendelR_Pos)
		(T.L.ev_fahrgastpendelR_zu)
		(L.L.cp_FahrgastpendelR_Speed) -0.1 * (S.L.cp_FahrgastpendelR_Speed)
	{endif}
'(anderes Ende ohne Reflexion)
	l0 1 >
	{if}
		1 (S.L.cp_FahrgastpendelR_Pos)
		0 (S.L.cp_FahrgastpendelR_Speed)
	{endif}


{end}


{trigger:mt_schublade_drag}
	
	(L.L.mt_schublade_frei)
		{if}
			(L.S.mouse_y) 100 / (L.L.mt_schublade) + 0 max 1 min (S.L.mt_schublade)
		{endif}
{end}

{trigger:mt_sw1}	
	1 (S.L.mt_sw1)	
	(L.L.mt_zeitgruppe) 2 <
		{if}
			(L.L.mt_zeitgruppe) 1 + (S.L.mt_zeitgruppe)
		{else}
			0 (S.L.mt_zeitgruppe)
		{endif}
	(T.L.ev_taste_klein)
{end}

{trigger:mt_sw1_off}	
	0 (S.L.mt_sw1)
{end}

{trigger:mt_sw_auswerfen}	
	1 (S.L.mt_sw_auswerfen)
	(T.L.ev_taste_klein)
{end}

{trigger:mt_sw_auswerfen_off}	
	0 (S.L.mt_sw_auswerfen)
{end}

{trigger:mt_schublade_klick}	
	(L.L.mt_scheibe) ! (S.L.mt_scheibe)
	(T.L.ev_tachoscheibe)
{end}

{macro:mt_tachograph}


	(L.L.mt_schublade) 0 > 
	(L.L.mt_schublade) 1 < && 	
		{if}
			(L.L.mt_schublade_sound) 0 =
				{if}
					(T.L.ev_tacho_auf)
					1 (S.L.mt_schublade_sound)
				{endif}
			(L.L.mt_schublade_sound) 2 =
				{if}
					1 (S.L.mt_schublade_sound)
				{endif}
		{endif}
		
	(L.L.mt_schublade) 1 = 
	(L.L.mt_schublade_sound) 1 = &&
		{if}
			(T.L.ev_tacho_anschlag)
			2 (S.L.mt_schublade_sound)
		{endif}
	
	(L.L.mt_schublade) 0 <= 
	(L.L.mt_schublade_sound) 0 > &&
		{if}
			(T.L.ev_tacho_zu)
			0 (S.L.mt_schublade_sound)
		{endif}
		
' ***** Initialisierung km-Zaehler ****************************************************************************************************
	

		
	(L.L.org_kmcounter_init) 0 =	
			{if}
				(L.L.kmcounter_km) (S.L.org_kmcounter_init)
				(L.S.Year) (F.L.my_kmcounter_init) (L.S.Day) 120 * + (L.S.Month) 2000 * + 21500 + (S.L.my_kmcounter_km) (S.L.my_kmcounter_init)
			{endif}
	
	(L.L.kmcounter_m) s0 1000 <
		{if}	
			l0 (S.L.mt_kmcounter_m)
		{else}
			l0 1000 - (S.L.mt_kmcounter_m)
		{endif}

	(L.L.elec_busbar_main_sw)
		{if}
		
' ************************ km-Zaehler **************************************************************************************************		
		
			(L.L.kmcounter_km) (L.L.org_kmcounter_init) - (L.L.my_kmcounter_init) + (S.L.my_kmcounter_km)
		
			(L.L.my_kmcounter_km) "06" $IntToStrEnh "." $+ (L.L.cp_odo_m) 100 / $IntToStr $+ "km" $+ (S.$.mt_string2) ""
			(L.L.my_kmcounter_km) "06" $IntToStrEnh "." $+ (L.L.cp_odo_m) 100 / $IntToStr $+ (S.$.cp_odo_km) ""
			
			(L.L.cp_odo_m_init) 0 = (L.L.cp_odo_m) 0 = &&
				{if}
					(L.L.kmcounter_m) (S.L.cp_odo_m_init)
				{endif}			
		
			(L.L.cp_odo_m) 999 <= 
			(L.L.cp_odo_m) 0 >= &&
				{if}
					(L.L.kmcounter_m) (L.L.cp_odo_m_init) - (S.L.cp_odo_m)			
				{else}
					0 (S.L.cp_odo_m) (S.L.cp_odo_m_init)					
				{endif}
			
			(L.L.my_kmcounter_km) (L.L.my_kmcounter_init) - "03" $IntToStrEnh "." $+ (L.L.cp_odo_m) 100 / $IntToStr $+ (S.$.cp_odo_m)  ""
			
' *****************************************************************************************************************************************			
			
			(L.L.mt_sw_auswerfen)
				{if}
					1 (S.L.mt_schublade_frei)
					0.1 (S.L.mt_schublade)
				{endif}
				
			(L.L.mt_schublade) 0.1 <
				{if}
					0 (S.L.mt_schublade_frei) (S.L.mt_schublade)				
				{endif}
				
			
			(L.L.Velocity) 3 > (L.L.mt_scheibe_rec) ! &&
			(L.L.Velocity) 3 > (L.L.mt_schublade) 0 > && || 
			(L.L.Velocity) 3 > (L.L.mt_ruhezeit) && ||
			(L.L.Velocity) 3 > (L.L.mt_bereitschaft) && ||
				{if}
					1 (S.L.mt_fehler)
				{else}
					0 (S.L.mt_fehler)
				{endif}
				
			(L.L.mt_scheibe)
			(L.L.mt_schublade_frei) ! &&
				{if}
					1 (S.L.mt_scheibe_rec)
				{endif}
				
			(L.L.mt_scheibe) !
			(L.L.mt_schublade_frei) ||
			(L.L.mt_schublade) 0 > ||
				{if}
					0 (S.L.mt_scheibe_rec)
				{endif}				
				
			(L.L.mt_zeitgruppe) 0 = {if} 1 (S.L.mt_ruhezeit) 0 (S.L.mt_bereitschaft) (S.L.mt_lenkzeit) {endif}
			(L.L.mt_zeitgruppe) 1 = {if} 0 (S.L.mt_ruhezeit) 1 (S.L.mt_bereitschaft) 0 (S.L.mt_lenkzeit) {endif}				 
			(L.L.mt_zeitgruppe) 2 = {if} 0 (S.L.mt_ruhezeit) (S.L.mt_bereitschaft) 1 (S.L.mt_lenkzeit) {endif}	

			(L.S.Year) $IntToStr 2 $cutBegin $StrToFloat (S.L.mt_jahr)
			
			(L.S.Day) "02" $IntToStrEnh "." $+ (L.S.Month) "02" $IntToStrEnh $+ "." $+ (L.L.mt_jahr) "02" $IntToStrEnh $+ " " $+
			(L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh $+ ":" $+ l0 l1 - 60 * s0 trunc s1 "02" $IntToStrEnh $+ (S.$.mt_string1)
			
		
			
		{else}	
			0 (S.L.mt_fehler) (S.L.mt_scheibe_rec) (S.L.mt_ruhezeit) (S.L.mt_bereitschaft) (S.L.mt_lenkzeit) "" (S.$.mt_string1) (S.$.mt_string2)
		{endif}	
	
{end}


'Lenkradtaster fuer Zentraldisplay
{trigger:c2_display_swnext}	
	1 (S.L.c2_display_swnext)
	
	(L.L.c2_display_an) 
	(L.L.c2_display_rot) ! &&
	(L.L.c2_display_seq) ! &&
		{if}
					 
						(L.L.c2_display_menu) 1 = {if} 1 (S.L.c2_display_haltemenu_override) {endif}
						(L.L.c2_display_menu) 6 = {if} 1 (S.L.c2_display_menu) 0 (S.L.c2_display_haltemenu_override)   {endif}	
						(L.L.c2_display_menu) 5 = {if} 6 (S.L.c2_display_menu) {endif}	
						(L.L.c2_display_menu) 4 = {if} 5 (S.L.c2_display_menu) {endif}	
						(L.L.c2_display_menu) 3 = 
								{if} 
									(L.L.c2_display_gelb) ! (L.L.c2_display_rot) ! &&
									 {if} 
										5 (S.L.c2_display_menu) 
										0 (S.L.c2_display_gelb_viewtimer) 
									 {else} 
										(L.L.c2_display_gelb_viewseq) 1 >=
											{if}
												(L.L.c2_display_gelb_viewseq) 1 + (S.L.c2_display_gelb_viewseq)
											{endif}
										(L.L.c2_display_gelb_viewseq) 1 <
											{if}
												 1 (S.L.c2_display_gelb_viewseq)
											{endif}	
									 {endif}
									0 (S.L.c2_display_haltemenu_override)  
								{endif}
						(L.L.c2_display_menu) 2 = {if} 3 (S.L.c2_display_menu) 0 (S.L.c2_display_haltemenu_override) {endif}						
										
		{endif}	
		
	(L.L.c2_display_an) 
	(L.L.c2_display_rot) &&
	(L.L.c2_display_seq) ! &&
	(L.L.c2_display_rot_multiple) &&
		{if}			
			(L.L.c2_display_rot_viewseq) 1 + s0
			l0 10 < {if} l0 (S.L.c2_display_rot_viewseq) {else} 0 (S.L.c2_display_rot_viewseq) {endif}	
		{endif}	
		
	(T.L.ev_lenkradtaster_ein)	

{end}

{trigger:c2_display_swnext_off}	
	0 (S.L.c2_display_swnext)
	(T.L.ev_lenkradtaster_aus)
{end}	



{macro:c2_display}

'	Display aktiv wenn Strom verfuegbar
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) >
	(L.L.elec_failure_general) ! && 
	(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 1.5 + > &&
		{if}

			1 (S.L.c2_display_an) 
			
'********** Hochfahren
			(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 4.5 + <
				{if}			
					
					1 (S.L.c2_display_seq)
					"17_display_start.bmp"	(S.$.c2_display_texture)
					"" (S.$.c2_display_tankvorrat) (S.$.c2_display_adbluevorrat) (S.$.c2_display_uhrzeittemp) 0 (S.L.c2_display_o_battery) (S.L.c2_display_o_neutral) (S.L.c2_display_o_absasr) 
					(S.L.c2_display_feststell) (S.L.c2_display_kinderwagen) (S.L.c2_display_VA) (S.L.c2_display_MA) (S.L.c2_display_HA) (S.L.c2_display_tuer1_offen) (S.L.c2_display_tuer2_offen) (S.L.c2_display_tuer3_offen) (S.L.c2_display_tuer4_offen) 
					(S.L.c2_display_tuer5_offen) (S.L.c2_display_tuer2_frei) (S.L.c2_display_tuer3_frei) (S.L.c2_display_tuer4_frei) (S.L.c2_display_tuer5_frei) (S.L.c2_display_hstbremse) (S.L.c2_display_gang)
				
'**********     betriebsbereit				
				{else}
					
'					c2_display_seq gibt an, dass die Startsequenz (2 Menues) durchgespielt werden soll.
					(L.L.c2_display_seq)
						{if}
						
							(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 4.5 + >=
							(L.L.Brake) 0.2 > (L.L.bremse_p_tank01) 600000 < (L.L.bremse_p_tank02) 600000 < || || &&						 
								{if}
									5 (S.L.c2_display_menu)	
								{else} 
									1 (S.L.c2_display_menu) 0 (S.L.c2_display_inittimer) (S.L.c2_display_seq) (S.L.c2_display_haltemenu_override)
								{endif}
								
							(L.L.globaltimer) (L.L.cockpit_schluesselzeit) 8 + >=
							(L.L.Brake) 0.2 <= &&
							(L.L.bremse_p_tank01) 600000 >= &&
							(L.L.bremse_p_tank02) 600000 >= &&
								{if}
									1 (S.L.c2_display_menu) 0 (S.L.c2_display_inittimer) (S.L.c2_display_seq)  (S.L.c2_display_haltemenu_override)								
								{endif}
								
		
'**********			Ende Startsequenz
						{else}
						
						
'						Stoerungsanzeige
'					 	Level 2 (rot)						
						
						(L.L.c2_display_rot_system)
						(L.L.c2_display_rot_nothahn) ||
						(L.L.c2_display_rot_vorratsdruck1) ||
						(L.L.c2_display_rot_vorratsdruck2) ||
						(L.L.c2_display_rot_oeldruck) ||
						(L.L.c2_display_rot_kuehlwasser) ||
						(L.L.c2_display_rot_getriebeoel) ||
						(L.L.c2_display_rot_edc) ||
						(L.L.c2_display_rot_emr) ||
						(L.L.c2_display_rot_getriebe) ||
							{if}
								2 (S.L.c2_display_rot)								
									(L.L.c2_display_menu) 4 = !
										{if}
											0 (S.L.c2_display_rot_viewseq)
											4 (S.L.c2_display_menu) 
										{endif}										
							{endif}
							
						(L.L.c2_display_rot_system) !
						(L.L.c2_display_rot_nothahn) ! &&
						(L.L.c2_display_rot_vorratsdruck1) ! &&
						(L.L.c2_display_rot_vorratsdruck2) ! &&
						(L.L.c2_display_rot_oeldruck) ! &&
						(L.L.c2_display_rot_kuehlwasser) ! &&
						(L.L.c2_display_rot_getriebeoel) ! &&
						(L.L.c2_display_rot_edc) ! &&
						(L.L.c2_display_rot_emr) ! &&
						(L.L.c2_display_rot_getriebe) ! &&	
							{if}
								0 (S.L.c2_display_rot) (S.L.c2_display_rot_viewseq) (S.L.c2_display_rot_multiple) (S.L.c2_display_rot_multiple_vis)
							{endif}
																	
'					 	Level 1 (gelb)	
						
						(L.L.c2_display_gelb_kuehlwasser)
						(L.L.c2_display_gelb_motoroel) ||
						(L.L.c2_display_gelb_retarder) ||
						(L.L.c2_display_gelb_kraftstoff) ||
						(L.L.c2_display_gelb_adblue) ||
						(L.L.c2_display_gelb_batterie) ||
						(L.L.c2_display_gelb_knick) ||
							{if}
								1 (S.L.c2_display_gelb)
							{else}
								(L.L.c2_display_gelb)
								(L.L.c2_display_menu) 3 = &&
									{if}
										2 (S.L.c2_display_menu)
									{endif}
								0 (S.L.c2_display_gelb)
							{endif}
						
						

'**********			Ende wenn nicht Startsequenz
					{endif}				

						

'**********			Uebernahme der Texturstrings je nach Menu-Modus
'					Menu-Variable gibt an, welches Menu gerade dargestellt wird. Dies kann von Startsequenz und Stoerlevel ueberschrieben werden.
'					0 = leer, 1 = Haltemenu, 2 = Fahrtmenu
'					3 = Stoerung gelb, 4 = rote Stoerung, 5 = Vorratsdruck, 6 = Motor/Batterie
						
						
							(L.L.c2_display_menu)  1 = {if} 
										"45_display_menu1.bmp" (S.$.c2_display_texture) 
							{endif}
					
							(L.L.c2_display_menu)  2 = {if} 
										"17_display_menu2.bmp" (S.$.c2_display_texture)															
							{endif}
																	
							(L.L.c2_display_menu)  3 = {if}												
'											
										"17_display_menu3.bmp" (S.$.c2_display_texture) 
																				
										(L.L.c2_display_gelb_viewseq) 1 =
										{if}
										 (L.L.c2_display_gelb_batterie_view) 
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) < 
'												(L.L.c2_display_halt) ||
													{if}
														"17_display_gelb_batterie.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_batterie_view) (S.L.c2_display_gelb_viewtimer)
														2 (S.L.c2_display_gelb_viewseq)
													{endif}		
											{else} 
												2 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}
										
										(L.L.c2_display_gelb_viewseq) 2 =
										{if}
									     (L.L.c2_display_gelb_kraftstoff_view)  
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) <
'												(L.L.c2_display_halt) ||	
													{if}
														"17_display_gelb_kraftstoff.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_kraftstoff_view) (S.L.c2_display_gelb_viewtimer)
														3 (S.L.c2_display_gelb_viewseq)
													{endif}											
											{else} 
												3 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}
										
										(L.L.c2_display_gelb_viewseq) 3 =
										{if}
										 (L.L.c2_display_gelb_kuehlwasser_view) 
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) <
'												(L.L.c2_display_halt) ||
													{if}
														"17_display_gelb_kuehlwasser.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_kuehlwasser_view) (S.L.c2_display_gelb_viewtimer)
														4 (S.L.c2_display_gelb_viewseq)
													{endif}											
											{else} 
												4 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}
										
										(L.L.c2_display_gelb_viewseq) 4 =
										{if}
										 (L.L.c2_display_gelb_motoroel_view)  
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) <
'												(L.L.c2_display_halt) ||
													{if}
														"17_display_gelb_motoroel.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_motoroel_view) (S.L.c2_display_gelb_viewtimer)
														5 (S.L.c2_display_gelb_viewseq)
													{endif}											
											{else} 
												5 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}
										
										(L.L.c2_display_gelb_viewseq) 5 =
										{if}
										 (L.L.c2_display_gelb_retarder_view)  
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) <
'												(L.L.c2_display_halt) ||
													{if}
														"17_display_gelb_retarder.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_retarder_view) (S.L.c2_display_gelb_viewtimer)
														6 (S.L.c2_display_gelb_viewseq)
													{endif}											
											{else} 
												6 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}
										
										(L.L.c2_display_gelb_viewseq) 6 =
										{if}
									     (L.L.c2_display_gelb_adblue_view)  
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) <
'												(L.L.c2_display_halt) ||	
													{if}
														"17_display_gelb_adblue.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_adblue_view) (S.L.c2_display_gelb_viewtimer)
														7 (S.L.c2_display_gelb_viewseq)
													{endif}											
											{else} 
												7 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}
										
										(L.L.c2_display_gelb_viewseq) 7 =
										{if}
										 (L.L.c2_display_gelb_knick_view) 
											{if}
												(L.L.c2_display_gelb_viewtimer) (C.L.c2_display_error_duration) < 
'												(L.L.c2_display_halt) ||
													{if}
														"17_display_gelb_knick.bmp" (S.$.c2_display_texture)
														(L.L.c2_display_gelb_viewtimer) 0.01 + (S.L.c2_display_gelb_viewtimer)	
													{else}
														0 (S.L.c2_display_gelb_knick_view) (S.L.c2_display_gelb_viewtimer)
														8 (S.L.c2_display_gelb_viewseq)
													{endif}		
											{else} 
												8 (S.L.c2_display_gelb_viewseq)
											{endif}
										{endif}										
														
										
										(L.L.c2_display_gelb_batterie_view) !	
										(L.L.c2_display_gelb_knick_view) ! &&	
										(L.L.c2_display_gelb_kraftstoff_view) ! &&	
										(L.L.c2_display_gelb_adblue_view) ! &&
										(L.L.c2_display_gelb_kuehlwasser_view) ! &&	
										(L.L.c2_display_gelb_motoroel_view) ! &&	 
										(L.L.c2_display_gelb_retarder_view) ! &&
										(L.L.c2_display_gelb_viewseq) 7 > ||
											{if}
												1 (S.L.c2_display_gelb_viewseq)
												(L.L.c2_display_gelb) (L.L.c2_display_rot) || {if} 4 (S.L.c2_display_menu) {endif}												
											{endif}								
									{endif}	

'						Buttons unten anzeigen									
						(L.L.c2_display_menu) 0 >  
								{if} 
								
'									Anzeige Tuerstatus									 
										(L.L.door_0) 0.1 > (L.L.door_1) 0.1 > ||
										(S.L.c2_display_tuer1_offen)
											
									    (L.L.door_2) 0.1 > (L.L.door_3) 0.1 > ||												 
										(S.L.c2_display_tuer3_offen)										
											
										(L.L.door_4) 0.1 > (L.L.door_5) 0.1 > ||
										(S.L.c2_display_tuer2_offen)
																					
										(L.L.door_6) 0.1 > (L.L.door_7) 0.1 > ||
										(L.L.c2_display_o_haltewunsch) ! &&
										(S.L.c2_display_tuer4_offen)
											
										(L.L.door_8) 0.1 > (L.L.door_9) 0.1 > ||
										(L.L.c2_display_kinderwagen) ! && (L.L.c2_display_o_kneel) ! &&
										(S.L.c2_display_tuer5_offen)																			
											
'									Symbol Haltewunsch oder Türfreigabe										
										(L.L.c2_display_haltewunsch) (S.L.c2_display_o_haltewunsch)
										
										0 = (L.L.c2_display_tuer4_offen) ! && {if} (L.L.cockpit_light_tuerfreigabe) (S.L.c2_display_o_freigabe) {else} 0 (S.L.c2_display_o_freigabe) {endif}
											
'									Symbol Haltestellenbremse
										(L.L.bremse_halte) (S.L.c2_display_hstbremse)

'									Symbol Kinderwagenwunsch oder Kneeling											
										(L.L.door_kinderwagenwunsch_lampe) (S.L.c2_display_kinderwagen)		
										0 = {if} (L.L.c2_display_kneel2) (S.L.c2_display_o_kneel) {else} 0 (S.L.c2_display_o_kneel) {endif}
										
'									Symbol Rampe	
										(L.L.door_handrampe) 0 = ! (S.L.c2_display_o_rampe)
										
'									Aktueller Gang
										3 (S.L.c2_display_gang)
										(L.L.antrieb_getr_aktugang) s0
										l0 -1 = (L.L.antrieb_getr_gangwahl) 1 < (L.L.antrieb_einleg_lock) 1 < && || {if} 1 (S.L.c2_display_gang) {endif}
										l0 0 = (L.L.antrieb_getr_gangwahl) 1 = && (L.L.antrieb_einleg_lock) 0 > || {if} 2 (S.L.c2_display_gang) {endif}
										l0 1 = (L.L.antrieb_getr_gangwahl) 1 > && (L.L.antrieb_einleg_lock) 1 < && {if} 3 (S.L.c2_display_gang) {endif}
										l0 2 = (L.L.antrieb_einleg_lock) 1 < && {if} 4 (S.L.c2_display_gang) {endif}
										l0 3 = (L.L.antrieb_einleg_lock) 1 < && {if} 5 (S.L.c2_display_gang) {endif}
										l0 4 = (L.L.antrieb_einleg_lock) 1 < && {if} 6 (S.L.c2_display_gang) {endif}
										l0 5 = (L.L.antrieb_einleg_lock) 1 < && {if} 7 (S.L.c2_display_gang) {endif}
										l0 6 = (L.L.antrieb_einleg_lock) 1 < && {if} 8 (S.L.c2_display_gang) {endif}
										
								{else}
									0 (S.L.c2_display_hstbremse) (S.L.c2_display_kinderwagen) (S.L.c2_display_tuer5_offen) (S.L.c2_display_tuer4_offen) (S.L.c2_display_tuer3_offen) (S.L.c2_display_tuer2_offen) (S.L.c2_display_tuer1_offen)  (S.L.c2_display_o_rampe) (S.L.c2_display_o_kneel) (S.L.c2_display_hstbremse)
									(S.L.c2_display_o_haltewunsch) (S.L.c2_display_gang)
								{endif}
								
								
						(L.L.c2_display_menu) 3 <
								{if}	
										(L.L.c2_display_gelb_kuehlwasser) (S.L.c2_display_gelb_kuehlwasser_view)
										(L.L.c2_display_gelb_motoroel) (S.L.c2_display_gelb_motoroel_view)
										(L.L.c2_display_gelb_retarder) (S.L.c2_display_gelb_retarder_view)
										(L.L.c2_display_gelb_kraftstoff) (S.L.c2_display_gelb_kraftstoff_view)
										(L.L.c2_display_gelb_adblue) (S.L.c2_display_gelb_adblue_view)										
										(L.L.c2_display_gelb_batterie) (S.L.c2_display_gelb_batterie_view)													
										(L.L.c2_display_gelb_knick) (S.L.c2_display_gelb_knick_view)		

										(L.L.c2_display_gelb_kuehlwasser_view)
										(L.L.c2_display_gelb_motoroel_view) +
										(L.L.c2_display_gelb_retarder_view) + 
										(L.L.c2_display_gelb_kraftstoff_view) +
										(L.L.c2_display_gelb_adblue_view) +									
										(L.L.c2_display_gelb_batterie_view) + 
										(L.L.c2_display_gelb_knick_view) +
										0 >
											{if}
												1 (S.L.c2_display_gelb_viewseq)
												3 (S.L.c2_display_menu) 
											{endif}										
								{endif}
								
								 
						(L.L.c2_display_menu)  4 = {if}
													
'										Wenn mehr als 1 roter Fehler: Symbol zum Weiterblaettern										
										(L.L.c2_display_rot_system)
										(L.L.c2_display_rot_nothahn) +
										(L.L.c2_display_rot_vorratsdruck1) +
										(L.L.c2_display_rot_vorratsdruck2) +
										(L.L.c2_display_rot_oeldruck) +
										(L.L.c2_display_rot_kuehlwasser) +
										(L.L.c2_display_rot_getriebeoel) +
										(L.L.c2_display_rot_edc) +
										(L.L.c2_display_rot_emr) + 
										(L.L.c2_display_rot_getriebe) +
										1 >
											{if}

'											Darstellung wenn mehrere rote Fehler												
												1 (S.L.c2_display_rot_multiple) (S.L.c2_display_rot_multiple_vis)
												
												(L.L.c2_display_rot_viewseq) 0 =
													{if}
														(L.L.c2_display_rot_system)
															{if}
																"17_display_rot_system.bmp" (S.$.c2_display_texture)																
															{else}
																1 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}
												
												(L.L.c2_display_rot_viewseq) 1 =
													{if}
														(L.L.c2_display_rot_nothahn)
															{if}
																"17_display_rot_nothahn.bmp" (S.$.c2_display_texture)																
															{else}
																2 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	

												(L.L.c2_display_rot_viewseq) 2 =
													{if}
														(L.L.c2_display_rot_vorratsdruck1)
															{if}
																"17_display_rot_vorratsdruck1.bmp" (S.$.c2_display_texture)																
															{else}
																3 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
													
												(L.L.c2_display_rot_viewseq) 3 =
													{if}
														(L.L.c2_display_rot_vorratsdruck2)
															{if}
																"17_display_rot_vorratsdruck2.bmp" (S.$.c2_display_texture)																
															{else}
																4 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
													
												(L.L.c2_display_rot_viewseq) 4 =
													{if}
														(L.L.c2_display_rot_oeldruck)
															{if}
																"17_display_rot_oeldruck.bmp" (S.$.c2_display_texture)																
															{else}
																5 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
													
												(L.L.c2_display_rot_viewseq) 5 =
													{if}
														(L.L.c2_display_rot_kuehlwasser)
															{if}
																"17_display_rot_kuehlwasser.bmp" (S.$.c2_display_texture)																
															{else}
																6 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
													
												(L.L.c2_display_rot_viewseq) 6 =
													{if}
														(L.L.c2_display_rot_getriebeoel)
															{if}
																"17_display_rot_getriebeoel.bmp" (S.$.c2_display_texture)																
															{else}
																7 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
													
												(L.L.c2_display_rot_viewseq) 7 =
													{if}
														(L.L.c2_display_rot_edc)
															{if}
																"17_display_rot_edc.bmp" (S.$.c2_display_texture)																
															{else}
																8 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
												
												(L.L.c2_display_rot_viewseq) 8 =
													{if}
														(L.L.c2_display_rot_emr)
															{if}
																"17_display_rot_emr.bmp" (S.$.c2_display_texture)																
															{else}
																9 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
													
												(L.L.c2_display_rot_viewseq) 9 =
													{if}
														(L.L.c2_display_rot_getriebe)
															{if}
																"17_display_rot_getriebe.bmp" (S.$.c2_display_texture)																
															{else}
																0 (S.L.c2_display_rot_viewseq)
															{endif}
													{endif}	
																									
										
											{else}
'											Darstellung wenn nur 1 roter Fehler											
												0 (S.L.c2_display_rot_multiple) (S.L.c2_display_rot_multiple_vis)
												
												(L.L.c2_display_rot_system)
													{if}
														"17_display_rot_system.bmp" (S.$.c2_display_texture)
													{endif}
												
												(L.L.c2_display_rot_nothahn)
													{if}
														"17_display_rot_nothahn.bmp" (S.$.c2_display_texture)
													{endif}
													
												(L.L.c2_display_rot_vorratsdruck1)
													{if}
														"17_display_rot_vorratsdruck1.bmp" (S.$.c2_display_texture)
													{endif}
													
												(L.L.c2_display_rot_vorratsdruck2)
													{if}
														"17_display_rot_vorratsdruck2.bmp" (S.$.c2_display_texture)													
													{endif}	
													
												(L.L.c2_display_rot_oeldruck)
													{if}
														"17_display_rot_oeldruck.bmp" (S.$.c2_display_texture)													
													{endif}	

												(L.L.c2_display_rot_kuehlwasser)
													{if}
														"17_display_rot_kuehlwasser.bmp" (S.$.c2_display_texture)													
													{endif}	
													
												(L.L.c2_display_rot_getriebeoel) 
													{if}
														"17_display_rot_getriebeoel.bmp" (S.$.c2_display_texture)													
													{endif}	

												(L.L.c2_display_rot_edc)
													{if}
														"17_display_rot_edc.bmp" (S.$.c2_display_texture)												
													{endif}	
													
												(L.L.c2_display_rot_emr)
													{if}
														"17_display_rot_emr.bmp" (S.$.c2_display_texture)													
													{endif}	

												(L.L.c2_display_rot_getriebe)
													{if}
														"17_display_rot_getriebe.bmp" (S.$.c2_display_texture)
													{endif}	
													
											{endif}										
										
										(L.L.c2_display_rot) ! 
											{if}
												1 (S.L.c2_display_menu) 
												0 (S.L.c2_display_rot_viewseq)  
'												0 (S.L.c2_display_haltemenu_override)
											{endif}
							   {else}	
									0  (S.L.c2_display_rot_multiple_vis) (S.L.c2_display_rot_viewseq)
							   {endif}
								
'**********			Berechnung der Balkendiagramme und Anzeigesymbole
					
'							Bremsdruck				
							(L.L.c2_display_menu) 5 = 
								{if}															
									"17_display_menu5.bmp" (S.$.c2_display_texture)
									
									(L.L.bremse_p_tank01) 100000 / 1.428 *
									"####################################"  $SetLengthL (S.$.c2_display_menu1_leiste2)
									
									(L.L.bremse_p_tank02) 100000 / 1.428 * 
									 "####################################" $SetLengthL (S.$.c2_display_menu1_leiste4)
									 
									(L.L.bremse_p_tank03) (L.L.bremse_p_tank04) + 2 / 100000 / 1.428 * 
									 "####################################" $SetLengthL (S.$.c2_display_menu1_leiste5)																							
													
								{endif} 
													
'							Motor/Batterie				
							(L.L.c2_display_menu) 6 = 
								{if} 
'									"" (S.$.c2_display_menu1_leiste1) (S.$.c2_display_menu1_leiste3)
															
									"17_display_menu6.bmp" (S.$.c2_display_texture)
																								
									(L.L.engine_temperature) 60 - 60 / 20 *
									"####################################"  $SetLengthL (S.$.c2_display_menu1_leiste2)									
								
									(L.L.antrieb_temperature) 60 - 80 / 20 *
									"####################################" $SetLengthL (S.$.c2_display_menu1_leiste4)
									 
									(L.L.elec_V_battery) 0.66666 - 30 *
									 "####################################" $SetLengthL (S.$.c2_display_menu1_leiste5)							
								{endif}  
								
							(L.L.c2_display_menu) 5 < 	
								{if}
									"" (S.$.c2_display_menu1_leiste1) (S.$.c2_display_menu1_leiste2) (S.$.c2_display_menu1_leiste3) (S.$.c2_display_menu1_leiste4) (S.$.c2_display_menu1_leiste5)
								{endif}  
								

'							Fahr-/Haltemenu						
							(L.L.c2_display_menu) 3 <
							(L.L.c2_display_seq) ! &&
								{if}
'								Automatische Umschaltung Halte-/Fahrmenu nur wenn keine rote Stoerung						
								
								(L.L.c2_display_rot) !
									{if}							
										(L.L.door_freigabe)
										(L.L.door_0) 0 > ||
										(L.L.door_1) 0 > ||
										(L.L.door_2) 0 > ||
										(L.L.door_3) 0 > ||
										(L.L.door_4) 0 > ||
										(L.L.door_5) 0 > ||
										(L.L.bremse_halte) ||
										(L.L.bremse_feststell) ||
										(L.L.bremse_anfahrsperre) ||
										(L.L.engine_injection_on) ! ||
										(L.L.kneeling) 0 = ! ||
										(L.L.Velocity) (C.L.doors_maxvspeed) < &&
										(L.L.c2_display_haltemenu_override) ! &&
											{if}
												(L.L.c2_display_haltemenu) 0.025 + 1 min (S.L.c2_display_haltemenu) 
											{else}	
												(L.L.c2_display_haltemenu) 0.025 - 0 max (S.L.c2_display_haltemenu)												
											{endif}	
											
										 (L.L.c2_display_haltemenu) 1 >= 
'										 (L.L.c2_display_haltemenu_timer) ||
										  {if}
										  
'	++++++++++++++++++++++++++++++++++++	Haltemenu ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

										     	 "45_display_menu1.bmp" (S.$.c2_display_texture) ""												 										 
												1 (S.L.c2_display_menu)

												1 (S.L.c2_display_haltemenu_timer)
												0 (S.L.c2_display_retarder) (S.L.c2_display_knickschutz) (S.L.c2_display_o_klima)  (S.L.c2_display_niveau)
												  (S.L.c2_display_o_keinemeldung) (S.L.c2_display_zusatzheizung) (S.L.c2_display_scheibenheizung) (S.L.c2_display_o_acaus)

'											Tuerfreigabe

												(L.L.door_freigabe) (L.L.c2_display_tuer3_offen) ! &&
												(S.L.c2_display_tuer2_frei)												 														
										
												(L.L.door_freigabe) (L.L.c2_display_tuer2_offen) ! &&
												(S.L.c2_display_tuer3_frei)		

												(L.L.door_freigabe) (L.L.c2_display_o_tuer4_offen) ! &&
												(S.L.c2_display_tuer4_frei)	
												
												(L.L.door_freigabe) (L.L.c2_display_o_tuer5_offen) ! &&
												(S.L.c2_display_tuer5_frei)													

'											Tuerstatus

												(L.L.c2_display_tuer1_offen) (S.L.c2_display_o_tuer1_offen)
												(L.L.c2_display_tuer2_offen) (S.L.c2_display_o_tuer3_offen)
												(L.L.c2_display_tuer3_offen) (S.L.c2_display_o_tuer2_offen)
												(L.L.door_6) 0.1 > (L.L.door_7) 0.1 > || (S.L.c2_display_o_tuer4_offen)
												(L.L.door_8) 0.1 > (L.L.door_9) 0.1 > || (S.L.c2_display_o_tuer5_offen)
												
'											Tuersperre
												(L.L.door_0_locked_elec) (S.L.c2_display_lockdoor1)
												(L.L.door_1_locked_elec) (S.L.c2_display_lockdoor2)
												
'											Gebremste Achsen											
												(L.L.bremse_feststell) 
												(L.L.bremse_anfahrsperre) || 
												(L.L.bremse_halte) ||
												(S.L.c2_display_HA) (S.L.c2_display_MA)		 

												(L.L.bremse_anfahrsperre)
												(L.L.bremse_halte) ||
												(S.L.c2_display_VA)			
												
'											Rampe																		 						
												(L.L.c2_display_o_rampe) (S.L.c2_display_rampe)	
												
'											Anzeige Absenkeinrichtung	
												(L.L.kneeling) 0 =	(L.L.niveau_setlevel_dir) ! &&	(L.L.niveau_fehler) ! &&											
													{if}
														0 (S.L.c2_display_kneel1) 0 (S.L.c2_display_kneel2)
													{endif}
													
												(L.L.kneeling) 1 = (L.L.Axle_Springfactor_0_R) 0.79 > && (L.L.niveau_setlevel_dir) || (L.L.niveau_fehler) ||														
													{if}
														1 (S.L.c2_display_kneel1) 0 (S.L.c2_display_kneel2)
													{endif}	
												
												(L.L.kneeling) 1 = (L.L.Axle_Springfactor_0_R) 0.79 <= &&													
													{if}
														0 (S.L.c2_display_kneel1) 1 (S.L.c2_display_kneel2)
													{endif}		
												
												(L.L.kneeling) 2 = (L.L.Axle_Springfactor_0_R) 0.79 > &&													
													{if}
														1 (S.L.c2_display_kneel1) 0 (S.L.c2_display_kneel2)
													{endif}	
												
												(L.L.kneeling) 2 = (L.L.Axle_Springfactor_0_R) 0.79 <= &&													
													{if}
														0 (S.L.c2_display_kneel1) 1 (S.L.c2_display_kneel2)
													{endif}			
												
											
										   {endif}					
											

													
											(L.L.c2_display_haltemenu) 0 =
										    {if}
'++++++++++++++++++++++++++++++++++++++++++ Fahrtmenu +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	
											
												2 (S.L.c2_display_menu)
												
'												Fahrtmenu Information Retarder												 
												(L.L.antrieb_retardermoment)  (L.L.bremse_halte) ! &&
												(S.L.c2_display_retarder)			

												(L.L.c2klima_fahrgast) ! (S.L.c2_display_o_acaus)

'												Immer ausblenden im Fahrtmenu
												0  (S.L.c2_display_rampe) 
												(S.L.c2_display_VA)	(S.L.c2_display_MA) (S.L.c2_display_HA)	 (S.L.c2_display_kneel1)  (S.L.c2_display_kneel2) (S.L.c2_display_o_battery)
												(S.L.c2_display_tuer2_frei) (S.L.c2_display_tuer3_frei)	 (S.L.c2_display_tuer4_frei)	 (S.L.c2_display_tuer5_frei)	
												(S.L.c2_display_o_tuer1_offen) (S.L.c2_display_o_tuer2_offen) (S.L.c2_display_o_tuer3_offen) (S.L.c2_display_o_tuer4_offen) (S.L.c2_display_o_tuer5_offen)  (S.L.c2_display_lockdoor1) (S.L.c2_display_lockdoor2)	  											
											{endif}											
											
									{endif}
								{else}
									
									0 (S.L.c2_display_tuer3_frei) (S.L.c2_display_tuer2_frei) (S.L.c2_display_tuer4_frei)	 (S.L.c2_display_tuer5_frei) (S.L.c2_display_o_tuer1_offen) (S.L.c2_display_o_tuer2_offen) (S.L.c2_display_o_tuer3_offen) (S.L.c2_display_o_tuer4_offen) (S.L.c2_display_o_tuer5_offen)
									(S.L.c2_display_VA) (S.L.c2_display_MA) (S.L.c2_display_HA) (S.L.c2_display_rampe) (S.L.c2_display_kneel1)  (S.L.c2_display_kneel2) 
									(S.L.c2_display_zusatzheizung) (S.L.c2_display_scheibenheizung) 
									(S.L.c2_display_rollstuhl) (S.L.c2_display_o_battery) (S.L.c2_display_o_klima) (S.L.c2_display_o_absasr)
									(S.L.c2_display_o_keinemeldung) (S.L.c2_display_o_keinemeldung_timer)  (S.L.c2_display_niveau)
									 (S.L.c2_display_lockdoor1) (S.L.c2_display_lockdoor2) (S.L.c2_display_o_acaus)
								{endif}
																				
'**********    Ende betriebsbereit	  ***********			
			   {endif}
		
'	Wenn Strom aus oder Stoerung der Elektrik			
		{else}		
			0 (S.L.c2_display_seq) (S.L.c2_display_menu)  (S.L.c2_display_feststell) (S.L.c2_display_tuer1_offen) (S.L.c2_display_tuer2_offen) (S.L.c2_display_tuer3_offen) (S.L.c2_display_tuer4_offen) (S.L.c2_display_tuer5_offen) (S.L.c2_display_tuer3_frei)  (S.L.vdv_radio)
			0 (S.L.c2_display_tuer2_frei) (S.L.c2_display_MA) (S.L.c2_display_HA) (S.L.c2_display_haltemenu_timer) (S.L.c2_display_haltemenu) (S.L.c2_display_retarder) (S.L.c2_display_o_klima)  (S.L.c2_display_kneel1)  (S.L.c2_display_rampe)   
			0 (S.L.c2_display_kneel2) (S.L.c2_display_gelb_kuehlwasser_view) (S.L.c2_display_gelb_motoroel_view) (S.L.c2_display_gelb_retarder_view) (S.L.c2_display_gelb_kraftstoff_view) (S.L.c2_display_gelb_adblue_view)
			0 (S.L.c2_display_gelb_batterie_view) (S.L.c2_display_gelb_knick_view) (S.L.c2_display_rot_multiple) (S.L.c2_display_rot_multiple_vis) (S.L.c2_display_inittimer) (S.L.c2_display_asr) (S.L.c2_display_knickschutz) (S.L.c2_display_kinderwagen)
			0 (S.L.c2_display_rollstuhl) (S.L.c2_display_o_battery) (S.L.c2_display_o_neutral) (S.L.c2_display_o_keinemeldung) (S.L.c2_display_o_keinemeldung_timer) (S.L.c2_display_o_rampe) (S.L.c2_display_niveau) (S.L.c2_display_o_absasr)
			0 (S.L.c2_display_haltemenu_override)  (S.L.c2_display_zusatzheizung) (S.L.c2_display_scheibenheizung) (S.L.c2_display_hstbremse) (S.L.c2_display_o_tuer1_offen) (S.L.c2_display_o_tuer2_offen) (S.L.c2_display_o_tuer3_offen) (S.L.c2_display_o_tuer4_offen) (S.L.c2_display_o_tuer5_offen)
			(S.L.c2_display_o_freigabe) (S.L.c2_display_o_kneel)  (S.L.c2_display_gang) (S.L.c2_display_lockdoor1) (S.L.c2_display_lockdoor2) (S.L.c2_display_o_acaus)
			(L.L.c2_display_standby) !
				{if} 
					"c2_display.bmp" (S.$.c2_display_texture)
				{endif} 
			"" (S.$.c2_display_tankvorrat) (S.$.c2_display_adbluevorrat) (S.$.c2_display_menu2_leiste1) (S.$.c2_display_menu1_leiste1) (S.$.c2_display_menu1_leiste2) (S.$.c2_display_menu1_leiste3) (S.$.c2_display_menu1_leiste4) (S.$.c2_display_menu1_leiste5) (S.$.c2_display_uhrzeittemp)
		{endif}	
		
'	Standbymodus

		(L.L.c2_display_an) (L.L.elec_busbar_main_sw) ! && (L.L.c2_display_standby) ! &&
			{if}
			
				(L.L.globaltimer) (S.L.c2_display_standby_time)					
						
				1 (S.L.c2_display_standby)
				
				"17_display_start.bmp" (S.$.c2_display_texture)	
				"" (S.$.c2_display_tankvorrat) (S.$.c2_display_adbluevorrat) (S.$.c2_display_uhrzeittemp) 
				0 (S.L.c2_display_feststell) (S.L.c2_display_tuer1_offen) (S.L.c2_display_tuer2_offen) (S.L.c2_display_tuer3_offen) (S.L.c2_display_tuer4_offen) (S.L.c2_display_tuer5_offen) (S.L.c2_display_o_tuer4_offen) (S.L.c2_display_o_tuer5_offen) (S.L.c2_display_tuer5_frei) (S.L.c2_display_tuer4_frei) (S.L.c2_display_tuer3_frei) (S.L.c2_display_tuer2_frei) (S.L.c2_display_scheibenheizung)
				(S.L.c2_display_VA) (S.L.c2_display_MA) (S.L.c2_display_HA) (S.L.c2_display_o_rampe)  (S.L.c2_display_rampe) 
				(S.L.c2_display_retarder) (S.L.c2_display_kneel1)  (S.L.c2_display_kneel2) (S.L.c2_display_asr) (S.L.c2_display_knickschutz) 
				(S.L.c2_display_kinderwagen) (S.L.c2_display_rollstuhl) (S.L.c2_display_o_battery) (S.L.c2_display_o_neutral) (S.L.c2_display_o_klima)  (S.L.c2_display_o_absasr)
				(S.L.c2_display_feststell)  (S.L.c2_display_o_keinemeldung) (S.L.c2_display_o_keinemeldung_timer) (S.L.c2_display_niveau) (S.L.c2_display_haltemenu_override)  (S.L.c2_display_zusatzheizung) (S.L.c2_display_hstbremse)
				(S.L.c2_display_o_tuer1_offen) (S.L.c2_display_o_tuer2_offen) (S.L.c2_display_o_tuer3_offen) (S.L.c2_display_o_tuer4_offen) (S.L.c2_display_o_tuer5_offen) (S.L.c2_display_o_freigabe) (S.L.c2_display_o_kneel)  (S.L.c2_display_gang) (S.L.c2_display_lockdoor1) (S.L.c2_display_lockdoor2) (S.L.c2_display_o_acaus)
			
			{endif}	
			
		(L.L.globaltimer) (L.L.c2_display_standby_time) (C.L.c2_display_standby_sec) + > (L.L.elec_busbar_main_sw) ||
		(L.L.c2_display_standby) &&			
			{if}
				0 (S.L.c2_display_standby) (S.L.c2_display_standby_time) (S.L.c2_display_an) (S.L.c2_display_seq) (S.L.c2_display_menu) 
			{endif}
			
'   Stoerungen fuer VDV-Display
	(L.L.c2_display_an)
	{if}

'	NIVEAU ROT

'	Systemausfall
	(L.L.elec_failure_general)
		{if}
			1 (S.L.c2_display_rot_system) 
		{else}
			0 (S.L.c2_display_rot_system)
		{endif}
		
'	Nothahn
	(L.L.doorEntriegelung_01)
	(L.L.doorEntriegelung_23) ||
	(L.L.doorEntriegelung_45) ||
	(L.L.doorEntriegelung_67) ||
	(L.L.doorEntriegelung_89) ||
		{if}
			1 (S.L.c2_display_rot_nothahn) 
		{else}
			0 (S.L.c2_display_rot_nothahn)
		{endif}

'	Vorratsdruck Kreis 1
	(L.L.bremse_p_tank01) 600000 <
	(S.L.c2_display_rot_vorratsdruck1)
	
'	Vorratsdruck Kreis 2
	(L.L.bremse_p_tank02) 600000 <
	(S.L.c2_display_rot_vorratsdruck2)
	
'	Oeldruck
	(L.L.cockpit_oeldruck) 0.5 <  
	(L.L.engine_on) &&
		{if}
			1 (S.L.c2_display_rot_oeldruck)
		{else}
			0 (S.L.c2_display_rot_oeldruck)
		{endif}
		
'	Kuehlwasser
	(L.L.engine_temperature) 110 > 
		{if}
			1 (S.L.c2_display_rot_kuehlwasser)
		{else}
			0 (S.L.c2_display_rot_kuehlwasser)
		{endif}

'	Getriebeoel
	(L.L.antrieb_temperature) 150 > 
		{if}
			1 (S.L.c2_display_rot_getriebeoel)
		{else}
			0 (S.L.c2_display_rot_getriebeoel)
		{endif}	
		
'	EDC
	(L.L.antrieb_EMR_failure)  
	(L.S.Day) 2 % 0.5 > &&
		{if}
			1 (S.L.c2_display_rot_edc)
		{else}
			0 (S.L.c2_display_rot_edc)
		{endif}		

'	EMR
	(L.L.antrieb_EMR_failure)
	(L.S.Day) 2 % 0.5 <= &&
		{if}
			1 (S.L.c2_display_rot_emr)
		{else}
			0 (S.L.c2_display_rot_emr)
		{endif}		

'	Getriebe
	(L.L.antrieb_failure_general)
		{if}
			1 (S.L.c2_display_rot_getriebe)
		{else}
			0 (S.L.c2_display_rot_getriebe)
		{endif}			
		
'	NIVEAU GELB	

'	Knickwinkel
	(L.L.knickschutz_vorwarn) (S.L.c2_display_gelb_knick)

'	Keine Batterieladung
	(L.L.elec_busbar_main) (C.L.elec_busbar_Vmin) < (L.L.elec_busbar_main_sw) &&
	(L.L.elec_V_generator) ! (L.L.engine_on) && (L.L.engine_ignition) 2 < && ||
	(L.L.generator_failure) (L.L.engine_on) && ||
	(L.L.engine_failure_general) ||
	(S.L.c2_display_gelb_batterie)		
		
'	Kuehlwasser / Motoroel
	(L.L.engine_temperature) 100 >
		{if}
			(L.S.Day) 2 % 0.5 >	
				{if} 
					1 (S.L.c2_display_gelb_kuehlwasser)
				{else} 
					1 (S.L.c2_display_gelb_motoroel)
				{endif}			
		{else}
			0 (S.L.c2_display_gelb_kuehlwasser) (S.L.c2_display_gelb_motoroel)
		{endif}		

'	Retarder
	(L.L.antrieb_retardermoment) -500 <	(L.L.antrieb_temperature) 115 > &&
	(L.L.antrieb_failure_general) ||
		{if}
			1 (S.L.c2_display_gelb_retarder)
		{endif}
		
	(L.L.antrieb_temperature) 100 <
	(L.L.antrieb_failure_general) ! && 
		{if}
			0 (S.L.c2_display_gelb_retarder)
		{endif}			
	
'	Kraftstoff
	(L.L.tank_percent) 0.1 <
		{if}
			1 (S.L.c2_display_gelb_kraftstoff)
		{else}
			0 (S.L.c2_display_gelb_kraftstoff)
		{endif}	

'	Adblue
	(L.L.adblue_content) 8 <
		{if}
			1 (S.L.c2_display_gelb_adblue)
		{else}
			0 (S.L.c2_display_gelb_adblue)
		{endif}	
		
	{else}

'		Stoerungen werden geloescht wenn Display aus:
		0 (S.L.c2_display_gelb_kuehlwasser) (S.L.c2_display_gelb_motoroel) (S.L.c2_display_gelb_batterie) (S.L.c2_display_gelb_knick) (S.L.c2_display_gelb_retarder) (S.L.c2_display_gelb_kraftstoff) (S.L.c2_display_gelb_adblue)  
		(S.L.c2_display_rot_multiple) (S.L.c2_display_rot) (S.L.c2_display_rot_system) (S.L.c2_display_rot_nothahn) (S.L.c2_display_rot_vorratsdruck1) (S.L.c2_display_rot_vorratsdruck2) 
		(S.L.c2_display_rot_oeldruck) (S.L.c2_display_rot_kuehlwasser) (S.L.c2_display_rot_getriebeoel) (S.L.c2_display_rot_edc) (S.L.c2_display_rot_emr) (S.L.c2_display_rot_getriebe) (S.L.c2_display_gelb)
		(S.L.c2_display_rot_multiple_vis) (S.L.c2_display_rot_multiple)	(S.L.c2_display_inittimer)
		
		"" (S.$.cp_odo_km) (S.$.cp_odo_m)
	
	{endif}

'	Unterscheidung Fahrt/Halt fuer Stoermenue gelb
					
		(L.L.door_freigabe)
		(L.L.door_2) 0 > ||
		(L.L.bremse_halte) ||
		(L.L.bremse_feststell) ||
		(L.L.bremse_anfahrsperre) ||
		(L.L.engine_injection_on) ! ||
		(L.L.Velocity) (C.L.doors_maxvspeed) < &&
		(L.L.c2_display_rot) ! &&
			{if}
				1 (S.L.c2_display_halt)
			{else}	
				0 (S.L.c2_display_halt) (S.L.c2_display_haltemenu_override)
			{endif}		
			
{end}