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

'Simuliert alle unmittelbar mit dem Armaturenbrett zusammenhängenden Funktionen

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

'Script Version: 1.0
'Omsi release: 1.0

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


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

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







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

{trigger:cp_naz_up}
	1 (S.L.cp_naz_sw) (S.L.naz_zentrieren)

	(T.L.ev_VDV_toggle_on)
{end}

{trigger:cp_naz_up_off}
	0 (S.L.cp_naz_sw)

	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_naz_dn}
	-1 (S.L.cp_naz_sw)
	0 (S.L.naz_zentrieren)

	(T.L.ev_VDV_toggle_on)
{end}

{trigger:cp_naz_dn_off}
	0 (S.L.cp_naz_sw)

	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_nazh}
	(L.L.cp_nazh_sw) ! (S.L.cp_nazh_sw)

	(L.L.cp_nazh_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:funktaste_1}
	(L.L.cp_funktaste_1_sw) ! (S.L.cp_funktaste_1_sw)

	(L.L.cp_funktaste_1_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:frontheat}
	(L.L.cp_frontheat_sw) ! (S.L.cp_frontheat_sw)

	(L.L.cp_frontheat_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:notloese_hsb}
	(L.L.cp_notloese_hsb) ! (S.L.cp_notloese_hsb)

	(L.L.cp_notloese_hsb) 1 =
	{if}
		(T.L.ev_VDV_on)
		(L.L.elec_busbar_main)
		{if}
			(T.L.ev_stoermeldung)
		{endif}
	{else}
		(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:notloese_p}
	(L.L.cp_notloese_p) ! (S.L.cp_notloese_p)

	(L.L.cp_notloese_p) 1 =
	{if}
		(T.L.ev_VDV_on)
		(T.L.ev_p_notloese)
	{else}
		(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:bordcomputer}
	1 (S.L.bordcomputer_rst)
	(T.L.ev_VDV_toggle_on)
{end}

{trigger:bordcomputer_off}	
	(L.L.bordcomputer_rst_timer) 0.5 <
	{if}
		(L.L.bordcomputer_mode) ! (S.L.bordcomputer_mode)
	{endif}
	0 (S.L.bordcomputer_rst) (S.L.bordcomputer_rst_timer)
	(T.L.ev_VDV_toggle_off)	
{end}

{trigger:automatic_R}

	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang2) (L.L.cockpit_gang3) ||
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 <= !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gangR_toggle) ! (S.L.cockpit_gangR_toggle)
		(L.L.cockpit_gangR) !
		{if}
			1 (S.L.cockpit_gang_r-frei)
		{endif}
		(L.L.cockpit_gangR_toggle) (L.L.cockpit_gang2_toggle) ! (L.L.cockpit_gang3_toggle) ! && &&
		{if}
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			(L.L.brake) 0.1 >
			{if}
			0 (S.L.antrieb_getr_gangvorwahl)
			{endif}
		{endif}
		(L.L.cockpit_gangR) 1 = !
		{if}
			(L.L.cockpit_gangR_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gangR)	
	{else}
		(L.L.antrieb_getr_gangvorwahl) 1 <= 
		(L.L.cockpit_gang3) 0 = &&
		{if}
			(L.L.antrieb_getr_gangvorwahl) 0 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			
			(L.L.brake) 0.1 >
			{if}
			0 (S.L.antrieb_getr_gangvorwahl)
			{endif}
				
			1 (S.L.cockpit_gangR)
		{endif}
	{endif}

{end}

{trigger:automatic_R_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR_toggle) 
		{if}
			0.7 (S.L.cockpit_gangR)
			0 (S.L.cockpit_gang_r-frei)	
		{else}
			(L.L.cockpit_gang3_toggle) (L.L.cockpit_gang2_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}
				(L.L.cockpit_gang2_toggle) 
				{if}
					(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
					3 (S.L.antrieb_getr_gangvorwahl)
				{else}

					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
					1 (S.L.antrieb_getr_gangvorwahl)
				{endif}
				
			{endif}
			0 (S.L.cockpit_gangR) 0 (S.L.cockpit_gang_r-frei)	
		{endif}
	{else}
		(L.L.cockpit_gangR) 1 =
		{if}
			0.7 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}



{trigger:automatic_R_mouse}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang2) (L.L.cockpit_gang3) ||
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 <= !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gangR_toggle) ! (S.L.cockpit_gangR_toggle)
		(L.L.cockpit_gangR) 1 = !
		{if}
			(L.L.cockpit_gangR_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gangR)	
	{else}
		(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}
			(L.L.brake) 0.1 >
			{if}
			0 (S.L.antrieb_getr_gangvorwahl)
			{endif}
	
			1 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}

{trigger:automatic_R_mouse_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR_toggle) 
		{if}
			0.7 (S.L.cockpit_gangR)
		{else}
			(L.L.cockpit_gang3_toggle) (L.L.cockpit_gang2_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}
				(L.L.cockpit_gang2_toggle) 
				{if}
					(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
					3 (S.L.antrieb_getr_gangvorwahl)
				{else}

					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
					1 (S.L.antrieb_getr_gangvorwahl)
				{endif}
				
			{endif}
			0 (S.L.cockpit_gangR)			
		{endif}
	{else}
		(L.L.cockpit_gangR) 1 =
		{if}
			0.7 (S.L.cockpit_gangR)
		{endif}
	{endif}
{end}


{trigger:automatic_N}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR_toggle) s1
		{if}
			1 (S.L.cockpit_gangR) 
		{endif}
		(L.L.cockpit_gang2_toggle) s2
		{if}
			1 (S.L.cockpit_gang2)
		{endif}
		(L.L.cockpit_gang3_toggle) s3
		{if}
			1 (S.L.cockpit_gang3)
		{endif}
		(L.L.cockpit_gang4_toggle) s4
		{if}
			1 (S.L.cockpit_gang4)
		{endif}
	
		l1 l2 l3 l4 || || ||
		{if}
			(T.L.ev_gangwahltaster_old_off)
		{endif}
	{else}
		(L.L.cockpit_gangR) 0.5 >
		(L.L.cockpit_gang1) 0.5 > ||
		(L.L.cockpit_gang2) 0.5 > ||
		(L.L.cockpit_gang3) 0.5 > ||
		(L.L.cockpit_gang4) 0.5 > ||
		{if}
			(T.L.ev_gangwahltaster_N)
		{endif}
		(L.L.antrieb_getr_gangvorwahl) 1 = !
			{if}
				(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_gang1) (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gang4)
	{endif}	
{end}


{trigger:automatic_N_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) -  - (S.L.antrieb_getr_gangwahlzeitpunkt)
		0 (S.L.cockpit_gangR) (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gang4) (S.L.cockpit_gangR_toggle) (S.L.cockpit_gang2_toggle) (S.L.cockpit_gang3_toggle) (S.L.cockpit_gang4_toggle) 
		1 (S.L.antrieb_getr_gangvorwahl)
	{else}
		0 (S.L.cockpit_gangN)
	{endif}
{end}


