'############## 'LightScript '############## 'Simulates lighting system '(c) 11.05.2009 R�diger H�lsmann '(c) 02.01.2011 Marcel Kuhnt 'Script Version: 1.1 'Omsi release: 1.0 'Needs: '- Cockpit (Batterietrennschalter) '- Door (Haltestellenbremse f�r Bremslicht) 'Revision History: '- R�diger H�lsmann 11.05.2009 Bremslichter an Bremsdruck gekoppelt '- Marcel Kuhnt 10.06.2009 Schl�sselschalter-Logik f�r Stand- und Abbl.-licht ver�ndert, Fernlicht hinzugef�gt '- Marcel Kuhnt 10.08.2009 Added Revision History '- Marcel Kuhnt & R�H 22.10.2009 Removed Light Switch Sound (added to cockpit) '- R�diger H�lsmann 28.10.2009 Added changeover variable for lower level and front right interior light (fixed light overlay problem) '- R�diger H�lsmann 18.07.2010 Light switch adapted to new ignition key algorithm '- Marcel Kuhnt 21.09.2010 Changed interpretation of AI_Light, light flasher '- R�diger H�lsmann 15.11.2010 AI-warning lights '- R�diger H�lsmann 21.11.2010 Interiour and warning lights independent from busbar_main, blinker fix (situation reload) '- R�diger H�lsmann 27.11.2010 Warning lights bug removed '- R�diger H�lsmann 08.12.2010 Light bug "untenohnevornerechts" removed '- Marcel Kuhnt 28.12.2010 Extracted AI lighting in separated macro (for using with AI script) '- Marcel Kuhnt 02.01.2011 Corrected AI warn blinker deactivation '- R�diger H�lsmann 02.01.2011 Driver light fixed '- R�diger H�lsmann 05.01.2011 Fog lamp '- R�diger H�lsmann 07.01.2011 highbeam switch sound '- R�diger H�lsmann 18.01.2011 Blinker switch on sound added '------------------------------------------------------------------------------------------ {trigger:kw_fernlicht_toggle} (L.L.lights_sw_fern) ! (S.L.lights_sw_fern) 1 (S.L.lights_sw_fern_blink) {end} {trigger:kw_fernlicht_toggle_off} 0 (S.L.lights_sw_fern_blink) {end} {trigger:kw_scheinwerfer_toggle} (L.L.cp_lightsw_rot) 'Wenn Schl�sselposition Aus oder Standlicht dann Abbl-Licht 0.05 < {if} 4.8 (S.L.cp_lightsw_rot) 'Wenn Schl�sselposition Abbl.-Licht dann Aus {else} 0 (S.L.cp_lightsw_rot) {endif} (T.L.ev_light_sw) {end} {trigger:kw_standlicht_toggle} (L.L.cp_lightsw_rot) 'Wenn Schl�sselposition Aus oder Abbl-Licht dann Standlicht (L.L.cp_lightsw_rot) 0.05 < {if} 2.5 (S.L.cp_lightsw_rot) 'Wenn Schl�sselposition Standlicht dann Aus {else} 0 (S.L.cp_lightsw_rot) {endif} (T.L.ev_schluessel_dreh) {end} {trigger:cp_lightsw_mov_drag} ' Sonst Rotation (Lichtschalter) (L.S.mouse_x) -20 / (L.L.cp_lightsw_rot) + 0 max 4.852 min (S.L.cp_lightsw_rot) s1 ' Stufen: ' 0: Swiatla wylaczone ' 1: Pozycyjne ' 2: Mijania l1 1.3 < {if} 0 (S.L.cp_lightsw_rot_mode) {else} l1 3.2 < {if} 1 (S.L.cp_lightsw_rot_mode) {else} 2 (S.L.cp_lightsw_rot_mode) {endif} {endif} {end} {trigger:cp_lightsw_mov_off} ' Einrasten auf den festen Positionen: (L.L.cp_lightsw_rot_mode) s1 0 = {if} 0 (S.L.cp_lightsw_rot) {else} l1 1 = {if} 2.5 (S.L.cp_lightsw_rot) {else} 4.8 (S.L.cp_lightsw_rot) {endif} {endif} {end} {trigger:blinker_off} (L.L.lights_sw_blinker) 0 > {if} (T.L.ev_lights_blinker_swoff) 0 (S.L.lights_sw_blinker) {endif} {end} {trigger:blinker_left_move} (L.L.lights_sw_blinker) 0 = {if} 1 (S.L.lights_sw_blinker) (T.L.ev_lights_blinker_swon) (M.L.lights_startblinkgeber) {else} (T.L.ev_lights_blinker_swoff) 0 (S.L.lights_sw_blinker) {endif} {end} {trigger:blinker_right_move} (L.L.lights_sw_blinker) 0 = {if} 2 (S.L.lights_sw_blinker) (T.L.ev_lights_blinker_swon) (M.L.lights_startblinkgeber) {else} (T.L.ev_lights_blinker_swoff) 0 (S.L.lights_sw_blinker) {endif} {end} {trigger:blinker_left_set} (L.L.lights_sw_blinker) 1 = ! {if} (T.L.ev_lights_blinker_swon) {endif} 1 (S.L.lights_sw_blinker) (M.L.lights_startblinkgeber) {end} {trigger:blinker_right_set} (L.L.lights_sw_blinker) 2 = ! {if} (T.L.ev_lights_blinker_swon) {endif} 2 (S.L.lights_sw_blinker) (M.L.lights_startblinkgeber) {end} {trigger:blinker_warn_toggle} (L.L.lights_sw_warnblinker) ! (S.L.lights_sw_warnblinker) {if} (M.L.lights_startblinkgeber) {endif} (T.L.ev_btn_warn_on) 1 (S.L.cp_lights_warnblinker_sw) {end} {trigger:blinker_warn_toggle_off} (T.L.ev_btn_warn_off) 0 (S.L.cp_lights_warnblinker_sw) {end} {macro:lights_frame} (L.L.elec_busbar_main) 1 = (L.L.lights_start_done) 1 = && {if} (L.L.cp_front_fogs_enabled) {if} 1 (S.L.lights_front_fogs) {else} 0 (S.L.lights_front_fogs) {endif} (L.L.cp_rear_fogs_enabled) {if} 1 (S.L.lights_rear_fogs) {else} 0 (S.L.lights_rear_fogs) {endif} (L.L.doors_are_open) 1 = {if} (L.L.cp_warning_doors_sw_active) {if} 1 (S.L.cp_sco_running) 0 (S.L.cp_sco_stop_timer) 1 (S.L.cp_sco_can_running) {else} 0 (S.L.cp_sco_can_running) (S.L.cp_sco_active) (S.L.cp_sco_light) {endif} {else} (L.L.cp_warning_doors_sw_active) 0 = {if} (L.L.cp_sco_stop_timer) 22 < {if} 1 (S.L.cp_sco_can_running) (L.L.cp_sco_stop_timer) (L.S.Timegap) + (S.L.cp_sco_stop_timer) 20 > {if} 0 (S.L.cp_sco_running) (S.L.cp_sco_active) (S.L.cp_sco_light) (S.L.cp_sco_can_running) {endif} {else} 0 (S.L.cp_sco_running) (S.L.cp_sco_active) (S.L.cp_sco_light) (S.L.cp_sco_can_running) {endif} {else} 0 (S.L.cp_sco_running) (S.L.cp_sco_active) (S.L.cp_sco_light) (S.L.cp_sco_can_running) 200 (L.L.cp_sco_stop_timer) {endif} {endif} (L.L.cp_sco_can_running) {if} (L.L.cp_sco_active_interval) (L.S.Timegap) + (S.L.cp_sco_active_interval) 0.35 > {if} 0 (S.L.cp_sco_active_interval) (L.L.cp_sco_active) 0 = {if} 1 (S.L.cp_sco_active) (L.L.vis_sco) 1 = {if} 1 (S.L.cp_sco_light) {endif} {else} 0 (S.L.cp_sco_active) (S.L.cp_sco_light) {endif} {endif} {else} 0 (S.L.cp_sco_running) (S.L.cp_sco_active) (S.L.cp_sco_light) (S.L.cp_sco_can_running) {endif} {else} 0 (S.L.cp_sco_running) (S.L.cp_sco_active) (S.L.cp_sco_light) (S.L.cp_sco_can_running) {endif} (M.L.lights_AI) (M.L.lights_runblinkgeber) (L.L.elec_busbar_main) 1 = (L.L.lights_start_done) 1 = && {if} (L.L.brake) 0.1 > {if} 1.1 (S.L.lights_brems) (S.L.lights_brems_top) {else} (L.L.RetarderCurrent) 0 > (L.L.RetarderSystemsActive) 1 = && (L.L.Velocity) 2 > && {if} 1.1 (S.L.lights_brems) (S.L.lights_brems_top) {else} (L.L.lights_brems_stand) 1 = {if} 0 (S.L.lights_brems) {else} 0 (S.L.lights_brems) {endif} 0 (S.L.lights_brems_top) {endif} {endif} {else} 0 (S.L.lights_brems) (S.L.lights_front_fogs) (S.L.lights_stand) (S.L.lights_rear_fogs) (S.L.lights_front_1) (S.L.lights_fern) (S.L.lights_abbl) (S.L.lights_blinker_l) (S.L.lights_blinker_r) (S.L.cockpit_light_blink_l) (S.L.cockpit_light_blink_r) {endif} (L.L.engine_n) 100 > (L.L.engine_n) 400 < && (L.L.engine_button_start_on) 1 = && {if} 1 (S.L.lights_start_done) {else} 1 (S.L.lights_start_done) 1 (S.L.engine_button_start_on) (L.L.cp_lightsw_rot_mode) 1 = {if} 1 (S.L.lights_stand) {endif} {endif} (L.L.elec_busbar_main) {if} (L.L.cp_lightsw_rot) 2.2 > {if} 1 (S.L.lights_day) {else} (L.L.engine_n) 350 > {if} 1 (S.L.lights_day) {else} 0 (S.L.lights_day) {endif} {endif} {else} 0 (S.L.lights_day) {endif} (L.L.elec_busbar_main) (L.L.antrieb_getr_aktugang) -1 = && {if} 1 (S.L.lights_reverse) {else} 0 (S.L.lights_reverse) {endif} (L.L.elec_busbar_main) {if} (L.L.lights_sw_blinker) 1 = (L.L.elec_busbar_main) && (L.L.lights_sw_warnblinker) || (L.L.cp_warning_doors_sw_active) || (L.L.lights_blinkgeber) && (S.L.lights_blinker_l) {else} 0 (S.L.lights_blinker_l) {endif} (L.L.elec_busbar_main) {if} (L.L.lights_sw_blinker) 2 = (L.L.elec_busbar_main) && (L.L.lights_sw_warnblinker) || (L.L.cp_warning_doors_sw_active) || (L.L.lights_blinkgeber) && (S.L.lights_blinker_r) {else} 0 (S.L.lights_blinker_l) {endif} 'MCQ: AI-Blinkererkennung: (L.L.AI) ! {if} (L.L.lights_sw_blinker) 1 = (L.L.elec_busbar_main) && (L.L.lights_sw_warnblinker) || (S.L.AI_Blinker_L) (L.L.lights_sw_blinker) 2 = (L.L.elec_busbar_main) && (L.L.lights_sw_warnblinker) || (S.L.AI_Blinker_R) (L.L.lights_fern) {if} 2 {else} (L.L.lights_abbl) {if} 1 {else} (L.L.lights_stand) {if} 0.5 {else} 0 {endif} {endif} {endif} (S.L.AI_Light) (L.L.lights_beleuchtung_oberdeck) (L.L.lights_beleuchtung_unterdeck) && (S.L.AI_Interiorlight) {endif} 'Automatische Blinkerabschaltung: (L.L.Axle_Steering_0_L) (C.L.lights_blinkautom_minLenk) > (L.L.lights_sw_blinker) 2 = && {if} 1 (S.L.lights_blinkautom_r_armed) {else} (L.L.lights_blinkautom_r_armed) {if} (T.L.ev_lights_blinker_swoff) 0 (S.L.lights_sw_blinker) (S.L.lights_blinkgeber) (S.L.lights_blinkautom_r_armed) {endif} {endif} (L.L.Axle_Steering_0_L) /-/ (C.L.lights_blinkautom_minLenk) > (L.L.lights_sw_blinker) 1 = && {if} 1 (S.L.lights_blinkautom_l_armed) {else} (L.L.lights_blinkautom_l_armed) {if} (T.L.ev_lights_blinker_swoff) 0 (S.L.lights_sw_blinker) (S.L.lights_blinkgeber) (S.L.lights_blinkautom_l_armed) {endif} {endif} ' Beleuchtungsfunktionen (L.L.elec_busbar_main) {if} 'Lichterzustand in Abh�ngigkeit vom Schl�sselschalter und Batterierelais setzen: (L.L.cp_taster_nebelschluss_target) (S.L.lights_nebelschluss) (L.L.cp_lightsw_rot) 2.2 > {if} 1 (S.L.lights_stand) 1 (S.L.lights_rueck) 1 (S.L.lights_front_1) (L.L.cp_lightsw_rot) 3.9 > {if} 0 (S.L.Spot_Select) (L.L.engine_n) 350 > {if} 1 (S.L.lights_abbl) {else} 0 (S.L.lights_abbl) -1 (S.L.Spot_Select) {endif} 1 (S.L.lights_brems_stand) 2 (S.L.lights_front_1) {else} -1 (S.L.Spot_Select) 0 (S.L.lights_abbl) (S.L.lights_brems_stand) {endif} {else} 0 (S.L.lights_stand) (S.L.lights_rueck) (S.L.lights_abbl) (S.L.lights_brems_stand) (S.L.lights_front_1) -1 (S.L.Spot_Select) {endif} ' Fernlicht permanant monitoring (L.L.lights_abbl) 0 = (L.L.lights_sw_fern_blink) 0 = && (L.L.lights_sw_fern) && {if} 0 (S.L.lights_sw_fern) {endif} ' Fernlicht (L.L.lights_sw_fern) {if} 1 (S.L.lights_fern) 1 (S.L.Spot_Select) {else} 0 (S.L.lights_fern) {endif} {else} -1 (S.L.Spot_Select) 0 (S.L.lights_stand) (S.L.lights_abbl) (S.L.lights_rueck) (S.L.lights_nebelschluss) (S.L.lights_fern) {endif} (L.L.elec_busbar_avail) {if} ' Beleuchtung Oberdeck (L.L.cp_licht_oberdeck_sw) (S.L.lights_beleuchtung_oberdeck) ' Beleuchtung Unterdeck (L.L.cp_licht_unterdeck_sw) (S.L.lights_beleuchtung_unterdeck) ' Beleuchtung unten rechts (L.L.cp_licht_untenrechts_sw) (S.L.lights_beleuchtung_untenrechts) ' Wechselschaltung Beleuchtung Unterdeck OHNE unten rechts: (L.L.lights_beleuchtung_untenrechts) ! (L.L.lights_beleuchtung_unterdeck) && (S.L.lights_beleuchtung_unterdeck_ohnevornerechts) ' Fahrerlicht (L.L.cp_fahrerlicht_sw) (L.L.cp_lightsw_rot) 0.2 > (L.L.doorTarget_0) && || (L.L.elec_busbar_main) && {if} 1 (S.L.lights_fahrerlicht) {else} 0 (S.L.lights_fahrerlicht) {endif} {else} 0 (S.L.lights_fahrerlicht) (S.L.lights_beleuchtung_oberdeck) (S.L.lights_beleuchtung_unterdeck) (S.L.lights_beleuchtung_untenrechts) (S.L.lights_beleuchtung_unterdeck_ohnevornerechts) {endif} {end} {macro:lights_AI} 'AI-Einfluss auf Beleuchtung: (L.L.AI) {if} (L.L.AI_Blinker_L) (L.L.AI_Engine) 0.5 > && {if} 1 (S.L.lights_sw_blinker) (M.L.lights_startblinkgeber) {else} (L.L.AI_Blinker_R) (L.L.AI_Engine) 0.5 > && {if} 2 (S.L.lights_sw_blinker) (M.L.lights_startblinkgeber) {else} 0 (S.L.lights_sw_blinker) {endif} {endif} (L.L.AI_Blinker_R) (L.L.AI_Blinker_L) && {if} 1 (S.L.lights_sw_warnblinker) (M.L.lights_startblinkgeber) {else} 0 (S.L.lights_sw_warnblinker) {endif} ' {endif} (L.L.AI_Light) {if} (L.L.AI_Engine) 0.5 > {if} (L.L.AI_Light) 0.75 > {if} 1 {else} 0.5 {endif} (S.L.cp_lightsw_rot) (L.L.AI_Light) 1.5 > (S.L.lights_sw_fern) {else} 0.5 (S.L.cp_lightsw_rot) {endif} {else} 0 (S.L.cp_lightsw_rot) (S.L.lights_sw_fern) {endif} (L.L.AI_Interiorlight) (S.L.cp_licht_unterdeck_sw) (S.L.cp_licht_oberdeck_sw) {endif} {end} {macro:lights_init} -1 (S.L.Spot_Select) 0 (S.L.cp_sco_running) (S.L.cp_sco_active) (S.L.cp_sco_light) (S.L.cp_sco_can_running) 30 (S.L.cp_sco_stop_timer) {end} {macro:lights_startblinkgeber} (L.L.elec_busbar_main) (L.L.elec_busbar_avail) (L.L.lights_sw_warnblinker) && || (L.L.cp_warning_doors_sw_active) || (L.L.lights_blinker_running) ! && {if} (L.L.elec_busbar_main) {if} (T.L.ev_lights_blinker_on) (C.L.lights_blinkertime_firston) (S.L.lights_blinkgeber_timegap) 1 (S.L.lights_blinkgeber) (S.L.lights_blinker_running) 0 (S.L.lights_blinker_runtime) {endif} {endif} {end} {macro:lights_runblinkgeber} (L.L.elec_busbar_main) (L.L.lights_sw_blinker) && (L.L.elec_busbar_avail) (L.L.lights_sw_warnblinker) && || (L.L.elec_busbar_main) (L.L.cp_warning_doors_sw_active) && || {if} (L.S.Timegap) (L.L.lights_blinker_runtime) + (S.L.lights_blinker_runtime) (L.L.elec_busbar_main) {if} (L.L.lights_blinker_runtime) (L.L.lights_blinkgeber_timegap) > (L.L.lights_sw_blinker) (L.L.lights_sw_warnblinker) || (L.L.cp_warning_doors_sw_active) || && {if} (L.L.lights_blinkgeber) ! (S.L.lights_blinkgeber) {if} (T.L.ev_lights_blinker_on) (C.L.lights_blinkertime_on) {else} (T.L.ev_lights_blinker_off) (C.L.lights_blinkertime_off) {endif} (S.L.lights_blinkgeber_timegap) 0 (S.L.lights_blinker_runtime) {endif} {endif} (L.L.lights_sw_warnblinker) (L.L.cp_warning_doors_sw_active) || {if} (L.L.lights_blinkgeber) (S.L.lights_warnblinkgeber) {else} 0 (S.L.lights_warnblinkgeber) {endif} {else} 0 (S.L.lights_blinkgeber) (S.L.lights_warnblinkgeber) (S.L.lights_blinker_runtime) (S.L.lights_blinker_running) {endif} {end}