'############## 'Matrix Script '############## 'Simulates 80s style Matrix Line and Terminus Display (Type Annax) '(c) 10.01.2013 Marcel Kuhnt 'Script Version: 1.1 'Omsi release: 1.0 'Needs: '- Cockpit (Batterietrennschalter) '- IBIS 'Revision History: '- Marcel Kuhnt 10.08.2009 Added Revision History '- Marcel Kuhnt 13.04.2010 Added Line List Script '- Marcel Kuhnt 23.04.2010 Line right formatted '- Marcel Kuhnt 05.07.2011 Fehler bereinigt, dass bei KI-Bussen immer am Anfang eine Zeile "verrutscht" '- Marcel Kuhnt 09.07.2012 Neue Busbar-Logik '- Marcel Kuhnt 16.11.2012 Liniencode-115-Problem '- Marcel Kuhnt 04.12.2012 Steckschilder für ausgewählte Ziele '- Marcel Kuhnt 05.12.2012 Auto center '- Marcel Kuhnt 18.12.2012 Seitenschild '- Marcel Kuhnt 13.10.2013 Neuer Seitenschildpfad '- Marcel Kuhnt 20.12.2013 Bugfix: Steckschild-Init '------------------------------------------------------------------------------------------ {macro:Matrix_init} 0 (S.L.Matrix_TerminusIndex_Last) 0 (S.L.Matrix_Nr_Last) " @ @ " (S.$.Matrix_Terminus) (S.$.Matrix_NewTerminus) " " (S.$.Matrix_Nr) (S.$.Matrix_NewNr) 0 (S.L.Matrix_Line_texpos) 'Matrix spinnt, wenn Bus schlecht gewartet: 1000 random (L.L.wearlifespan) * 50 < (S.L.Matrix_spinnt) -1 (S.L.matrix_steckschild_Termindex) 0 (S.L.matrix_steckschild_vis) {end} {trigger:ai_scheduled_settarget} 'Stromversorgung herstellen: 1 (S.L.elec_busbar_main_sw) 1.0 (S.L.elec_V_battery) 'Hier wird die Nummer eingestellt: (L.$.SetLineTo) 3 $SetLengthL (S.$.Matrix_Nr) 'Hier wird das Ziel eingestellt: 1 (S.L.elec_busbar_main_sw) (L.L.AI_target_index) s0 (M.V.GetTerminusCode) s1 'Wenn der Terminus-Code größer als 1000 ist, dann bitte Steckschild verwenden: 1000 > {if} l1 1000 - (S.L.matrix_steckschild_index) l0 (S.L.matrix_steckschild_Termindex) 'Matrix auf 0: 0 (S.L.IBIS_TerminusIndex) s2 {else} l0 (S.L.IBIS_TerminusIndex) s2 -1 (S.L.matrix_steckschild_Termindex) 'Wenn der Bitmap-String in Verwendung ist, dann den als Integer interpretieren und Steckschild zusätzlich setzen: l0 6 (M.V.GetTerminusString) $StrToFloat s1 l1 1000 > {if} l1 1000 - (S.L.matrix_steckschild_index) l0 (S.L.matrix_steckschild_Termindex) {endif} {endif} (M.L.matrix_setsteckschild) l2 (M.V.GetTerminusCode) (S.L.IBIS_TerminusCode) 1 (S.L.matrix_refresh_seitenschild) {end} '******************************************* ' Trigger für Seitenschild {trigger:matrix_seitenschildklemme_drag} (L.S.mouse_y) -300 / (L.L.matrix_seitenschildklemme) + (S.L.matrix_seitenschildklemme) s0 l0 0 < {if} 0 (S.L.matrix_seitenschildklemme) {endif} l0 0.7 > {if} (L.L.matrix_seitenschild_refresh) 0 = {if} 1 (S.L.matrix_seitenschild_refresh) (T.L.ev_fahrertuer_auf) (L.$.Matrix_Seitenschild) "" $= {if} 1 (S.L.matrix_refresh_seitenschild) {else} "" (S.$.Matrix_Seitenschild) {endif} {endif} {endif} l0 1 > {if} 1 (S.L.matrix_seitenschildklemme) {endif} {end} {trigger:matrix_seitenschildklemme_off} (L.L.matrix_seitenschildklemme) 0.3 > {if} (T.L.ev_fahrertuer_zu) {endif} 0 (S.L.matrix_seitenschildklemme) (S.L.matrix_seitenschild_refresh) {end} '******************************************* ' Trigger für Steckschild {trigger:bus_matrix_change_steckschild} (L.L.matrix_steckschild_index) 1 + (S.L.matrix_steckschild_index) 1000 + (M.V.GetTerminusIndex) (S.L.matrix_steckschild_Termindex) (M.L.matrix_setsteckschild) (M.L.matrix_refreshIntIndex) {end} {macro:matrix_setsteckschild} (L.L.matrix_steckschild_Termindex) s0 0 >= {if} l0 6 (M.V.GetTerminusString) (S.$.Matrix_SchildFrnt) 1 $SetLengthL $StrToFloat 1 max (S.L.matrix_steckschild_vis) "..\..\Anzeigen\SteckSchilder\" (L.$.Matrix_SchildFrnt) $+ (S.$.Matrix_SchildFrnt) {else} 0 (S.L.matrix_steckschild_index) (S.L.matrix_steckschild_vis) "" (S.$.Matrix_SchildFrnt) {endif} {end} {macro:Matrix_frame} '******************************+ ' Matrix-Fehler '******************************+ 'Wenn Strom aus ist, dann ist Matrix wieder heil: (L.L.elec_busbar_main) (C.L.elec_busbar_minV) > ! (L.L.Matrix_lifetime) 0 <= && {if} 6 random (S.L.Matrix_lifetime) {endif} '******************************+ ' Terminus-Matrix '******************************+ ' Zeitdifferenz: (L.S.GetTime) (L.L.Matrix_TerminusActTimer) - s2 l2 0 < {if} (L.S.GetTime) (S.L.Matrix_TerminusActTimer) 0 s2 1 (S.L.Matrix_TerminusCreateString) {endif} ' Ob der Suffix >= 94 ist, speichere in s4: (L.L.IBIS_Linie_Suffix) 94 >= s4 'Changecounter zurücksetzen: (wenn kein Wechselziel angezeigt wird) (L.L.IBIS_Linie_Suffix) 97 <= (L.L.IBIS_Linie_Suffix) 96 = ! && (L.L.IBIS_Linie_Suffix) 95 = ! && {if} 0 (S.L.Matrix_ChangeCounter) {endif} ' Wenn sich das neue Ziel vom alten unterscheidet, dann wechsele: l4 ! (L.L.IBIS_TerminusIndex) s0 (L.L.Matrix_TerminusIndex_Last) = ! && ' ODER wenn die Nummer eine "zielbeeinflussende" ist und ungleich dem negativen Matrix_terminusIndex_Last: l4 (L.L.IBIS_Linie_Suffix) s1 /-/ (L.L.Matrix_TerminusIndex_Last) = ! && || (L.L.elec_busbar_main) (C.L.elec_busbar_minV) > && {if} l2 (C.L.Matrix_Waittime) (C.L.Matrix_Changetime_Terminus) 3.5 * + < {if} l2 (C.L.Matrix_Waittime) > {if} ' Nur beim ersten Mal: (L.L.Matrix_TerminusCreateString) {if} 'Wenn Matrix spinnt, dann zähle runter: (L.L.Matrix_spinnt) {if} (L.L.Matrix_lifetime) 1 - (S.L.Matrix_lifetime) {endif} ' Fehlfunktion: Schreibe irgendwas! 0 < (L.L.AI) ! && {if} 2 random 1 >= {if} "xxx" 30 random 1 (M.V.GetTerminusString) 10 $SetLengthL $+ "xxx" $+ "@" $+ "xxx" 30 random 2 (M.V.GetTerminusString) 10 $SetLengthL $+ "xxx" $+ "@" $+ $+ "xxx" 30 random 3 (M.V.GetTerminusString) 10 $SetLengthL $+ "xxx" $+ $+ (S.$.Matrix_NewTerminus) {else} "yxyxyxyxyxyxyxyx@xyxyxyxyx @zzzzzzzzzzzzzzzz" (S.$.Matrix_NewTerminus) {endif} {else} l1 94 = {if} " 'FIX, SCHWYZ!' @ QUÄKTE JÜRGEN @ BLÖD VOM PASS. " (S.$.Matrix_NewTerminus) {else} l1 95 = (L.L.Matrix_ChangeCounter) ! && {if} " FRANZ JAGT IM @ KOMPLETT VER- @WAHRLOSTEN TAXI " (S.$.Matrix_NewTerminus) {else} l1 95 = {if} " QUER DURCH @ BAYERN. @1234567890,;(*')" (S.$.Matrix_NewTerminus) {else} l1 96 = (L.L.Matrix_ChangeCounter) ! && {if} " 01234567890ABCD@EFGHIJKLMNOPQRST@UVWXYZÄÖÜ-.'+/xy" (S.$.Matrix_NewTerminus) {else} l1 96 = {if} "()*;,%&zyx/+'.-A@ÖÜABCDEFGHIJKLMN@OPQRSTUVWXYZ0123" (S.$.Matrix_NewTerminus) {else} l1 97 = {if} "SOFTWAREVERSION @ JULI 2009 @VERS. JULI 2009" (S.$.Matrix_NewTerminus) {else} l1 98 = (L.L.Matrix_ChangeCounter) && {if} "yxyxyxyxyxyxyxyx@xyxyxyxyxyxyxyxy@yxyxyxyxyxyxyxyx" (S.$.Matrix_NewTerminus) {else} l1 98 = {if} "xyxyxyxyxyxyxyxy@yxyxyxyxyxyxyxyx@xyxyxyxyxyxyxyxy" (S.$.Matrix_NewTerminus) {else} l1 99 = (L.L.Matrix_ChangeCounter) && {if} " @ @ " (S.$.Matrix_NewTerminus) {else} l1 99 = {if} "zzzzzzzzzzzzzzzz@zzzzzzzzzzzzzzzz@zzzzzzzzzzzzzzzz" (S.$.Matrix_NewTerminus) {else} l0 3 (M.V.GetTerminusString) $length 15 > {if} l0 3 (M.V.GetTerminusString) 15 $SetLengthL "." $+ (S.$.Matrix_NewTerminus) {else} l0 3 (M.V.GetTerminusString) 15 $SetLengthL (S.$.Matrix_NewTerminus) {endif} {endif} {endif} {endif} {endif} {endif} {endif} {endif} {endif} {endif} {endif} {endif} 0 (S.L.Matrix_TerminusCreateString) (T.L.ev_Matrix_Terminus_change) 'Das soeben in den temporären Speicher geschriebene Ziel: l4 {if} l1 /-/ {else} l0 {endif} (S.L.Matrix_TerminusAct) {endif} 'Zahl von aktualisierten Zeichen: l2 (C.L.Matrix_Waittime) - 0 max 16 * (C.L.Matrix_Changetime_Terminus) / trunc 50 min s3 l3 1 >= {if} (L.$.Matrix_NewTerminus) l3 $SetLengthL (L.$.Matrix_Terminus) 50 l3 - $SetLengthR $+ (S.$.Matrix_Terminus) {endif} {endif} {else} l1 98 >= l1 96 = || l1 95 = || {if} (L.L.Matrix_ChangeCounter) ! (S.L.Matrix_ChangeCounter) 'Hierdurch wird der Wechsel der Nummern-Matrix initiiert: -1 (S.L.Matrix_Nr_Last) {else} (L.L.Matrix_TerminusAct) (S.L.Matrix_TerminusIndex_Last) (M.L.matrix_refreshIntIndex) {endif} 1 (S.L.Matrix_TerminusCreateString) (L.S.GetTime) (S.L.Matrix_TerminusActTimer) (L.$.Matrix_NewTerminus) (S.$.Matrix_Terminus) {endif} 'Omsi sagen, dass die Strings-Ausgaben aktualisiert werden sollen: 1 (S.L.Refresh_Strings) {else} (L.S.GetTime) (S.L.Matrix_TerminusActTimer) 1 (S.L.Matrix_TerminusCreateString) {endif} '******************************+ ' Nr-Matrix '******************************+ ' Zeitdifferenz: (L.S.GetTime) (L.L.Matrix_NrActTimer) - s2 l2 0 < {if} (L.S.GetTime) (S.L.Matrix_NrActTimer) 0 s2 1 (S.L.Matrix_NrCreateString) {endif} ' Wenn sich die neue Linie von der alten unterscheidet, dann wechsele: (L.L.IBIS_Linie_Complex) s0 (L.L.Matrix_Nr_Last) = ! (L.L.elec_busbar_main) (C.L.elec_busbar_minV) > && {if} l2 (C.L.Matrix_Waittime) (C.L.Matrix_Changetime_Nr) 1.5 * + < {if} l2 (C.L.Matrix_Waittime) > {if} ' Nur beim ersten Mal: (L.L.Matrix_NrCreateString) {if} l0 100 / trunc s1 (L.L.IBIS_Linie_Suffix) s4 ' l0: Originalzahl; l1: erste drei Ziffern; l4: letzte zwei Ziffern ' Falls gleich 0, dann gar nix: l1 0 = {if} "" {else} ' Sonst die normale Nummer: l1 trunc $IntToStr {endif} (S.$.Matrix_NewNr) ' =============================================================================== ' Falls jetzt die hinteren beiden Ziffern (l2) etwas Interessantes enthalten: ' =============================================================================== ' Zunächst wird verlängert, wenn einstellig - und zwar je nach Anwendung links- oder rechtsbündig: (L.$.Matrix_NewNr) $length 1 <= l4 9 = l4 11 = || l4 12 = || l4 13 = || l4 14 = || l4 15 = || l4 23 = || l4 25 = || l4 27 = || ! && {if} l4 1 = l4 5 = || l4 6 = || l4 24 = || l4 26 = || l4 28 = || {if} 2 $SetLengthL {else} 2 $SetLengthR {endif} {endif} (S.$.Matrix_NewNr) l4 1 = {if} "E" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 2 = {if} "/^\" {endif} l4 3 = {if} "gh " {endif} l4 4 = {if} (L.$.Matrix_NewNr) 2 $SetLengthR "N" $+ {endif} l4 5 = l4 24 = || {if} "S" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 6 = {if} "A" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 9 = {if} " E" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 10 = {if} (L.$.Matrix_NewNr) 2 $SetLengthR "E" $+ {endif} l4 11 = {if} " D" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 12 = {if} " C" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 13 = {if} " B" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 14 = {if} " A" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 15 = {if} " N" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 23 = {if} " S" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} ' 24 s.o. bei 5! l4 25 = {if} " U" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 26 = {if} "U" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 27 = {if} " M" (L.$.Matrix_NewNr) 1 $SetLengthR $+ {endif} l4 28 = {if} "M" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 29 = {if} "BVG" {endif} l4 30 = {if} (L.$.Matrix_NewNr) 2 $SetLengthR "S" $+ {endif} l4 31 = {if} (L.$.Matrix_NewNr) 2 $SetLengthR "U" $+ {endif} l4 32 = {if} (L.$.Matrix_NewNr) 2 $SetLengthR "M" $+ {endif} l4 35 = {if} "N" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 36 = {if} "X" (L.$.Matrix_NewNr) 2 $SetLengthR $+ {endif} l4 98 = (L.L.Matrix_ChangeCounter) && {if} "yxy" {else} l4 98 = {if} "xyx" {endif} {endif} l4 99 = (L.L.Matrix_ChangeCounter) && {if} " " {else} l4 99 = {if} "zzz" {endif} {endif} 'D oder SD? Das ist hier die Frage...: 3 $SetLengthR (S.$.Matrix_NewNr) 0 (S.L.Matrix_NrCreateString) (T.L.ev_Matrix_Line_change) l0 (S.L.Matrix_NrAct) (L.$.Matrix_NewNr) 2 $SetLengthL (L.$.Matrix_Nr) 2 $SetLengthL $= {if} 2 (S.L.Nummer) {else} (L.$.Matrix_NewNr) 1 $SetLengthL (L.$.Matrix_Nr) 1 $SetLengthL $= {if} 1 (S.L.Nummer) {else} (L.$.Matrix_NewNr) 2 $SetLengthL 1 $SetLengthR (L.$.Matrix_Nr) 2 $SetLengthR 1 $SetLengthL $= {if} 2 (S.L.Nummer) {else} 0 (S.L.Nummer) {endif} {endif} {endif} {endif} 'Zahl von aktualisierten Zeichen: l2 (C.L.Matrix_Waittime) - 0 max 3 * (C.L.Matrix_Changetime_Nr) / trunc 3 min s3 l3 1 >= {if} (L.$.Matrix_NewNr) l3 $SetLengthL (L.$.Matrix_Nr) 3 l3 - $SetLengthR $+ (S.$.Matrix_Nr) {endif} {endif} {else} (L.L.Matrix_NrAct) (S.L.Matrix_Nr_Last) (L.$.Matrix_NewNr) (S.$.Matrix_Nr) 1 (S.L.Matrix_NrCreateString) (L.S.GetTime) (S.L.Matrix_NrActTimer) {endif} 'Omsi sagen, dass die Strings-Ausgaben aktualisiert werden sollen: 1 (S.L.Refresh_Strings) {else} (L.S.GetTime) (S.L.Matrix_NrActTimer) 1 (S.L.Matrix_NrCreateString) {endif} 'Aktualisierung der Code-Tafel: "Linienlisten\" (L.$.yard) "_ANX.jpg" $+ $+ (S.$.Matrix_Linelist) (L.L.matrix_refresh_seitenschild) {if} "..\..\Anzeigen\Seitenschilder\" 2 (M.V.GetDepotStringGlobal) $+ "\" $+ (L.$.Matrix_Nr) $RemoveSpaces $+ ".bmp" $+ (S.$.Matrix_Seitenschild) 0 (S.L.matrix_refresh_seitenschild) {endif} '******************************+ ' Line Display VBZ '******************************+ (L.L.IBIS_LinieKurs) 0 >= (L.L.IBIS_LinieKurs) 21 <= && {if} 0 (S.L.Matrix_Line_visible) (L.L.IBIS_LinieKurs) 0 = {if} 0.0455 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 1 = {if} 0.0909 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 2 = {if} 0.1364 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 3 = {if} 0.1818 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 4 = {if} 0.2273 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 5 = {if} 0.2727 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 6 = {if} 0.3182 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 7 = {if} 0.3636 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 8 = {if} 0.4091 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 9 = {if} 0.4545 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 10 = {if} 0.5 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 11 = {if} 0.5455 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 12 = {if} 0.5909 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 13 = {if} 0.6364 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 14 = {if} 0.6818 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 15 = {if} 0.7273 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 16 = {if} 0.7727 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 17 = {if} 0.8182 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 18 = {if} 0.8636 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 20 = {if} 0.9091 (S.L.Matrix_Line_texpos) {endif} (L.L.IBIS_LinieKurs) 21 = {if} 0.9545 (S.L.Matrix_Line_texpos) {endif} {else} 1 (S.L.Matrix_Line_visible) 0 (S.L.Matrix_Line_texpos) {endif} {end} {macro:matrix_refreshIntIndex} (L.L.matrix_steckschild_Termindex) s0 0 >= l0 0 (M.V.GetTerminusString) "" $= ! && {if} l0 {else} (L.L.Matrix_TerminusAct) {endif} (S.L.target_index_int) {end}