{trigger:automatic_1}
	(L.L.antrieb_getr_gangvorwahl) 0 > (C.L.cockpit_gangwahltaster_alt) ! &&
	(C.L.cockpit_gear_D_only) ! &&
	{if}
		(L.L.antrieb_getr_gangvorwahl) 2 = !
		{if}
			(T.L.ev_gangwahltaster)
			(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
		{endif}
		2 (S.L.antrieb_getr_gangvorwahl)
		1 (S.L.cockpit_gang1)
		0 (S.L.cockpit_gang2) (S.L.cockpit_gang3) (S.L.cockpit_gang4)
	{endif}

{end}


{trigger:automatic_1_off}
	(L.L.cockpit_gang1) 1 =
	{if}
		0.7 (S.L.cockpit_gang1)
	{endif}
{end}


{trigger:automatic_2}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR)
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 = !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{else}
			(L.L.antrieb_getr_gangvorwahl) 3 = !
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			3 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gang2_toggle) ! (S.L.cockpit_gang2_toggle)
		(L.L.cockpit_gang2) 1 = !
		{if}
			(L.L.cockpit_gang2_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gang2)
	{else}
		(L.L.antrieb_getr_gangvorwahl) 0 >
		(C.L.cockpit_gear_D_only) ! &&
		{if}
			(L.L.antrieb_getr_gangvorwahl) 3 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			3 (S.L.antrieb_getr_gangvorwahl)
			1 (S.L.cockpit_gang2)
			0 (S.L.cockpit_gang1) (S.L.cockpit_gang3) (S.L.cockpit_gang4)
		{endif}
	{endif}
{end}


{trigger:automatic_2_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang2_toggle) 
		{if}
			0.7 (S.L.cockpit_gang2)
		{else}
			(L.L.cockpit_gang2_toggle) (L.L.cockpit_gangR_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				3 (S.L.antrieb_getr_gangvorwahl)
			{else}
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			0 (S.L.cockpit_gang2)			
		{endif}
	{else}
		(L.L.cockpit_gang2) 1 =
		{if}
			0.7 (S.L.cockpit_gang2)
		{endif}
	{endif}
{end}

{trigger:automatic_3}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR)
		{if}
			(L.L.antrieb_getr_gangvorwahl) 1 = !
				{if}
					(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				{endif}
			1 (S.L.antrieb_getr_gangvorwahl)
		{else}
			(L.L.antrieb_getr_gangvorwahl) 4 = !
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			4 (S.L.antrieb_getr_gangvorwahl)
		{endif}
		(L.L.cockpit_gang3_toggle) ! (S.L.cockpit_gang3_toggle)
		(L.L.cockpit_gang3) 1 = !
		{if}
			(L.L.cockpit_gang3_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gang3)
	{else}
		(L.L.antrieb_getr_gangvorwahl) 0 >
		(C.L.cockpit_gear_D_only) ! &&
		{if}
			(L.L.antrieb_getr_gangvorwahl) 4 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			4 (S.L.antrieb_getr_gangvorwahl)
			1 (S.L.cockpit_gang3)
			0 (S.L.cockpit_gang1) (S.L.cockpit_gang2) (S.L.cockpit_gang4)
		{endif}
	{endif}
{end}


{trigger:automatic_3_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang3_toggle) 
		{if}
			0.7 (S.L.cockpit_gang3)
		{else}
			(L.L.cockpit_gang4_toggle) (L.L.cockpit_gangR_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			0 (S.L.cockpit_gang3)			
		{endif}
	{else}
		(L.L.cockpit_gang3) 1 =
		{if}
			0.7 (S.L.cockpit_gang3)
		{endif}
	{endif}
{end}

{trigger:automatic_D}

	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gangR)
		{if}

			(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
			1 (S.L.antrieb_getr_gangvorwahl)
		{else}
			(L.L.cockpit_gang4_toggle) !
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				(L.L.brake) 0.1 >
				{if}
					5 (S.L.antrieb_getr_gangvorwahl)
				{endif}
			{endif}
		{endif}
		(L.L.cockpit_gang4_toggle) ! (S.L.cockpit_gang4_toggle)
		(L.L.cockpit_gang4) 1 = !
		{if}
			(L.L.cockpit_gang4_toggle)
			{if}
				(T.L.ev_gangwahltaster_old_on)
			{else}
				(T.L.ev_gangwahltaster_old_off)
			{endif}
		{endif}
		1 (S.L.cockpit_gang4)
	{else}
		(L.L.antrieb_getr_gangvorwahl) 0 >
		(L.L.cockpit_gangR) 0 = &&
		{if}
			(L.L.antrieb_getr_gangvorwahl) 5 = !
			{if}
				(T.L.ev_gangwahltaster)
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
			{endif}
			(L.L.brake) 0.1 >
			{if}
				5 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			1 (S.L.cockpit_gang4)
			0 (S.L.cockpit_gang1) (S.L.cockpit_gang2) (S.L.cockpit_gang3)	
		
		{endif}
	{endif}

{end}


{trigger:automatic_D_off}
	(C.L.cockpit_gangwahltaster_alt)
	{if}
		(L.L.cockpit_gang4_toggle) 
		{if}
			0.7 (S.L.cockpit_gang4)
		{else}
			(L.L.cockpit_gang3_toggle) (L.L.cockpit_gangR_toggle) ! &&
			{if}
				(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
				4 (S.L.antrieb_getr_gangvorwahl)
			{else}	
				(L.S.getTime) (C.L.antrieb_gangwahlzeit) (C.L.antrieb_neutralwahlzeit) - - (S.L.antrieb_getr_gangwahlzeitpunkt)
				1 (S.L.antrieb_getr_gangvorwahl)
			{endif}
			0 (S.L.cockpit_gang4)
		{endif}
	{else}
		(L.L.cockpit_gang4) 1 =
		{if}
			0.7 (S.L.cockpit_gang4)
		{endif}	
	{endif}
{end}


{trigger:automatic_r-frei}
	1 (S.L.cockpit_gang_r-frei)
	(L.L.cockpit_gangR_toggle) (L.L.cockpit_gang2_toggle) ! (L.L.cockpit_gang3_toggle) ! (L.L.cockpit_gang4_toggle) ! && &&
	{if}
		(L.S.getTime) (S.L.antrieb_getr_gangwahlzeitpunkt)
		0 (S.L.antrieb_getr_gangvorwahl)
	{endif}
{end}

{trigger:automatic_r-frei_off}
	0 (S.L.cockpit_gang_r-frei)
{end}
	

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

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

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

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

{trigger:cp_retarder_direkt_toggle}
	(L.L.cp_retarder_sw_direkt) ! (S.L.cp_retarder_sw_direkt)
	(L.L.cp_retarder_sw_direkt) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}


{trigger:cp_retarder_toggle}
	(C.L.cockpit_has_retarderswitch)
	{if}
		(L.L.cp_retarder_sw) ! (S.L.cp_retarder_sw)
	(L.L.cp_retarder_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
	{endif}
{end}

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

{trigger:cp_fahrerlicht_toggle}
	(L.L.cp_fahrerlicht_sw) ! (S.L.cp_fahrerlicht_sw)
	(L.L.cp_fahrerlicht_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_licht_oberdeck_toggle}
	(L.L.cp_licht_sw) 1 =
	(L.L.cp_licht_sw) -1 = ||
	{if}
		0 (S.L.cp_licht_sw) (S.L.cp_licht_oberdeck_sw) (S.L.cp_licht_unterdeck_sw) 
		(T.L.ev_VDV_on)
	{else}
		1 (S.L.cp_licht_sw) (S.L.cp_licht_oberdeck_sw) 
		(T.L.ev_VDV_off)
	{endif}
{end}

{trigger:cp_licht_unterdeck_toggle}
	(L.L.cp_licht_sw) 1 =
	(L.L.cp_licht_sw) -1 = ||
	{if}
		0 (S.L.cp_licht_sw) (S.L.cp_licht_unterdeck_sw) (S.L.cp_licht_oberdeck_sw) 
		(T.L.ev_VDV_on)
	{else}
		-1 (S.L.cp_licht_sw) 1 (S.L.cp_licht_unterdeck_sw) 
		(T.L.ev_VDV_off)
	{endif}
{end}

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

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

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

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

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

{trigger:cp_heizluefter_toggle}
	(L.L.cp_heizluefter_sw) ! (S.L.cp_heizluefter_sw)
	(L.L.cp_heizluefter_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_spiegelheizung_toggle}
	(L.L.cp_spiegelheizung_sw) ! (S.L.cp_spiegelheizung_sw)
	(L.L.cp_spiegelheizung_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

'By Wizard
{trigger:cp_ASR_toggle}
	(L.L.cp_ASR_sw) ! (S.L.cp_ASR_sw)

	(L.L.cp_ASR_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw01_toggle}
	(L.L.cp_dummy_sw01) ! (S.L.cp_dummy_sw01)
	(L.L.cp_dummy_sw01) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw02_toggle}
	(L.L.cp_dummy_sw02) ! (S.L.cp_dummy_sw02)
	(L.L.cp_dummy_sw02) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
	(L.L.cp_taster_klima) ! (S.L.cp_taster_klima)
	(L.L.cp_heizluefter_sw) ! (S.L.cp_heizluefter_sw)
{end}

{trigger:cp_dummy_sw03_toggle}
	(L.L.cp_dummy_sw03) ! (S.L.cp_dummy_sw03)
	(S.L.door_handsteuerung)
	(L.L.cp_dummy_sw03) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw04_toggle}
	(L.L.cp_dummy_sw04) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw05_toggle}
	(L.L.cp_dummy_sw05) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw06_toggle}
	(L.L.cp_dummy_sw06) ! (S.L.cp_dummy_sw06)
	(L.L.cp_dummy_sw06) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw07_toggle}
	(L.L.cp_dummy_sw07) ! (S.L.cp_dummy_sw07)
	(L.L.cp_heizluefter_sw) ! (S.L.cp_heizluefter_sw)

	(L.L.cp_dummy_sw07) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_window_up}
	-1 (S.L.cp_dummy_sw08)

	(T.L.ev_VDV_toggle_on)
{end}

{trigger:cp_window_up_off}
	0 (S.L.cp_dummy_sw08)

	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_window_down}
	1 (S.L.cp_dummy_sw08)

	(T.L.ev_VDV_toggle_on)
{end}

{trigger:cp_window_down_off}
	0 (S.L.cp_dummy_sw08)

	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_dummy_sw09_toggle}
	(L.L.cp_dummy_sw09) ! (S.L.cp_dummy_sw09)
	(L.L.cp_dummy_sw09) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw10_toggle}
	(L.L.cp_dummy_sw10) ! (S.L.cp_dummy_sw10)
	(L.L.cp_dummy_sw10) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_schalter_ASR_off_toggle}
	(L.L.cp_ASR_off) ! (S.L.cp_ASR_off)
	(L.L.cp_ASR_off) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}
{trigger:cp_dummy_sw11_toggle}
 (L.L.cp_dummy_sw11) ! (S.L.cp_dummy_sw11)
	(L.L.cp_dummy_sw11) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw12_toggle}
 (L.L.cp_dummy_sw12) ! (S.L.cp_dummy_sw12)
	(L.L.cp_dummy_sw10) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw13_toggle}
 (L.L.cp_dummy_sw13) ! (S.L.cp_dummy_sw13)
	(L.L.cp_dummy_sw13) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{trigger:cp_dummy_sw14_toggle}
 (L.L.cp_dummy_sw14) ! (S.L.cp_dummy_sw14)
	(L.L.cp_dummy_sw14) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}




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

{trigger:cp_rollo_drag}

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

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

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

{end}

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

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

{end}

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

{trigger:cp_rollo1_drag}

 (L.L.cp_rollo1_pos) (S.L.cp_rollo1_lastpos)

 1 (S.L.cp_rollo1_dragged)
 0 (S.L.cp_rollo1_speed)
 (L.S.mouse_y) 500 / (L.L.cp_rollo1_pos) + (S.L.cp_rollo1_pos) s0
 l0 0 <
 {if}
  0 (S.L.cp_rollo1_pos)
 {endif}
 l0 1 >
 {if}
  1 (S.L.cp_rollo1_pos)
 {endif}

 (L.L.cp_rollo1_pos) (L.L.cp_rollo1_lastpos) - abs (L.S.Timegap) / (S.L.cp_rollo1_speed)

{end}

{trigger:cp_rollo1_off}
 0 (S.L.cp_rollo1_dragged)
 (T.L.ev_rollo1_end)
{end}



{trigger:cp_rollo1_retract}
 (L.L.cp_rollo1_bommel) 0 = (L.L.cp_rollo1_pos) &&
 {if}
  (T.L.ev_rollo1_retract)
 {endif}
 1 (S.L.cp_rollo1_bommel) (S.L.cp_rollo1_retract)

{end}

{trigger:cp_rollo1_retract_off}
 0 (S.L.cp_rollo1_bommel) (S.L.cp_rollo1_retract) (S.L.cp_rollo1_speed)
{end}

'----------------------------------------------
'Ñêðèïòû êðûøåê
'----------------------------------------------

{trigger:cp_kryshka1_opn_drag}

	(L.L.cp_kryshka1_pos) (S.L.cp_kryshka1_lastpos)

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

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


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


{trigger:cp_kryshka1_opn_off}
	0 (S.L.cp_kryshka1_speed)
{end}

{trigger:cp_kryshka2_opn_drag}

	(L.L.cp_kryshka2_pos) (S.L.cp_kryshka2_lastpos)

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

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


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


{trigger:cp_kryshka2_opn_off}
	0 (S.L.cp_kryshka2_speed)
{end}

{trigger:cp_kryshka3_opn_drag}

	(L.L.cp_kryshka3_pos) (S.L.cp_kryshka3_lastpos)

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

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


	(L.L.cp_kryshka3_pos) (L.L.cp_kryshka3_lastpos) - abs (L.S.Timegap) / (S.L.cp_kryshka3_speed)
{end}


{trigger:cp_kryshka3_opn_off}
	0 (S.L.cp_kryshka3_speed)
{end}

{trigger:cp_kryshka4_opn_drag}

	(L.L.cp_kryshka4_pos) (S.L.cp_kryshka4_lastpos)

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

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


	(L.L.cp_kryshka4_pos) (L.L.cp_kryshka4_lastpos) - abs (L.S.Timegap) / (S.L.cp_kryshka4_speed)
{end}


{trigger:cp_kryshka4_opn_off}
	0 (S.L.cp_kryshka4_speed)
{end}


'Ñêðèïò êëþ÷èêà äëÿ öèòî. Ñíà÷àëî âçÿë Ñëàâêîâñêèé ñêðèïò, ïîòîì ïåðåïèñàë íà ñâîé, ïîòîì çàòåð è íàïèñàë ñâîé çàíîâî, àâòîð Wizard

{trigger:cp_key_rot_drag}
 
 
  (L.S.mouse_y) -30 / (L.L.cp_key_rot) + 0 max 1 min (S.L.cp_key_rot) s1
 
'  0: Îòêëþ÷åíèå ïèòàíèÿ
'  2: Ïèòàíèå âêëþ÷åíî, íî âûêëþ÷åíèå äâèãàòåëÿ
'  3: Êðóòèì ñòàðòåðîì, âîçâðàùàåì â ïîëîæåíèå çàæèãàíèÿ

	l1 0.2 <
		{if}
			0 (S.L.cp_key_rot_mode) 
			0 (S.L.elec_busbar_main_sw)
		{else} 
			l1 0.8 <
			{if}
				1 (S.L.cp_key_rot_mode)

				1 (S.L.elec_busbar_main_sw)
				0 (S.L.engine_injection_on)
			
			{else}
			l1 0.9 <
			{if}
				2 (S.L.cp_key_rot_mode)

			{else}
'				3 (S.L.cp_key_rot_mode)

				(L.L.engine_on) ! 
				(L.L.antrieb_getr_gangwahl) 1 = &&
				(L.L.elec_busbar_main) &&
				{if}
					1 (S.L.engine_on) (S.L.engine_injection_on)
					(T.L.ev_enginestart)
					300 (S.L.engine_n)

			2 (S.L.cp_key_rot_mode)			
			{endif}
		{endif}
	{endif}
{endif}

{end}

{trigger:cp_key_rot_off}

 (L.L.cp_key_rot_mode) 3 / (S.L.cp_key_rot)

{end}

{trigger:cp_schluessel_mov_drag}

'	Fallunterscheidung: Schlüssel in x- oder y-Richtung?
'	
'	(L.S.mouse_y) abs (L.S.mouse_x) abs >=
'	{if}
'
'		Zunächst Translation (Einstecken)
'
'		(L.S.mouse_y) 10 / (L.L.cp_schluessel_trans) + 0 max 1 min (S.L.cp_schluessel_trans) s0
'		
'		Stufen:
'		0: Schlüssel abgezogen
'		1: Schlüssel eingesteckt
'
'		l0 0.5 <
'		{if}
'			0 (S.L.cp_schluessel_trans_mode) (S.L.elec_busbar_main_sw)
'		{else} 
'			1 (S.L.cp_schluessel_trans_mode)
'			1 (S.L.bremse_ABS_selftest)
'
'			Wenn beim Einstecken bereits der Stromkreis geschlossen werden soll, ohne Trennschalter:
'
'			(C.L.automatic_battery_switch)
'			{if}
'				1 (S.L.elec_busbar_main_sw)
'			{endif}		
'		{endif}
'	{else}

'		Sonst Rotation (Lichtschalter)

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

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

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




{trigger:cp_schluessel_mov_off}

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

{end}



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


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

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

{end}

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



{trigger:cp_batterietrennschalter_toggle}
	(L.L.elec_busbar_main_sw) ! (S.L.elec_busbar_main_sw) 
	(L.L.cp_batterietrennschalter_antirepeat) !
	{if}
		(L.L.elec_busbar_main_sw)
		{if}
			(T.L.ev_schluessel_steck)
			1 (S.L.cp_schluessel_trans) (S.L.cp_taster_batterietrennschalter)
			1 (S.L.bremse_ABS_selftest)
			0.8 (S.L.cp_key_rot)
		{else}
			(T.L.ev_schluessel_steck)
			0 (S.L.cp_schluessel_trans)
			0 (S.L.cp_key_rot)
		{endif}
		1 (S.L.cp_batterietrennschalter_antirepeat)
	{endif}
{end}
			
{trigger:cp_batterietrennschalter_toggle_off}
	0 (S.L.cp_batterietrennschalter_antirepeat) (S.L.cp_taster_batterietrennschalter)
{end}			
	



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

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

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

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


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

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

{trigger:cp_klappfenster_OL3}
	(L.L.cp_klappfenster_OL3) ! (S.L.cp_klappfenster_OL3) s1

	(L.L.cp_klappfenster_OL3) 1 =
	{if}
		(T.L.ev_VDV_on)
		(T.L.ev_dach_auf)
	{else}
		(T.L.ev_VDV_off)
		(T.L.ev_dach_zu)
	{endif}	
{end}

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

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

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

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

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

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

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


{trigger:cp_Fahrertuer_drag}

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

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

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


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



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


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

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


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


{trigger:taster_standheizung}

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

	1 (S.L.cp_taster_standheizung)

	(C.L.auxheat_via_button) !
	{if}
		l1 (M.L.kippschaltersound)
		l0 (S.L.cp_taster_standheizung)
	{endif}
		
	(L.L.cp_taster_standheizung_target) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

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

{end}


{trigger:taster_nebelschluss}

	(L.L.cp_taster_nebelschluss_target) ! (S.L.cp_taster_nebelschluss_target)
	1 (S.L.cp_taster_nebelschluss)		
{end}

{trigger:taster_nebelschluss_off}
	
	(L.L.cp_taster_nebelschluss_target)
	{if}
		0.6 (S.L.cp_taster_nebelschluss)
	{else}
		0 (S.L.cp_taster_nebelschluss)
	{endif}

{end}


{trigger:cp_wiperlever_drag}

'	Fallunterscheidung: Hebel in x- oder y-Richtung?

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

			l0 0.17 <
			{if}
				0 (S.L.cockpit_wischerhebel_mode) (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
			{else} 
				l0 0.5 <
				{if}
					1 (S.L.cockpit_wischerhebel_mode) (S.L.cp_wischer_intervall_sw)
					0 (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)
				{else}
					l0 0.83 <
					{if}
						2 (S.L.cockpit_wischerhebel_mode)
						1 (S.L.cp_wischer_einaus_sw)
						0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
					{else}
						3 (S.L.cockpit_wischerhebel_mode)
						1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
						0 (S.L.cp_wischer_intervall_sw)
					{endif}
				{endif}
			{endif}
		{else}
			(L.S.mouse_x) -50 / (L.L.cockpit_wischerhebel_x) + 0 max 1 min (S.L.cockpit_wischerhebel_x) s1

'			Waschanlage (Hebel nach oben)	
			l1 0.9 >
			{if}
				(L.L.cp_wischer_wascher_sw) !
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				1 (S.L.cp_wischer_wascher_sw)
			{else}
				(L.L.cp_wischer_wascher_sw)
				{if}
					(T.L.ev_wischerhebel)
				{endif}
				0 (S.L.cp_wischer_wascher_sw)
			{endif}

		{endif}
	{endif}

{end}

{trigger:cp_wiperlever_off}

'	Einrasten auf den festen Positionen:
	(L.L.cockpit_wischerhebel_mode) 3 / (S.L.cockpit_wischerhebel)
	(L.L.cp_wischer_wascher_sw)
	{if}
		(T.L.ev_wischerhebel)
		0 (S.L.cockpit_wischerhebel_x) (S.L.cp_wischer_wascher_sw)
	{endif}
{end}


{trigger:cp_wiper_turnswitch_drag}

'	(C.L.wiper_turnswitch)
'	{if}
	
		(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.17 <
		{if}
			1 (S.L.cp_wischer_intervall_sw)
			0 (S.L.cockpit_wischer_drehschalter_mode) (S.L.cp_wischer_schnell_sw) (S.L.cp_wischer_einaus_sw)		
		{else} 
			l0 0.5 <
			{if}
				0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
				1 (S.L.cockpit_wischer_drehschalter_mode)
			{else}
				l0 0.83 <
				{if}
					2 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw)
					0 (S.L.cp_wischer_intervall_sw) (S.L.cp_wischer_schnell_sw)
				{else}
					3 (S.L.cockpit_wischer_drehschalter_mode)
					1 (S.L.cp_wischer_einaus_sw) (S.L.cp_wischer_schnell_sw)
					0 (S.L.cp_wischer_intervall_sw)
				{endif}
			{endif}
		{endif}
'	{endif}

{end}

{trigger:cp_wiper_turnswitch_off}

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

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

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


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

{trigger:cp_heizregler_umluft}
 (L.L.cp_heizregler_umluft_sw) ! (S.L.cp_heizregler_umluft_sw)

 0 (S.L.cockpit_heizregler_ventilation_mode)
 
 (L.L.cp_heizregler_umluft_sw) 1 = (L.L.elec_busbar_main) &&
 (S.L.cp_heizregler_umluft_light)
 
{end}


{trigger:cp_heizregler_Direkt}
 (L.L.cp_heizregler_Direkt_sw) ! (S.L.cp_heizregler_Direkt_sw)

 1 (S.L.cockpit_heizregler_ventilation_mode)
 
 (L.L.cp_heizregler_Direkt_sw) 1 = (L.L.elec_busbar_main) &&
 (S.L.cp_heizregler_Direkt_light)
 
{end}

{trigger:cp_heizregler_Frischluft}
 (L.L.cp_heizregler_Frischluft_sw) ! (S.L.cp_heizregler_Frischluft_sw)

 2 (S.L.cockpit_heizregler_ventilation_mode)
 
 (L.L.cp_heizregler_Frischluft_sw) 1 = (L.L.elec_busbar_main) &&
 (S.L.cp_heizregler_Frischluft_light)
 
{end}

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

{trigger:cp_heizregler_fussraum_drag}

'By MR, modified by Wizard | omnibussimulator.ru

	(L.S.mouse_y) -150 / (L.L.cockpit_heizregler_fussraum) + 0 max 1 min (S.L.cockpit_heizregler_fussraum) s0

		l0 0.1 <
			{if}
			0 (S.L.cockpit_heizregler_fussraum_pos)
			{else}
		l0 0.25 <
			{if}
			1 (S.L.cockpit_heizregler_fussraum_pos)
			{else}		
		l0 0.5 <
			{if}
			2 (S.L.cockpit_heizregler_fussraum_pos)
			{else}
		l0 1 =
			{if}
			3 (S.L.cockpit_heizregler_fussraum_pos)
			
			{endif}
			{endif}
			{endif}
			{endif}	
	
{end}

{trigger:cp_heizregler_fussraum_off}


	(L.L.cockpit_heizregler_fussraum_pos) 3 / (S.L.cockpit_heizregler_fussraum)

{end}

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

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

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

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

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

{end}

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

{end}

{trigger:cp_kneel_auto}
	(L.L.kneel_auto_sw) ! (S.L.kneel_auto_sw)
	(L.L.kneel_auto_sw) 1 =
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

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

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

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

	0.333 (S.L.cockpit_wischer_drehschalter)

	1 (S.L.pandus_cls)

	1 (S.L.disp_norm)

	1 (S.L.ele_fenster)	
	1 (S.L.daueranim)

	"umwelt3.png" (S.$.umweltplakette3)
	"umwelt4.png" (S.$.umweltplakette4)

	(C.L.vdv_hasretarderlever) (S.L.vdv_hasretarderlever)
	(C.L.vdv_elec_ign_withbutton) (S.L.vdv_elec_ign_withbutton)
{end}

'----------------------
'	Frame
'----------------------
{macro:cockpit_frame}
'Übertragen der Schalterstellungen:
	(L.L.cp_retarder_sw) (S.L.antrieb_retarder_sw)
	(L.L.cp_retarder_sw_direkt) (S.L.antrieb_retarder_sw_direkt)
	(L.L.cp_wischer_schnell_sw) (S.L.wiper_schnell_sw)
	(L.L.cp_wischer_einaus_sw) (S.L.wiper_einaus_sw)
	(L.L.cp_wischer_intervall_sw) (S.L.wiper_intervall_sw)
	(L.L.cp_wischer_wascher_sw) (S.L.wiper_wascher_sw)

	(M.L.tacho_frame)
	(M.L.uhr_frame)
	(M.L.drehzahlmesser_frame)
	(M.L.hupe_frame)
	(M.L.blinkerhebel_frame)
	(M.L.wischerhebel_frame)
	(M.L.wischer_drehschalter_frame)
	(M.L.oeldruck_frame)
	(M.L.tankuhr_frame)
	(M.L.cockpitlights_frame)
	(M.L.klimator_frame)
	(M.L.schluessel_frame)
	(M.L.odometer_frame)
	(M.L.fahrertuer_frame) 
	(M.L.rollo_frame)
	(M.L.rollo1_frame)
	(M.L.engine_thermometer_frame)
	(M.L.engine_diagnostic)
	(M.L.microphone_frame)
	(M.L.pressure_warning_needle_frame)
	(M.L.zentralschmierung_frame)
	(M.L.Thermometer_frame)
	(M.L.pandus_frame)
	(M.L.fahrerfenster)
	(M.L.Klappsitze_frame)
	(M.L.phys_arms)

'Nachlaufachse Fake Simulation

	(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.door_6) 0 > ||
	(L.L.door_7) 0 > ||
	(L.L.cp_nazh_sw) &&
	(L.L.elec_busbar_main) &&
	{if}
		1 (S.L.naz_lenkbegrenzung)
	{endif}

	(L.L.cp_nazh_sw) !
	(L.L.elec_busbar_main) ! ||
	(L.L.velocity) 15 > ||
	{if}
		0 (S.L.naz_lenkbegrenzung)
	{endif}

	(L.L.velocity) 40 >
	(L.L.elec_busbar_main) ! ||
	{if}
		0 (S.L.naz_zentrieren)
	{endif}

{end}

{macro:Klappsitze_frame}

'	Klappsitz durch Fahrgast

	1 (M.V.GetHumanCountOnSeat) 0 >
	{if}
		1 (S.L.klappsitzR_pax) (S.L.klappsitzR)
	{endif}
		
	1 (M.V.GetHumanCountOnSeat) 0 =
	(L.L.klappsitzR_pax) &&
	(L.L.klappsitzR) &&
	{if}
		0 (S.L.klappsitzR_pax) (S.L.klappsitzR)
	{endif}
	
{end}

{macro:fahrerfenster}

(L.L.elec_busbar_main)
{if}
	(L.L.cp_dummy_sw08) -1 =
	{if}
		(L.L.cp_fahrerfenster_pos) (L.S.timegap) 0.3 * - 0 max (S.L.cp_fahrerfenster_pos)

		(L.L.cp_fahrerfenster_pos) 0 >
		(L.L.cp_fahrerfenster_pos) 0.01 < &&
		{if}
			(T.L.ev_window_up_stop)
		{endif}
		
		(L.L.cp_fahrerfenster_pos) 0 >
		{if}
			1 (S.L.ev_window_up_move)
		{else}
			0 (S.L.ev_window_up_move)
		{endif}
	{endif}
	(L.L.cp_dummy_sw08) 0 =
	{if}
		0 (S.L.ev_window_up_move) (S.L.ev_window_down_move)
	{endif}
	(L.L.cp_dummy_sw08) 1 =
	{if}
		(L.L.cp_fahrerfenster_pos) (L.S.timegap) 0.3 * + 1 min (S.L.cp_fahrerfenster_pos)

		(L.L.cp_fahrerfenster_pos) 1 <
		(L.L.cp_fahrerfenster_pos) 0.99 > &&
		{if}
			(T.L.ev_window_down_stop)
		{endif}

		(L.L.cp_fahrerfenster_pos) 1 <
		{if}
			1 (S.L.ev_window_down_move)
		{else}
			0 (S.L.ev_window_down_move)
		{endif}
	{endif}
{endif}

{end}

{macro:tacho_frame}
	(L.L.Velocity) (F.L.cockpit_tacholinie) (S.L.cockpit_tachowinkel)
	(L.L.engine_n) (F.L.rpm_tacholinie) (S.L.cockpit_rpmwinkel)
{end}

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

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



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

{macro:blinkerhebel_frame}
	(L.L.lights_sw_blinker) 1 =
	{if}	
		-1 (S.L.cockpit_blinkerhebel)
	{else}
		(L.L.lights_sw_blinker) 2 =
		{if}
			1 (S.L.cockpit_blinkerhebel)
		{else}
			0 (S.L.cockpit_blinkerhebel)
		{endif}
	{endif}

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

		(L.L.cp_schluessel_rot) 0.8 >
		{if}
			-0.3 (S.L.cockpit_fernlichthebel)
		{endif}
	{else}
		0 (S.L.cockpit_fernlichthebel)
	{endif}


{end}

{macro:wischerhebel_frame}

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

{macro:wischer_drehschalter_frame}

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



{macro:cockpitlights_frame}

'	Störungsmelder
	(L.L.vdv_display_masterwarn)
	(L.L.vdv_on) &&
	{if}
		(L.L.bremse_p_tank01) 550000 <
		(L.L.bremse_p_tank02) 550000 < ||
		(L.L.vdv_ignition_juststarted) 2 < &&
		(L.L.key_mode) 3 >= &&
		{if}
			(L.L.masterwarn_light_timer) (L.S.Timegap) + 1 min (S.L.masterwarn_light_timer)
			0.5 <
			{if}
				1 (S.L.cockpit_light_masterfailure)
			{else}
				0 (S.L.cockpit_light_masterfailure)
			{endif}
			(L.L.masterwarn_light_timer) 1 =
			{if}
				0 (S.L.masterwarn_light_timer)
			{endif}
		{else}
			1 (S.L.cockpit_light_masterfailure)
		{endif}
	{else}
		0 (S.L.cockpit_light_masterfailure)
	{endif}

'	Türkontrolle
	(L.L.door_kinderwagenwunsch) 1 =
	{if}
		(L.L.kinderwagenwunsch_blinkgeber) (L.S.Timegap) + 2 min (S.L.kinderwagenwunsch_blinkgeber)
		(L.L.kinderwagenwunsch_blinkgeber) 2 =
		{if}
			0 (S.L.kinderwagenwunsch_blinkgeber)
		{endif}
		(L.L.kinderwagenwunsch_blinkgeber) 1 >
		(L.L.vdv_on) &&
		{if}
			1 (S.L.cockpit_light_tuerkontrolle)
		{else}
			0 (S.L.cockpit_light_tuerkontrolle)
		{endif}
	{else}
		0 (S.L.kinderwagenwunsch_blinkgeber)
		0 (S.L.cockpit_light_tuerkontrolle)
	{endif}

'	Batterie
	(L.L.elec_ladekontrolle) ! (L.L.vdv_on) &&
	(S.L.cockpit_light_batterie)
	
	(L.L.bremse_halte)
	(L.L.vdv_on) &&
	(S.L.cockpit_light_bremse_knopf)
	
	(L.L.bremse_halte) !
	(L.L.vdv_on) &&
	(S.L.cockpit_light_bremse_halte)
	

'	Kontrolle Feststellbremse
	(L.L.bremse_p_Brzyl_FBA) 650000 <
	(L.L.vdv_on) &&
	(S.L.cockpit_light_feststellbremse)

'	Geschwindigkeitswarnung
	(L.L.Velocity) 80 > (L.L.vdv_on) &&
	(S.L.cockpit_light_speedwarning)
	
'	Kinderwagenwunsch
	(L.L.door_kinderwagenwunsch) (L.L.vdv_on) &&
	(S.L.cockpit_light_kinderwagenwunsch)

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

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

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

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

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

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

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

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

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

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

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

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

	(L.L.cp_ASR_off) (L.L.elec_busbar_main) &&
	(S.L.cockpit_light_ASR_off)

	(L.L.antrieb_getr_gangwahl) 5 =
	(L.L.cockpit_gang4) 0 > &&
	(L.L.engine_n) 300 > &&
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_gearbox_active) ! &&
	{if}
		1 (S.L.automatic_D_light)
		0 (S.L.gangwahl_error_timer)
	{else}
		(L.L.cockpit_gang4) 0 >
		(L.L.vdv_error_gearbox_active) ||
		{if}
			(L.L.gangwahl_error_timer) (L.S.Timegap) + 1 min (S.L.gangwahl_error_timer)
			0.5 >
			{if}
				1 (S.L.automatic_D_light)
			{else}
				0 (S.L.automatic_D_light)
			{endif}
			(L.L.gangwahl_error_timer) 1 =
			{if}
				0 (S.L.gangwahl_error_timer)
			{endif}
		{else}
			0 (S.L.automatic_D_light)
		{endif}
	{endif}

	(L.L.antrieb_getr_gangwahl) 4 =
	(L.L.cockpit_gang3) 0 > &&
	(L.L.engine_n) 300 > &&
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_gearbox_active) ! &&
	{if}
		1 (S.L.automatic_3_light)
		0 (S.L.gangwahl_error_timer)
	{else}
		(L.L.cockpit_gang3) 0 >
		(L.L.vdv_error_gearbox_active) ||
		{if}
			(L.L.gangwahl_error_timer) (L.S.Timegap) + 1 min (S.L.gangwahl_error_timer)
			0.5 >
			{if}
				1 (S.L.automatic_3_light)
			{else}
				0 (S.L.automatic_3_light)
			{endif}
			(L.L.gangwahl_error_timer) 1 =
			{if}
				0 (S.L.gangwahl_error_timer)
			{endif}
		{else}
			0 (S.L.automatic_3_light)
		{endif}
	{endif}

	(L.L.antrieb_getr_gangwahl) 3 =
	(L.L.cockpit_gang2) 0 > &&
	(L.L.engine_n) 300 > &&
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_gearbox_active) ! &&
	{if}
		1 (S.L.automatic_2_light)
		0 (S.L.gangwahl_error_timer)
	{else}
		(L.L.cockpit_gang2) 0 >
		(L.L.vdv_error_gearbox_active) ||
		{if}
			(L.L.gangwahl_error_timer) (L.S.Timegap) + 1 min (S.L.gangwahl_error_timer)
			0.5 >
			{if}
				1 (S.L.automatic_2_light)
			{else}
				0 (S.L.automatic_2_light)
			{endif}
			(L.L.gangwahl_error_timer) 1 =
			{if}
				0 (S.L.gangwahl_error_timer)
			{endif}
		{else}
			0 (S.L.automatic_2_light)
		{endif}
	{endif}

	(L.L.antrieb_getr_gangwahl) 2 =
	(L.L.cockpit_gang1) 0 > &&
	(L.L.engine_n) 300 > &&
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_gearbox_active) ! &&
	{if}
		1 (S.L.automatic_1_light)
		0 (S.L.gangwahl_error_timer)
	{else}
		(L.L.cockpit_gang1) 0 >
		(L.L.vdv_error_gearbox_active) ||
		{if}
			(L.L.gangwahl_error_timer) (L.S.Timegap) + 1 min (S.L.gangwahl_error_timer)
			0.5 >
			{if}
				1 (S.L.automatic_1_light)
			{else}
				0 (S.L.automatic_1_light)
			{endif}
			(L.L.gangwahl_error_timer) 1 =
			{if}
				0 (S.L.gangwahl_error_timer)
			{endif}
		{else}
			0 (S.L.automatic_1_light)
		{endif}
	{endif}
 
	(L.L.antrieb_getr_gangwahl) 1 = (L.L.elec_busbar_main) &&
	(S.L.automatic_N_light)

	(L.L.antrieb_getr_gangwahl) 0 =
	(L.L.cockpit_gangR) 0 > &&
	(L.L.engine_n) 300 > &&
	(L.L.elec_busbar_main) &&
	(L.L.vdv_error_gearbox_active) ! &&
	{if}
		1 (S.L.automatic_R_light)
		0 (S.L.gangwahl_error_timer)
	{else}
		(L.L.cockpit_gangR) 0 >
		(L.L.vdv_error_gearbox_active) ||
		{if}
			(L.L.gangwahl_error_timer) (L.S.Timegap) + 1 min (S.L.gangwahl_error_timer)
			0.5 >
			{if}
				1 (S.L.automatic_R_light)
			{else}
				0 (S.L.automatic_R_light)
			{endif}
			(L.L.gangwahl_error_timer) 1 =
			{if}
				0 (S.L.gangwahl_error_timer)
			{endif}
		{else}
			0 (S.L.automatic_R_light)
		{endif}
	{endif}

'	Dummy-Schalter:

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

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

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

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

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

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

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

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

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

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



{end}

{macro:oeldruck_frame}
	(L.L.engine_n) (F.L.cockpit_oeldruck) (L.L.engine_temperature) (F.L.oeldruck_kaelte) / s0

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

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

{macro:tankuhr_frame}
	(L.L.engine_tank_content) s0

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

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

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

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

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

{macro:schluessel_frame}

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


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


	(L.L.cp_key_rot_lastmode) (L.L.cp_key_rot_mode) = !
	{if}
		(T.L.ev_schluessel_dreh)
	{endif}
	(L.L.cp_key_rot_mode) (S.L.cp_key_rot_lastmode)
{end}



{macro:traegheit}

'Simuliert träges Verhalten (exponentiell)

'Ladekonventionen:
'	Sollwert		l0
'	Istwert			l1
'	Konstante Anlauf	l2 (Einheiten/s)
'	Konstante Ablauf	l3 (Einheiten/s)

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


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


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

	(L.L.kmcounter_m) (L.L.km_counter_m_last) - 1 >=
	(L.L.kmcounter_m) (L.L.km_counter_m_last) - 0 < ||
	{if}
		(L.L.km_counter_m_day) 1 + (S.L.km_counter_m_day)
		(L.L.kmcounter_m) (S.L.km_counter_m_last)
	{endif}

	(L.L.km_counter_m_day) 999 >
	{if}
		(L.L.km_counter_km_day) 1 + (S.L.km_counter_km_day)
		0 (S.L.km_counter_m_day)
	{endif}

'Odo Reset

	(L.L.bordcomputer_rst)
	{if}
		(L.L.bordcomputer_rst_timer) (L.S.Timegap) + 3 min (S.L.bordcomputer_rst_timer)
		3 =
		{if}
			0 (S.L.km_counter_km_day) (S.L.km_counter_m_day)
		{endif}
	{endif}

'Odometer

'Analog
	""
	(L.L.kmcounter_km) (L.L.kmcounter_m) 1000 / + 10 * trunc 10 / "07" $IntToStrEnh 6 $SetLengthR (S.$.kilometerstand)
	(L.L.kmcounter_m) trunc 100 / $IntToStr 1 $SetLengthR (S.$.kilometerstand_m)

'Digital
	""
	(L.L.kmcounter_km) (L.L.kmcounter_m) 1000 / + 10 * trunc 10 / "07" $IntToStrEnh 6 $SetLengthR "." $+
	(L.L.kmcounter_m) trunc 100 / $IntToStr 1 $SetLengthR $+ (S.$.Odometr_day)
'Kombinieren:
	(L.L.elec_busbar_main)
	{if}
		(L.L.bordcomputer_mode) 0 =
		{if}
			(L.$.Odometr_day) "@" $+ (L.L.km_counter_km_day) $IntToStr $+ "." $+ (L.L.km_counter_m_day) trunc 100 / $IntToStr $+ (S.$.odometr_full)
		{endif}
		(L.L.bordcomputer_mode) 1 =
		{if}
			(L.$.Odometr_day) "@" $+ (L.$.vdo_panel_time) $+ (S.$.odometr_full)
		{endif}
	{else}
		"" (S.$.Odometr_full)	
	{endif}
{end}


{macro:fahrertuer_frame}

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

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

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


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

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

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

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

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

{end}

{macro:rollo_frame}
	(L.L.cp_rollo_pos) (L.L.cp_rollo_rastpos) max (S.L.cp_rollo_rastpos)

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

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

	{endif}
{end}

{macro:rollo1_frame}
 (L.L.cp_rollo1_pos) (L.L.cp_rollo1_rastpos) max (S.L.cp_rollo1_rastpos)

 (L.L.cp_rollo1_dragged) !
 {if}
  (L.L.cp_rollo1_retract)
  {if}
   (L.L.cp_rollo1_speed) (L.S.Timegap) (L.L.cp_rollo1_pos) 14 * * - (S.L.cp_rollo1_speed)
   (L.L.cp_rollo1_pos) (L.S.Timegap) (L.L.cp_rollo1_speed) * + (S.L.cp_rollo1_pos) (S.L.cp_rollo1_rastpos)
     
  {else}
   (L.L.cp_rollo1_pos) (L.L.cp_rollo1_rastpos) < 
   {if}
    (L.L.cp_rollo1_speed) (L.S.Timegap) 14 * + (S.L.cp_rollo1_speed)
    (L.L.cp_rollo1_pos) (L.S.Timegap) (L.L.cp_rollo1_speed) * + (L.L.cp_rollo1_rastpos) min (S.L.cp_rollo1_pos)
   {else}
    0 (S.L.cp_rollo1_speed)
   {endif}
  {endif}

  (L.L.cp_rollo1_pos) 1 >
  {if}
   1 (S.L.cp_rollo1_pos) (S.L.cp_rollo1_rastpos)
  {else}
   (L.L.cp_rollo1_pos) 0 <
   {if}
   0 (S.L.cp_rollo1_pos) (S.L.cp_rollo1_retract) (S.L.cp_rollo1_rastpos)
   {endif}
  {endif}

 {endif}
{end}

{macro:microphone_frame}

	(L.L.Clutch) 0.2 > (L.L.cp_microphone_sw) ||
	(L.L.elec_busbar_main) && s0
	(L.L.Snd_Microphone) s1


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

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


	l0 (S.L.Snd_Microphone)
{end}


{macro:pressure_warning_needle_frame}

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

{end}

{macro:zentralschmierung_frame}

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

{end}

{macro:Thermometer_frame}

	(L.L.Cabinair_Temp) s0 trunc " 3" $IntToStrEnh "." $+ 
	l0 abs l0 abs trunc - 10 * trunc " 1" $IntToStrEnh $+ "C" $+
	(S.$.cockpit_temperatur)

{end}

'By Wizard, modified alterr

{macro:engine_diagnostic}
(L.L.vdv_on)
{if}
(L.L.engine_timer_start) (L.S.Timegap) + 2 min (S.L.engine_timer_start)
{else}
0 (S.L.engine_timer_start)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.cockpit_light_masterfailure) ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_1)
{else}
0 (S.L.indic_1)
{endif}

(L.L.vdv_error_pressure2_active)
(L.L.vdv_error_pressure3_active) ||
(L.L.vdv_error_oilpressure_active) ||
(L.L.vdv_error_EBS_active) ||
(L.L.vdv_error_gearstart_active) ||
(L.L.vdv_error_retarder_active) ||
(L.L.vdv_error_Diesel_active) ||
(L.L.vdv_error_Battery_active) ||
(L.L.vdv_error_light_active) ||
(L.L.vdv_error_EMR_active) ||
(L.L.vdv_error_bsb_active) ||
(L.L.vdv_error_parkbrake_active) ||
(L.L.vdv_error_coolantlevel_active) ||
(L.L.vdv_error_heating_active) ||
(L.L.vdv_display_mode) 6 = &&
(L.L.ecas_rise_active) (L.L.vdv_display_mode) 1 = && ||
(L.L.engine_timer_start) 2 < ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_2)
{else}
0 (S.L.indic_2)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.lights_blinkgeber) ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_3)
{else}
0 (S.L.indic_3)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.lights_fern) ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_4)
{else}
0 (S.L.indic_4)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.cockpit_light_feststellbremse) ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_5)
{else}
0 (S.L.indic_5)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.lights_warnblinkgeber) ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_6)
{else}
0 (S.L.indic_6)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.vdv_on) &&
{if}
1 (S.L.indic_7)
{else}
0 (S.L.indic_7)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.naz_zentrieren) ||
(L.L.naz_lenkbegrenzung) ||
(L.L.vdv_on) &&
{if}
1 (S.L.indic_8)
{else}
0 (S.L.indic_8)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.vdv_on) &&
{if}
1 (S.L.indic_9)
{else}
0 (S.L.indic_9)
{endif}

(L.L.engine_timer_start) 2 <
(L.L.vdv_on) &&
{if}
1 (S.L.indic_10)
{else}
0 (S.L.indic_10)
{endif}

{end}

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

'Kneels button by Wizard

{trigger:cp_kneel_up_toggle}
	(T.L.ev_VDV_toggle_on)
	1 (S.L.cp_kneel_sw)
	0 (S.L.kneel_locked)
{end}
			
{trigger:cp_kneel_up_toggle_off}
	0 (S.L.cp_kneel_sw)
	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_kneel_down_toggle}
	-1 (S.L.cp_kneel_sw)
	1 (S.L.kneel_locked)
	(T.L.ev_VDV_toggle_on)
{end}
			
{trigger:cp_kneel_down_toggle_off}
	0 (S.L.cp_kneel_sw)

	(L.L.doorTarget_0)
	(L.L.doorTarget_1) ||
	(L.L.doorTarget_23) ||
	(L.L.doorTarget_45) ||
	(L.L.kneel_timer) 5 <
	(L.L.kneel_timer) 0 > && &&
	{if}
		0 (S.L.kneel_locked) (S.L.kneel_allowed) (S.L.ecas_kneel)
		1 (S.L.ecas_kneel_up)
	{endif}
	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_notheben}
	(T.L.ev_VDV_toggle_on)
	0 (S.L.kneel_allowed) (S.L.kneel_locked) (S.L.kneel_auto_set)
	1 (S.L.cp_notheben_sw)
{end}
			
{trigger:cp_notheben_off}
	0 (S.L.cp_notheben_sw)
	(T.L.ev_VDV_toggle_off)
{end}

{trigger:cp_klapp_up_toggle}
	(L.L.elec_busbar_main)
		{if}
	1 (S.L.cp_klappfenster_OL2) (S.L.cp_klappfenster_OL3) (S.L.cp_klappfenster_UL1) s1
		{endif}
	
		(T.L.ev_klappfenster_opn)
	
	(M.L.kippschaltersound)
	1 (S.L.cp_klapp_up_mode)
{end}

{trigger:cp_klapp_up_toggle_off}
	
	0 (S.L.cp_klapp_up_mode)	
{end}

{trigger:cp_klapp_down_toggle}
	
	(L.L.elec_busbar_main)
	
	0 (S.L.cp_klappfenster_OL2) (S.L.cp_klappfenster_OL3) (S.L.cp_klappfenster_UL1) s1
	
	(M.L.kippschaltersound)
	(T.L.ev_klappfenster_cls)
	
	1 (S.L.cp_klapp_down_mode)
{end}

{trigger:cp_klapp_down_toggle_off}
	
	0 (S.L.cp_klapp_down_mode)	
{end}


'------------------------------------
'	Ïàíäóñ äëÿ èíâàëèäîâ. Àâòîð ñêðèïòà Dmitri, ñêðèïò âçÿò èç ËèÀç 5292.30.
'	Áëàãîäàðþ àâòîðà çà åãî òðóä!
'------------------------------------
{trigger:Pandus_drag}

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

	(L.S.mouse_y) -200 / (L.L.pandus_pos) + (S.L.pandus_pos) s0
	l0 0 <
	{if}
		0 (S.L.pandus_pos)		
	{endif}
	l0 1 >
	{if}
		1 (S.L.pandus_pos)
	{endif}
'	Îòêðûò èëè çàêðûò ïàíäóñ.		
	(L.L.pandus_pos) 0.4 > (L.L.door_3) &&
	{if}
		1 (S.L.pandus_opn)
		0 (S.L.pandus_cls)
	{endif}
	(L.L.pandus_pos) 0.2 < (L.L.door_3) &&
	{if}
		1 (S.L.pandus_cls)
		0 (S.L.pandus_opn)
	{endif}
	(L.L.pandus_opn) (L.L.door_3) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.45 < 
		{if}
			0.45 (S.L.pandus_pos)
		{endif}
	{endif}
	(L.L.pandus_cls) (L.L.door_3) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.1 > 
		{if}
			0.1 (S.L.pandus_pos)
		{endif}
	{endif}
	(L.L.pandus_pos) (L.L.pandus_lastpos) - (L.S.Timegap) / (S.L.pandus_speed)
{end}


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


'	Ïàíäóñ...

{macro:pandus_frame}

	(L.L.pandus_dragged) !
	{if}
		(L.L.pandus_pos) (L.S.Timegap) (L.L.pandus_speed) * + (S.L.pandus_pos)
		
'	Ïàäåíèå(åñëè ïîäíÿò)
		(L.L.pandus_pos) 0.45 >
		{if}
			(L.L.pandus_speed) (L.S.Timegap) + (S.L.pandus_speed)
		{endif}
		
		(L.L.pandus_pos) 0.45 <
		{if}
			(L.L.pandus_speed) (L.S.Timegap) -1 * + (S.L.pandus_speed)
		{endif}
		

'	Îòñêîê ïðè ìàêñèìàëüíîì îòêð.\çàêð.
		(L.L.pandus_pos) 1 >
		{if}
			1 (S.L.pandus_pos)
'	Îòñêîê
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}

		(L.L.pandus_pos) 0 <
		{if}
			0 (S.L.pandus_pos)
'	Îòñêîê
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}

'	Ïîäïðûãèâàíèå ïðè åçäå ñ îòêðûòûì ïàíäóñîì (íà âñÿêèé... ïîæàðíûé))).
		(L.L.Velocity) 100 / 0.2 min s3
		
		(L.L.pandus_pos) 1 = (L.L.Velocity) 0 > &&
		{if}
			(L.L.pandus_speed) l3 - (S.L.pandus_speed)
		{endif}

'	Ïîëíàÿ îñòàíîâêà.	
		(L.L.Velocity) 2 > (L.L.pandus_pos) 0.5 > &&
		{if}
			0 (S.L.empty_01)
		{endif}
		
		(L.L.pandus_speed) 0 = !
		{if}
			(L.L.pandus_pos) 0.005 < (L.L.pandus_pos) 0.995 > ||
			{if}
				(L.L.empty_01) 1 <
				{if}
					(L.L.empty_01) (L.S.Timegap) + (S.L.empty_01)
				{else}
					0 (S.L.pandus_speed)
				{endif}
			{else}
				0 (S.L.empty_01)
			{endif}
		{endif}
	{endif}

'	Îòêðûò èëè çàêðûò ïàíäóñ.		
	(L.L.pandus_pos) 0.4 > (L.L.door_3) &&
	{if}
		1 (S.L.pandus_opn)
		0 (S.L.pandus_cls)
	{endif}

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

'	Îòñêîê îò çàêðûòîé äâåðè.		
	(L.L.pandus_opn) (L.L.door_3) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.47 < 
		{if}
			0.47 (S.L.pandus_pos)
'	Îòñêîê
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}
	{endif}
		
	(L.L.pandus_cls) (L.L.door_3) 0.9 < &&
	{if}
		(L.L.pandus_pos) 0.1 > 
		{if}
			0.1 (S.L.pandus_pos)
'	Îòñêîê
			(L.L.pandus_speed) /-/ 0.2 * (S.L.pandus_speed)
		{endif}
	{endif}

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

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

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

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

{end}

{macro:kippschaltersound}
	l1
	{if}
		(T.L.ev_VDV_on)
	{else}
		(T.L.ev_VDV_off)
	{endif}	
{end}

{macro:kippschaltersound_toggle}
	l1
	{if}
		(T.L.ev_VDV_toggle_on)
	{else}
		(T.L.ev_VDV_toggle_off)
	{endif}	
{end}

{macro:phys_arms}

 (L.L.A_Trans_X) 9.81 / (C.L.phys_arms_min) min (C.L.phys_arms_max) max (L.L.cp_latcharms) - (C.L.phys_arms_faktor) * (L.S.Timegap) / (L.S.Timegap) (C.L.phys_arms_speed) * /-/ exp (L.L.cp_latcharms_Speed) * + (S.L.cp_latcharms_Speed) (L.S.Timegap) * (L.L.cp_latcharms) + 
 (S.L.cp_latcharms) 
{end}

{macro:klimator_frame}
{end}

