'#############
'SAEIV Navocap
'#############

'SAEIV (Système d'aide a l'exploitation or Fleet Management tool) Navocap Luciol.

'    13.04.2021 Fourkane Mhoma (TheFMrr)

'Script Version: 1.0
'Omsi Release: 2.3.004

'Needs
'-elec
'-IBIS vars (TerminusCode, TerminusIndex, LinieKurs)
'-Door (Annoucements)

'Revision History

'- Fourkane Mhoma   13.04.2021    Created based on C12_Businfo.osc (last rev 19.02.2021)

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

'----------------------
' Triggers
'----------------------

{trigger:Navocap_Keypad_0}
  (L.L.elec_busbar_main)
  {if}
    0 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_1}
  (L.L.elec_busbar_main)
  {if}
    1 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_2}
  (L.L.elec_busbar_main)
  {if}
    2 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_3}
  (L.L.elec_busbar_main)
  {if}
    3 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_4}
  (L.L.elec_busbar_main)
  {if}
    4 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_5}
  (L.L.elec_busbar_main)
  {if}
    5 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_6}
  (L.L.elec_busbar_main)
  {if}
    6 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_7}
  (L.L.elec_busbar_main)
  {if}
    7 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_8}
  (L.L.elec_busbar_main)
  {if}
    8 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_9}
  (L.L.elec_busbar_main)
  {if}
    9 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_VALID}
  (L.L.elec_busbar_main)
  {if}
    10 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Keypad_CLEAR}
  (L.L.elec_busbar_main)
  {if}
    10.1 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_1}
  (L.L.elec_busbar_main)
  {if}
    11 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_2}
  (L.L.elec_busbar_main)
  {if}
    12 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_3}
  (L.L.elec_busbar_main)
  {if}
    13 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_4}
  (L.L.elec_busbar_main)
  {if}
    14 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_5}
  (L.L.elec_busbar_main)
  {if}
    15 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_6}
  (L.L.elec_busbar_main)
  {if}
    16 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

{trigger:Navocap_Menu_GoTo}
  (L.L.elec_busbar_main)
  {if}
    20 (M.L.Navocap_Keypad)
	(T.L.ev_Navocap)
  {endif}
{end}

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

{macro:Navocap_init}

  6425 random 1 max (S.L.Navocap_AI_ID)
  (C.L.Navocap_language) (S.L.Navocap_language)
  (C.L.Matrix_Data_Setted_Automatically) (S.L.IBIS_TerminusCode_auto_set)
  -1 (S.L.Navocap_FirstStopIndex)

{end}

'----------------------
' Frame
'----------------------

{macro:Navocap_frame}

  (L.L.elec_busbar_main)
  {if}

' ** BEFORE : "IBIS" PART AND OTHERS *********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

'----------------
'   OMSI needs to update the strings:
    1 (S.L.Refresh_Strings)
'----------------
'   OMSI now needs to load theses macros:
    (M.L.Navocap_GetPipeOnInput)
    (M.L.Navocap_Calculator)
    (M.L.Navocap_Strings)
    (M.L.Navocap_LightsMgmnt)
'----------------

' ** POWER ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

    (L.L.Navocap_Mode) ! (L.L.AI) ! &&
    {if}

      (C.L.Navocap_HideStartupPhase) !
      {if}
        (M.L.Navocap_boot)
      {else}
        1 (S.L.Navocap_Mode)
      {endif}

    {else}

' ** Navocap MODES ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

'       0:   e m p t y
'       1:   Driver identification
'       2:   Run: Input
'       4:   Run: Recap before departure
'       5:   Run: Monitoring (Main Screen)
'       10:   Menu (A Key)
'       10.1: End of Run
'       10.2: Change Driver

'       INFO: 51 char per line

      (L.L.Navocap_Mode) 1 =
      {if}

'       ## buffering the length of the certain strings for a centering ##
        " < " (L.$.Navocap_multilang_str4) $+ $length s0
        (L.$.Navocap_multilang_str5) " > " $+ $length s1
        (L.$.Navocap_multilang_str2) $length s2
        (L.$.Navocap_multilang_str3) $length s3 - 0 >= s4
'       #################################################################

        " " (L.$.Navocap_multilang_str1) $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @" $+
        " " (L.$.Navocap_multilang_strDay) " " $+ $+ (L.S.Day) $IntToStr " " $+ $+ (L.$.Navocap_multilang_strMonth) " " $+ $+ (L.S.Year) $IntToStr $+ $+ "@" $+

        (L.L.Navocap_Redirect_Timegap) !
        {if}
          (L.$.Navocap_multilang_str2) " " l4 ! l3 l2 - * $* $+ (L.L.Navocap_input_mode) ! {if} " ? " {else} " : " {endif} $+ (L.$.Navocap_ID_input_OnDisplay) 6 $SetLengthL $+ 51 $SetLengthC $+ "@" $+
          (L.$.Navocap_multilang_str3) " " l4 l2 l3 - * $* $+ (L.L.Navocap_input_mode) {if} " ? " {else} " : " {endif} $+ (L.$.Navocap_Pwd_input_OnDisplay) 6 $SetLengthL $+ 51 $SetLengthC $+ "@@" $+
        {else}
          "@" $+ (L.$.Navocap_multilang_str6) 51 $SetLengthC $+ "@@" $+
          (L.L.Navocap_Redirect_Timegap) (L.S.Timegap) - 0 max (S.L.Navocap_Redirect_Timegap)
        {endif}

        " < " (L.$.Navocap_multilang_str4) $+ " " 51 l0 l1 + - $* $+ (L.$.Navocap_multilang_str5) " > " $+ $+ $+

      (S.$.Navocap_Text)
      {endif}

      (L.L.Navocap_Mode) 2 =
      {if}

        " " (L.$.Navocap_multilang_str1) $+ " ^ ^ 1-1" $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @@" $+
        (L.L.schedule_active) !
        {if}
          "@" (L.$.Navocap_multilang_str5) 51 $SetLengthC $+ $+ "@@" $+
        {else}
          " " $+ (L.L.Navocap_BUFFER_FirstStopIndexHour_schedule) 3600 / s0 trunc s1 "02" $IntToStrEnh $+ ":" $+ l0 l1 - 60 * "02" $IntToStrEnh $+ " - " $+ (L.$.Navocap_BUFFER_TEXT_TTLineString) $+ " - " $+ (L.$.Navocap_BUFFER_TEXT_FirstStop) $+ " -> " $+ (L.$.Navocap_BUFFER_TEXT_TerminusStop) $+ "@@" $+
          " " $+ (L.$.Navocap_multilang_str2) $+ " : " $+ (L.$.Navocap_Srv_input_OnDisplay) $+ "@" $+
          " " "(V:" $+ (L.$.Navocap_multilang_str3) $+ ", C:" $+ (L.$.Navocap_multilang_str4) $+ ")" $+ 50 $SetLengthR $+
        {endif}

      (S.$.Navocap_Text)
      {endif}

      (L.L.Navocap_Mode) 4 =
      {if}

'       ## buffering the length of the certain strings for a centering ##
        (L.$.Navocap_BUFFER_TEXT_FirstStopInitials) "->" $+ (L.$.Navocap_BUFFER_TEXT_TerminusStopInitials) $+ " " $+ $length
        "  " (L.$.Navocap_multilang_str4) $+ " " $+ (L.$.Navocap_BUFFER_TEXT_TTLineString) $+ $length + s0
        51 l0 - s1
        " < " (L.$.Navocap_multilang_str5) $+ $length s2
        (L.$.Navocap_multilang_str6) " > " $+ $length s3
'       #################################################################

        " " (L.$.Navocap_multilang_str1) $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @" $+

            (L.L.Navocap_BUFFER_DepartureHour) (L.S.Time) - 60 / 0 <= !
            {if}
              " " (L.$.Navocap_multilang_str2) $+ " " $+ (L.L.Navocap_BUFFER_DepartureHour) (L.S.Time) - 60 / 1 + 0 max $IntToStr $+ " min " $+ 51 $SetLengthR $+ "@" $+
            {else}
              (L.L.Navocap_Blink_Timegap) !
              {if}
                (L.S.GetTime) (S.L.Navocap_Blink_Timegap)
                "@" $+
              {else}
                (L.S.GetTime) (L.L.Navocap_Blink_Timegap) - s4 1 % 0.5 >
                {if}
                  (L.L.Navocap_BUFFER_DepartureHour) (L.S.Time) - abs s4 60 <
                  {if}
                    (L.$.Navocap_multilang_str3) " " $+ 51 $SetLengthR $+ "@" $+
                  {else}
                    (L.$.Navocap_multilang_str3) "(+" $+ l4 60 / $IntToStr $+ ") " $+ 51 $SetLengthR $+ "@" $+
                  {endif}
                {else}
                  "@" $+
                {endif}
              {endif}
            {endif}

        "  " $+ (L.$.Navocap_multilang_str4) $+ " " $+ (L.$.Navocap_BUFFER_TEXT_TTLineString) $+ " " l1 $* $+ (L.$.Navocap_BUFFER_TEXT_FirstStopInitials) $+ "->" $+ (L.$.Navocap_BUFFER_TEXT_TerminusStopInitials) $+ " " $+ "@" $+
            (L.L.Navocap_BUFFER_FirstStopIndex) 1 + $IntToStr "> " $+ (L.$.Navocap_BUFFER_TEXT_FirstStop) $+ 51 $SetLengthC $+ "@" $+
            (L.L.schedule_active)
            {if}
              (L.L.Navocap_BUFFER_DepartureHour) 3600 / s0 trunc s1 "02" $IntToStrEnh ":" $+ l0 l1 - 60 * "02" $IntToStrEnh $+ 51 $SetLengthC $+ "@" $+
            {else}
              (L.$.Navocap_multilang_str7) 51 $SetLengthC $+ "@" $+
            {endif}
        " < " $+ (L.$.Navocap_multilang_str5) $+ " " 51 l2 l3 + - $* $+ (L.$.Navocap_multilang_str6) $+ " > " $+

        (S.$.Navocap_Text)
      {endif}

      (L.L.Navocap_Mode) 5 =
      {if}

'       ## buffering the length of the certain strings for a centering ##
        "  " (L.$.Navocap_multilang_str5) $+ " " $+ (L.$.Navocap_BUFFER_TEXT_TTLineString) $+ $length
        (L.$.Navocap_BUFFER_TEXT_FirstStopInitials) "->" $+ (L.$.Navocap_BUFFER_TEXT_TerminusStopInitials) $+ " " $+ $length + s1
        " <" (L.$.Navocap_BUFFER_TEXT_NextStop) 21 $SetLengthL $+ (L.$.Navocap_BUFFER_TEXT_NextStop1) 21 $SetLengthL $+ "> " $+ $length s2
'       #################################################################

        " " (L.$.Navocap_multilang_str1) $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @" $+

        (L.L.Navocap_LIGHT_TTDelay_Red)
        {if}
          " " (L.$.Navocap_multilang_str2) $+ "(" $+ (L.L.Navocap_BUFFER_TTDelay) s3 60 / abs l3 0 >= ! + $IntToStr $+ " min) " $+ 51 $SetLengthR $+ "@" $+
        {else}
        (L.L.Navocap_LIGHT_TTDelay_Orange)
        {if}
          " " (L.$.Navocap_multilang_str3) $+ "(" $+ (L.L.Navocap_BUFFER_TTDelay) s3 60 / abs l3 0 >= ! + $IntToStr $+ " min) " $+ 51 $SetLengthR $+ "@" $+
        {else}
          " " (L.$.Navocap_multilang_str4) $+ " " $+ 51 $SetLengthR $+ "@" $+
        {endif}
        {endif}

        "  " $+ (L.$.Navocap_multilang_str5) $+ " " $+ (L.$.Navocap_BUFFER_TEXT_TTLineString) $+ " " 51 l1 - $* $+ (L.$.Navocap_BUFFER_TEXT_FirstStopInitials) $+ "->" $+ (L.$.Navocap_BUFFER_TEXT_TerminusStopInitials) $+ " " $+ "@" $+

        " <" $+ (L.$.Navocap_BUFFER_TEXT_NextStop) 21 $SetLengthL $+ "--->" 51 l2 - $SetLengthC $+ (L.$.Navocap_BUFFER_TEXT_NextStop1) 21 $SetLengthL $+ "> " $+ "@" $+

        " <" $+ (L.L.Navocap_BUFFER_NextStopArrHour) 3600 / s0 trunc s1 "02" $IntToStrEnh ":" $+ l0 l1 - 60 * "02" $IntToStrEnh $+ 21 $SetLengthC $+ " " 51 46 - $* $+ (L.L.Navocap_BUFFER_NextStopArr1Hour) 3600 / s0 trunc s1 "02" $IntToStrEnh ":" $+ l0 l1 - 60 * "02" $IntToStrEnh $+ 21 $SetLengthC $+ "> " $+ "@" $+

        (L.$.Navocap_multilang_str6) 51 (L.L.schedule_active) ! * $SetLengthC $+

      (S.$.Navocap_Text)
      {endif}

      (L.L.Navocap_Mode) 10 =
      {if}

'       ## buffering the length of the certain strings for a centering ##
        " < " (L.$.Navocap_multilang_str2) $+ $length (L.$.Navocap_multilang_str3) " > " $+ $length + s1
        "   " (L.$.Navocap_multilang_str4) $+ $length (L.$.Navocap_multilang_str5) " > " $+ $length + s2
        " < " (L.$.Navocap_multilang_str6) $+ $length (L.$.Navocap_multilang_str7) " > " $+ $length + s3
'       #################################################################

        " " (L.$.Navocap_multilang_str1) $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @" $+

        " < " $+ (L.$.Navocap_multilang_str2) $+ " " 51 l1 - $* $+ (L.$.Navocap_multilang_str3) $+ " > " $+ "@@" $+
        "   " $+ (L.$.Navocap_multilang_str4) $+ " " 51 l2 - $* $+ (L.$.Navocap_multilang_str5) $+ " > " $+ "@@" $+
        " < " $+ (L.$.Navocap_multilang_str6) $+ " " 51 l3 - $* $+ (L.$.Navocap_multilang_str7) $+ " > " $+

      (S.$.Navocap_Text)
      {endif}

      (L.L.Navocap_Mode) 10.1 =
      {if}

'       ## buffering the length of the certain strings for a centering ##
        " < " (L.$.Navocap_multilang_str3) $+ $length (L.$.Navocap_multilang_str4) " > " $+ $length + s1
'       #################################################################

        " " (L.$.Navocap_multilang_str1) $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @@@" $+
        (L.$.Navocap_multilang_str2) 51 $SetLengthC $+ "@@" $+
        " < " $+ (L.$.Navocap_multilang_str3) $+ " " 51 l1 - $* $+ (L.$.Navocap_multilang_str4) $+ " > " $+

      (S.$.Navocap_Text)
      {endif}

      (L.L.Navocap_Mode) 10.2 =
      {if}

'       ## buffering the length of the certain strings for a centering ##
        " < " (L.$.Navocap_multilang_str3) $+ $length (L.$.Navocap_multilang_str4) " > " $+ $length + s1
'       #################################################################

        " " (L.$.Navocap_multilang_str1) $+ 42 $SetLengthL (L.$.Navocap_Hour) $+ " @@@" $+
        (L.$.Navocap_multilang_str2) 51 $SetLengthC $+ "@@" $+
        " < " $+ (L.$.Navocap_multilang_str3) $+ " " 51 l1 - $* $+ (L.$.Navocap_multilang_str4) $+ " > " $+

      (S.$.Navocap_Text)
      {endif}

' ** POWER OFF *******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

    {endif}
  {else} (L.L.AI) ! {if}

    0
    (S.L.Navocap_Mode) (S.L.Navocap_Mode_Last)
    (S.L.Navocap_ID) (S.L.Navocap_Pwd) (S.L.Navocap_Srv)
    (S.L.Navocap_input_mode)
    (S.L.Navocap_init_timer) (S.L.Navocap_pipe_timer) (S.L.Navocap_DoorAnnouncement_Blocked_timer) (S.L.Navocap_Redirect_Timegap) (S.L.Navocap_Blink_Timegap) (S.L.Navocap_BusstopIndex_Offset)
    (S.L.Navocap_DoorAnnouncement_Played) (S.L.Navocap_DoorAnnouncement_Blocked)
    (S.L.Navocap_LIGHT_State_Orange) (S.L.Navocap_LIGHT_State_Green) (S.L.Navocap_LIGHT_State_Red)
    (S.L.Navocap_LIGHT_Radio_Orange) (S.L.Navocap_LIGHT_Radio_Green) (S.L.Navocap_LIGHT_Radio_Red)
    (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_GPS_Red)
    (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Red)
    -1
    (S.L.Navocap_FirstStopIndex) (S.L.Navocap_FirstStopIndex_Hour)
    (S.L.Navocap_schedule_active_last)
    (S.L.Navocap_BusstopIndex_LastIndex) 0 (S.L.Navocap_BusstopIndex_Offset)
    ""
    (S.$.Navocap_Text)
    (S.$.Navocap_input_User) (S.$.Navocap_input_OnDisplay) (S.$.Navocap_ID_input_User) (S.$.Navocap_ID_input_OnDisplay) (S.$.Navocap_Pwd_input_User) (S.$.Navocap_Pwd_input_OnDisplay) (S.$.Navocap_Srv_input_User) (S.$.Navocap_Srv_input_OnDisplay)
    (S.$.Navocap_LastTargetKnown) (S.$.Navocap_LastBusstopKnown) (S.$.Navocap_LastBusstopArrAnnouncementPlayed) (S.$.Navocap_LastBusstopDepAnnouncementPlayed)
    "Navocap\nvcp_off.dds" (S.$.Navocap_Display)

  {endif}
  {endif}

{end}

'----------------------
' Macros
'----------------------

' ** STRINGS *********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_Strings}

'######################################### LANGUAGES #########################################

  (L.L.Navocap_language) 1 =
  {if}

    (L.L.Navocap_Mode) 1 =
    {if}
      "Driver Identification" (S.$.Navocap_multilang_str1)
      "Driver ID" (S.$.Navocap_multilang_str2)
      "PIN-Code" (S.$.Navocap_multilang_str3)
      "Maintenance" (S.$.Navocap_multilang_str4)
      "Line statement" (S.$.Navocap_multilang_str5)
      "Driver ID and/or PIN-Code INCORRECT!" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 2 =
    {if}
      "Run validation" (S.$.Navocap_multilang_str1)
      "Input" (S.$.Navocap_multilang_str2)
      "Confirm" (S.$.Navocap_multilang_str3)
      "Cancel" (S.$.Navocap_multilang_str4)
      "No Run available." (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 4 =
    {if}
      "Waiting for departure" (S.$.Navocap_multilang_str1)
      "Departure in" (S.$.Navocap_multilang_str2)
      "DEPARTURE" (S.$.Navocap_multilang_str3)
      "Line" (S.$.Navocap_multilang_str4)
      "Depart" (S.$.Navocap_multilang_str5)
      "Run details" (S.$.Navocap_multilang_str6)
      "Location inactive" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 5 =
    {if}
      "Run Monitoring" (S.$.Navocap_multilang_str1)
      "Ahead of schedule" (S.$.Navocap_multilang_str2)
      "Behind schedule" (S.$.Navocap_multilang_str3)
      "On time" (S.$.Navocap_multilang_str4)
      "Line" (S.$.Navocap_multilang_str5)
      "Location inactive" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10 =
    {if}
      "Action Menu" (S.$.Navocap_multilang_str1)
      "End the run" (S.$.Navocap_multilang_str2)
      "Change Driver" (S.$.Navocap_multilang_str3)
      "Message" (S.$.Navocap_multilang_str4)
      "Change Stop" (S.$.Navocap_multilang_str5)
      "Next" (S.$.Navocap_multilang_str6)
      "Exit" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10.1 =
    {if}
      "End of Run" (S.$.Navocap_multilang_str1)
      "Confirmer the end of the Run?" (S.$.Navocap_multilang_str2)
      "Confirm" (S.$.Navocap_multilang_str3)
      "Cancel" (S.$.Navocap_multilang_str4)
      "" (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10.2 =
    {if}
      "Changement de conducteur" (S.$.Navocap_multilang_str1)
      "Confirmer the change of driver?" (S.$.Navocap_multilang_str2)
      "Confirm" (S.$.Navocap_multilang_str3)
      "Cancel" (S.$.Navocap_multilang_str4)
      "" (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Day) 0 = {if} "Sunday" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 1 = {if} "Monday" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 2 = {if} "Tuesday" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 3 = {if} "Wednesday" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 4 = {if} "Thursday" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 5 = {if} "Friday" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 6 = {if} "Saturday" (S.$.Navocap_multilang_strDay) {endif}
    (L.S.Month) 1 = {if} "January" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 2 = {if} "February" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 3 = {if} "March" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 4 = {if} "April" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 5 = {if} "May" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 6 = {if} "June" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 7 = {if} "July" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 8 = {if} "August" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 9 = {if} "September" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 10 = {if} "October" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 11 = {if} "November" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 12 = {if} "December" (S.$.Navocap_multilang_strMonth) {endif}

  {else}

  (L.L.Navocap_language) 2 =
  {if}

    (L.L.Navocap_Mode) 1 =
    {if}
      "Fahreridentifikation" (S.$.Navocap_multilang_str1)
      "Fahrer-ID" (S.$.Navocap_multilang_str2)
      "PIN-Code" (S.$.Navocap_multilang_str3)
      "Wartung" (S.$.Navocap_multilang_str4)
      "Zeilenanzeige" (S.$.Navocap_multilang_str5)
      "Fahrer-ID und/oder PIN-Code FALSCH!" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 2 =
    {if}
      "Validierung der Fahrtstrecke" (S.$.Navocap_multilang_str1)
      "Input" (S.$.Navocap_multilang_str2)
      "OK" (S.$.Navocap_multilang_str3)
      "Abbrechen" (S.$.Navocap_multilang_str4)
      "Keine Fahrt verfugbar." (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 4 =
    {if}
      "Warten auf Abfahrt" (S.$.Navocap_multilang_str1)
      "Abfahrt in" (S.$.Navocap_multilang_str2)
      "ABFAHRT" (S.$.Navocap_multilang_str3)
      "Linie" (S.$.Navocap_multilang_str4)
      "Sofortige Abfahrt" (S.$.Navocap_multilang_str5)
      "Kurs Detail" (S.$.Navocap_multilang_str6)
      "Inaktiver Standort" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 5 =
    {if}
      "Kurs Verfolgen" (S.$.Navocap_multilang_str1)
      "schneller als geplant" (S.$.Navocap_multilang_str2)
      "Terminverzug" (S.$.Navocap_multilang_str3)
      "pünktlich" (S.$.Navocap_multilang_str4)
      "Linie" (S.$.Navocap_multilang_str5)
      "Inaktiver Standort" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10 =
    {if}
      "Aktionsmenu" (S.$.Navocap_multilang_str1)
      "Ende des Kurses" (S.$.Navocap_multilang_str2)
      "Fahrerwechsel" (S.$.Navocap_multilang_str3)
      "Nachricht" (S.$.Navocap_multilang_str4)
      "Wechselstopp" (S.$.Navocap_multilang_str5)
      "Unter" (S.$.Navocap_multilang_str6)
      "Ausfahrt" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10.1 =
    {if}
      "Ende des Kurses" (S.$.Navocap_multilang_str1)
      "Kursende bestatigen?" (S.$.Navocap_multilang_str2)
      "Validieren" (S.$.Navocap_multilang_str3)
      "Abbrechen" (S.$.Navocap_multilang_str4)
      "" (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10.2 =
    {if}
      "Fahrerwechsel" (S.$.Navocap_multilang_str1)
      "Fahrerwechsel bestatigen?" (S.$.Navocap_multilang_str2)
      "Validieren" (S.$.Navocap_multilang_str3)
      "Abbrechen" (S.$.Navocap_multilang_str4)
      "" (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Day) 0 = {if} "Sonntag" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 1 = {if} "Montag" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 2 = {if} "Dienstag" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 3 = {if} "Mittwoch" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 4 = {if} "Donnerstag" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 5 = {if} "Freitag" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 6 = {if} "Samstag" (S.$.Navocap_multilang_strDay) {endif}
    (L.S.Month) 1 = {if} "Januar" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 2 = {if} "Februar" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 3 = {if} "Marz" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 4 = {if} "April" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 5 = {if} "Mai" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 6 = {if} "Juni" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 7 = {if} "Juli" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 8 = {if} "August" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 9 = {if} "September" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 10 = {if} "Oktober" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 11 = {if} "November" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 12 = {if} "Dezember" (S.$.Navocap_multilang_strMonth) {endif}

  {else}

    (L.L.Navocap_Mode) 1 =
    {if}
      "Identification Conducteur" (S.$.Navocap_multilang_str1)
      "Matricule" (S.$.Navocap_multilang_str2)
      "Code" (S.$.Navocap_multilang_str3)
      "Maintenance" (S.$.Navocap_multilang_str4)
      "Releve de ligne" (S.$.Navocap_multilang_str5)
      "Matricule et/ou code INCORRECT!" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 2 =
    {if}
      "Validation de course" (S.$.Navocap_multilang_str1)
      "Saisie" (S.$.Navocap_multilang_str2)
      "Valider" (S.$.Navocap_multilang_str3)
      "Annuler" (S.$.Navocap_multilang_str4)
      "Aucune course disponible." (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 4 =
    {if}
      "Attente depart" (S.$.Navocap_multilang_str1)
      "Depart dans" (S.$.Navocap_multilang_str2)
      "DEPART" (S.$.Navocap_multilang_str3)
      "Ligne" (S.$.Navocap_multilang_str4)
      "Depart" (S.$.Navocap_multilang_str5)
      "Detail de course" (S.$.Navocap_multilang_str6)
      "Bus delocalise" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 5 =
    {if}
      "Suivi Course" (S.$.Navocap_multilang_str1)
      "En avance" (S.$.Navocap_multilang_str2)
      "En retard" (S.$.Navocap_multilang_str3)
      "A l'heure" (S.$.Navocap_multilang_str4)
      "Ligne" (S.$.Navocap_multilang_str5)
      "Bus delocalise" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10 =
    {if}
      "Menu action" (S.$.Navocap_multilang_str1)
      "Fin de course" (S.$.Navocap_multilang_str2)
      "Change Conducteur" (S.$.Navocap_multilang_str3)
      "Message" (S.$.Navocap_multilang_str4)
      "Change arret" (S.$.Navocap_multilang_str5)
      "Suivant" (S.$.Navocap_multilang_str6)
      "Sortir" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10.1 =
    {if}
      "Fin de course" (S.$.Navocap_multilang_str1)
      "Confirmer la fin de course?" (S.$.Navocap_multilang_str2)
      "Valider" (S.$.Navocap_multilang_str3)
      "Annuler" (S.$.Navocap_multilang_str4)
      "" (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Mode) 10.2 =
    {if}
      "Changement de conducteur" (S.$.Navocap_multilang_str1)
      "Confirmer le changement de conducteur?" (S.$.Navocap_multilang_str2)
      "Valider" (S.$.Navocap_multilang_str3)
      "Annuler" (S.$.Navocap_multilang_str4)
      "" (S.$.Navocap_multilang_str5)
      "" (S.$.Navocap_multilang_str6)
      "" (S.$.Navocap_multilang_str7)
    {endif}

    (L.L.Navocap_Day) 0 = {if} "Dimanche" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 1 = {if} "Lundi" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 2 = {if} "Mardi" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 3 = {if} "Mercredi" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 4 = {if} "Jeudi" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 5 = {if} "Vendredi" (S.$.Navocap_multilang_strDay) {endif}
    (L.L.Navocap_Day) 6 = {if} "Samedi" (S.$.Navocap_multilang_strDay) {endif}
    (L.S.Month) 1 = {if} "Janvier" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 2 = {if} "Fevrier" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 3 = {if} "Mars" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 4 = {if} "Avril" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 5 = {if} "Mai" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 6 = {if} "Juin" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 7 = {if} "Juillet" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 8 = {if} "Août" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 9 = {if} "Septembre" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 10 = {if} "Octobre" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 11 = {if} "Novembre" (S.$.Navocap_multilang_strMonth) {endif}
    (L.S.Month) 12 = {if} "Decembre" (S.$.Navocap_multilang_strMonth) {endif}

  {endif}
  {endif}

'######################################### others #########################################

'####### BUFFERING #######

  (L.L.schedule_active)
  {if}
    (L.$.Navocap_TTLineString) (S.$.Navocap_BUFFER_TEXT_TTLineString)
    (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopInitials) (S.$.Navocap_BUFFER_TEXT_FirstStopInitials)
    (L.L.Navocap_FirstStopIndex) s0 0 >= {if} l0 {else} (M.V.GetTTBusstopIndex) {endif} (M.L.Navocap_GetTTBusstopName) (S.$.Navocap_BUFFER_TEXT_FirstStop)
    (M.V.GetTTBusstopCount) 1 - (M.L.Navocap_GetTTBusstopInitials) (S.$.Navocap_BUFFER_TEXT_TerminusStopInitials)
    (M.V.GetTTBusstopCount) 1 - (M.L.Navocap_GetTTBusstopName) (S.$.Navocap_BUFFER_TEXT_TerminusStop)
    (M.V.GetTTBusstopIndex)     (L.L.Navocap_BusstopIndex_Offset) + 0 max (M.V.GetTTBusstopCount) 1 - min (M.L.Navocap_GetTTBusstopName) (S.$.Navocap_BUFFER_TEXT_NextStop)
    (M.V.GetTTBusstopIndex) 1 + (L.L.Navocap_BusstopIndex_Offset) + 0 max (M.L.Navocap_GetTTBusstopName) (S.$.Navocap_BUFFER_TEXT_NextStop1)
    (L.L.Navocap_FirstStopIndex) (S.L.Navocap_BUFFER_FirstStopIndex) (M.V.GetTTBusstopDep) (S.L.Navocap_BUFFER_DepartureHour)
    0 (M.V.GetTTBusstopDep) (S.L.Navocap_BUFFER_FirstStopIndexHour_schedule)
    (M.V.GetTTDelay) (S.L.Navocap_BUFFER_TTDelay)
    (M.V.GetTTBusstopIndex) (L.L.Navocap_BusstopIndex_Offset) + 0 max (M.V.GetTTBusstopCount) 1 - min (M.V.GetTTBusstopArr) (S.L.Navocap_BUFFER_NextStopArrHour)
    (M.V.GetTTBusstopIndex) 1 + (L.L.Navocap_BusstopIndex_Offset) + 0 max (M.V.GetTTBusstopArr) (S.L.Navocap_BUFFER_NextStopArr1Hour)
  {else}
    0 (S.L.Navocap_BusstopIndex_Offset)
  {endif}

{end}

' ** USER INPUT MANAGEMENT *******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_Keypad} s0

' Numbers
  l0 10 <
  {if}

    (L.L.Navocap_Mode) 1 = (L.L.Navocap_input_mode) ! && (L.L.Navocap_Redirect_Timegap) ! && (L.$.Navocap_ID_input_User) $length 6 < && {if} l0 $IntToStr $+ (S.$.Navocap_ID_input_User) 0 (S.L.Navocap_pipe_timer) {endif}
    (L.L.Navocap_Mode) 1 = (L.L.Navocap_input_mode) && (L.L.Navocap_Redirect_Timegap) ! && (L.$.Navocap_Pwd_input_user) $length 6 < && {if} l0 $IntToStr $+ (S.$.Navocap_Pwd_input_user) 0 (S.L.Navocap_pipe_timer) {endif}
    (L.L.Navocap_Mode) 2 = (L.$.Navocap_Srv_input_User) $length 12 < && {if} l0 $IntToStr $+ (S.$.Navocap_Srv_input_User) 0 (S.L.Navocap_pipe_timer) {endif}
    0 (S.L.Navocap_Redirect_Timegap)

  {endif}

' Valid
  l0 10 =
  {if}

    (L.L.Navocap_Mode) 1 =
    {if}

      (L.L.Navocap_Redirect_Timegap) !
      {if}
        (L.L.Navocap_input_mode) !
        {if}
          1 (S.L.Navocap_input_mode)
        {else}
          (L.$.Navocap_ID_input_User) 6 $SetLengthL $RemoveSpaces $StrToFloat 1 max abs trunc s1
          (C.L.Navocap_ID) abs trunc $IntToStr 6 $SetLengthL $RemoveSpaces $StrToFloat s2
          (L.$.Navocap_Pwd_input_User) 6 $SetLengthL $RemoveSpaces $StrToFloat 1 max abs trunc s3
          (C.L.Navocap_Pwd) abs trunc $IntToStr 6 $SetLengthL $RemoveSpaces $StrToFloat s4
          l1 l2 = l3 l4 = &&
          {if}
            2 (S.L.Navocap_Mode)
            0 (S.L.Navocap_input_mode)
            l2 (S.L.Navocap_ID)
            l4 (S.L.Navocap_Pwd)
            "" (S.$.Navocap_ID_input_User)
               (S.$.Navocap_Pwd_input_User)
          {else}
            2 (S.L.Navocap_Redirect_Timegap)
            0 (S.L.Navocap_input_mode)
            "" (S.$.Navocap_ID_input_User)
               (S.$.Navocap_Pwd_input_User)
          {endif}
        {endif}
      {else}
        0 (S.L.Navocap_Redirect_Timegap)
      {endif}

    {else}

    (L.L.Navocap_Mode) 2 =
    {if}
      (L.L.schedule_active) !
      {if}
        1 (S.L.Navocap_Mode)
        0 (S.L.Navocap_ID) (S.L.Navocap_Pwd)
      {else}
        (L.$.Navocap_Srv_input_User) $StrToFloat 1 max (S.L.Navocap_Srv)
        "" (S.$.Navocap_Srv_input_User)
        (M.V.GetTTBusstopIndex) (S.L.Navocap_FirstStopIndex)
        4 (S.L.Navocap_Mode)
      {endif}

    {else}

    (L.L.Navocap_Mode) 4 =
    {if}
      -1 (S.L.Navocap_FirstStopIndex)
      0 (S.L.Navocap_Blink_Timegap)
      5 (S.L.Navocap_Mode)

    {else}

    (L.L.Navocap_Mode) 10.1 =
    {if}
      (M.L.Navocap_EndRun)
      (L.L.Navocap_DriverIsConnected) {if} 2 {else} 1 {endif} (S.L.Navocap_Mode)
    {else}

    (L.L.Navocap_Mode) 10.2 =
    {if}
      (M.L.Navocap_ChangeDriver)
      1 (S.L.Navocap_Mode)

    {endif}
    {endif}
    {endif}
    {endif}
    {endif}

  {endif}

' Clear
  l0 10.1 =
  {if}

    (L.L.Navocap_Mode) 1 =
    {if}

      (L.L.Navocap_input_mode) !
      {if}
        (L.$.Navocap_ID_input_User) $length {if} 1 $cutEnd (S.$.Navocap_ID_input_User) {endif}
      {else}
        (L.$.Navocap_Pwd_input_User) $length {if} 1 $cutEnd (S.$.Navocap_Pwd_input_User) {else} 0 (S.L.Navocap_input_mode) {endif}
      {endif}
      0 (S.L.Navocap_pipe_timer)

    {else}

    (L.L.Navocap_Mode) 2 =
    {if}
      (L.$.Navocap_Srv_input_User) $length {if} 1 $cutEnd (S.$.Navocap_Srv_input_User) {endif}
      1 (S.L.Navocap_Mode)
      0 (S.L.Navocap_ID) (S.L.Navocap_Pwd) (S.L.Navocap_input_mode)

    {else}

    (L.L.Navocap_Mode) 10 =
    {if}
      (L.L.Navocap_Mode_Last) (S.L.Navocap_Mode)

    {else}

    (L.L.Navocap_Mode) 10.1 =
    (L.L.Navocap_Mode) 10.2 = ||
    {if}
      10 (S.L.Navocap_Mode)

    {endif}
    {endif}
    {endif}
    {endif}
  {endif}

' Menu Selection
  l0 11 >=
  l0 16 <= &&
  {if}

    (L.L.Navocap_Mode) 4 =
    {if}

      l0 13 =
      {if}
        -1 (S.L.Navocap_FirstStopIndex)
        0 (S.L.Navocap_Blink_Timegap)
        5 (S.L.Navocap_Mode)
      {endif}

    {else}

    (L.L.Navocap_Mode) 5 =
    {if}

      l0 12 =
      {if}
        (L.L.schedule_active) &&
        {if}
          (L.L.Navocap_BusstopIndex_Offset) 1 - 0 max (S.L.Navocap_BusstopIndex_Offset)
        {else}
          0 (S.L.Navocap_BusstopIndex_Offset) (S.L.Navocap_BusstopIndex_Timegap)
        {endif}
      {endif}

      l0 15 =
      {if}
        (M.V.GetTTBusstopIndex) (L.L.Navocap_BusstopIndex_Offset) + (M.V.GetTTBusstopCount) 2 - >= !
        (L.L.schedule_active) &&
        {if}
          (L.L.Navocap_BusstopIndex_Offset) 1 + (S.L.Navocap_BusstopIndex_Offset)
        {else}
          0 (S.L.Navocap_BusstopIndex_Offset) (S.L.Navocap_BusstopIndex_Timegap)
        {endif}
      {endif}

    {else}

    (L.L.Navocap_Mode) 10 =
    {if}
      l0 11 = {if} 10.1 (S.L.Navocap_Mode) {endif}
      l0 14 = {if} 10.2 (S.L.Navocap_Mode) {endif}
      l0 16 = {if} (L.L.Navocap_Mode_Last) (S.L.Navocap_Mode) {endif}

    {else}


    (L.L.Navocap_Mode) 10.1 =
    {if}
      l0 13 = {if} (M.L.Navocap_EndRun) (L.L.Navocap_DriverIsConnected) {if} 2 {else} 1 {endif} (S.L.Navocap_Mode) {endif}
      l0 16 = {if} 10 (S.L.Navocap_Mode) {endif}

    {else}

    (L.L.Navocap_Mode) 10.2 =
    {if}
      l0 13 = {if} (M.L.Navocap_ChangeDriver) 1 (S.L.Navocap_Mode) {endif}
      l0 16 = {if} 10 (S.L.Navocap_Mode) {endif}

    {endif}
    {endif}
    {endif}
    {endif}
    {endif}

  {endif}

' GoTo Menu
  l0 20 =
  {if}
    (L.L.Navocap_Mode) (L.L.Navocap_Mode) 10 = ! &&
    {if}
      (L.L.Navocap_Mode) (S.L.Navocap_Mode_Last)
      10 (S.L.Navocap_Mode)
    {endif}
  {endif}

' Plus
  l0 21 =
  {if}

  {endif}

' Minus
  l0 22 =
  {if}

  {endif}

{end}

' ** PIPE ON INPUT ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_GetPipeOnInput}
' "|"
  (L.L.Navocap_pipe_timer) (L.S.Timegap) + (S.L.Navocap_pipe_timer) s0
  (L.L.Navocap_Mode) 1 =
  {if}
    (L.L.Navocap_input_mode) !
    {if}
      (L.$.Navocap_ID_input_User) $length s1
      l0 0.25 <
      {if}
        (L.$.Navocap_ID_input_User) "|" $+ "-" 6 l1 - $* $+ (S.$.Navocap_ID_input_OnDisplay)
      {else}
      l0 0.25 >
      l0 1 < &&
      {if}
        (L.$.Navocap_ID_input_User) "-" $+ "-" 6 l1 - $* $+ (S.$.Navocap_ID_input_OnDisplay)
      {else}
      l0 1 >
      {if}
        0 (S.L.Navocap_pipe_timer)
      {endif}
      {endif}
      {endif}
      "------" (S.$.Navocap_Pwd_input_OnDisplay)
    {else}
      (L.$.Navocap_ID_input_User) $length s1
      (L.$.Navocap_Pwd_input_User) $length s2
      l0 0.25 <
      {if}
        "*" l2 $* "|" $+ "-" 6 l2 - $* $+ (S.$.Navocap_Pwd_input_OnDisplay)
      {else}
      l0 0.25 >
      l0 1 < &&
      {if}
        "*" l2 $* "-" $+ "-" 6 l2 - $* $+ (S.$.Navocap_Pwd_input_OnDisplay)
      {else}
      l0 1 >
      {if}
        0 (S.L.Navocap_pipe_timer)
      {endif}
      {endif}
      {endif}
      (L.$.Navocap_ID_input_User) "-" 6 l1 - $* $+ (S.$.Navocap_ID_input_OnDisplay)
    {endif}
  {endif}

  (L.L.Navocap_Mode) 2 =
  {if}
    (L.$.Navocap_Srv_input_User) $length s3
    l0 0.25 <
    {if}
      (L.$.Navocap_Srv_input_User) "|" $+ "-" 11 l3 - $* $+ (S.$.Navocap_Srv_input_OnDisplay)
    {else}
    l0 0.25 >
    l0 1 < &&
    {if}
      (L.$.Navocap_Srv_input_User) "-" $+ "-" 11 l3 - $* $+ (S.$.Navocap_Srv_input_OnDisplay)
    {else}
    l0 1 >
    {if}
      0 (S.L.Navocap_pipe_timer)
    {endif}
    {endif}
    {endif}
  {endif}

{end}

' ** Lights MANAGEMENT ***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_LightsMgmnt}

' >>> State <<<
  (L.L.Navocap_Mode)
  (L.L.Navocap_DriverIsConnected) &&
  {if}
     1 (S.L.Navocap_LIGHT_State_Green)
     0 (S.L.Navocap_LIGHT_State_Orange) (S.L.Navocap_LIGHT_State_Red)
  {else}
    (L.L.elec_busbar_main) (L.L.Navocap_Mode) (L.L.Navocap_DriverIsConnected) ! && ||
    {if}
      0 (S.L.Navocap_LIGHT_State_Green) (S.L.Navocap_LIGHT_State_Orange) (S.L.Navocap_LIGHT_State_Red)
    {endif}
  {endif}

' >>> Radio + GPS <<<
  (L.L.Navocap_Mode)
  {if}
    (L.L.schedule_active)
    {if}
      1 (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_Radio_Green)
      0 (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_GPS_Red) (S.L.Navocap_LIGHT_Radio_Orange) (S.L.Navocap_LIGHT_Radio_Red)
    {else}
      1 (S.L.Navocap_LIGHT_GPS_Red) (S.L.Navocap_LIGHT_Radio_Red)
      0 (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_Radio_Green) (S.L.Navocap_LIGHT_Radio_Orange)
    {endif}
  {else}
    (L.L.elec_busbar_main) (L.L.Navocap_Mode) (L.L.schedule_active) ! && ||
    {if}
      0 (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_GPS_Red)
        (S.L.Navocap_LIGHT_Radio_Green) (S.L.Navocap_LIGHT_Radio_Orange) (S.L.Navocap_LIGHT_Radio_Red)
    {endif}
  {endif}

' >>> TTDelay <<<
  (L.L.Navocap_Mode)
  {if}
    (L.L.Navocap_DriverIsConnected) (L.L.Navocap_DriverHasAnActiveService) ! &&
    {if}
      1 (S.L.Navocap_LIGHT_TTDelay_Green)
      0 (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Red)
    {else}
    (L.L.Navocap_DriverHasAnActiveService)
    {if}
      (L.L.Navocap_FirstStopIndex) 0 >= (L.L.Navocap_BUFFER_DepartureHour) (L.S.Time) - 0 > &&
      (L.L.Navocap_FirstStopIndex) 0 >= ! (L.L.Navocap_BUFFER_TTDelay) 60 / s0 -1 < && ||
      (L.L.schedule_active) ! ||
      {if}
          (L.L.Navocap_Blink_Timegap) (L.S.GetTime) (L.L.Navocap_Blink_Timegap) - 1 % 0.5 > && (L.L.Navocap_Blink_Timegap) ! ||
          (S.L.Navocap_LIGHT_TTDelay_Red)
        0 (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Orange)
      {else}
      l0 1 >
      {if}
          (L.L.Navocap_Blink_Timegap) (L.S.GetTime) (L.L.Navocap_Blink_Timegap) - 1 % 0.5 > && (L.L.Navocap_Blink_Timegap) ! ||
          (S.L.Navocap_LIGHT_TTDelay_Orange)
        0 (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Red)
      {else}
          (L.L.Navocap_Blink_Timegap) (L.S.GetTime) (L.L.Navocap_Blink_Timegap) - 1 % 0.5 > && (L.L.Navocap_Blink_Timegap) ! ||
          (S.L.Navocap_LIGHT_TTDelay_Green)
        0 (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Red)
      {endif}
      {endif}
    {else}
      0 (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Red)
    {endif}
    {endif}
  {else}
    (L.L.elec_busbar_main)
    {if}
      0 (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Red)
    {endif}
  {endif}

{end}

' ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_Calculator}

' > Is a driver connected?
  (L.L.Navocap_ID) s0 (C.L.Navocap_ID) = (L.L.Navocap_Pwd) (C.L.Navocap_Pwd) = && (L.L.Navocap_IsAI) (L.L.Navocap_AI_ID) l0 = && || (S.L.Navocap_DriverIsConnected)

' > Does this driver have a currently running service?
  (L.L.Navocap_Srv) 0 > (S.L.Navocap_DriverHasAnActiveService)
' + TFT screen
'  (L.L.schedule_active) (L.L.Navocap_DriverIsConnected) && && (S.L.SAEIV_GPSIsConnected)

' > Near Station?
  (L.$.Navocap_LastBusstopKnown) (M.V.GetTTBusstopIndex) $IntToStr (M.V.GetTTBusstopName) $+ $= !
  {if}
    (M.V.GetTTBusstopIndex) (M.V.GetTTBusstopArr) s0 l0 86399 > 86400 * - (M.V.GetTTDelay) + (L.S.Time) - (C.L.Navocap_Delay_BeforeBeingAtStation_insec) < &&
    {if} (M.V.GetTTBusstopIndex) $IntToStr (M.V.GetTTBusstopName) $+ (S.$.Navocap_LastBusstopKnown) 1 {else} 0 {endif} (S.L.Navocap_AtStation)
  {endif}

' > Reset the BusstopOffset
  (L.L.Navocap_BusstopIndex_Offset)
  {if}
    (L.L.Navocap_BusstopIndex_Timegap) (L.S.Timegap) + (S.L.Navocap_BusstopIndex_Timegap) 10 >
    (L.L.Navocap_BusstopIndex_LastIndex) (M.V.GetTTBusstopIndex) = ! ||
    {if}
      0 (S.L.Navocap_BusstopIndex_Offset)
    {endif}
  {else}
    0 (S.L.Navocap_BusstopIndex_Timegap)
    (M.V.GetTTBusstopIndex) (S.L.Navocap_BusstopIndex_LastIndex)
  {endif}

' > What hour is it?
    (L.S.Time) 3600 / s0 trunc s1 "02" $IntToStrEnh ":" $+ l0 l1 - 60 * "02" $IntToStrEnh $+ ":" $+ (L.S.Time) 60 / s0 trunc s1 l0 l1 - 60 * trunc "02" $IntToStrEnh $+ (S.$.Navocap_Hour)

' > What day is it?
  (L.S.Month) 3 <
  {if}
    23 (L.S.Month) * 9 / (L.S.Day) + 4 + (L.S.Year) + (L.S.Year) 1 - 4 / + (L.S.Year) 1 - 100 / - (L.S.Year) 1 - 400 / 7 % trunc (S.L.Navocap_Day)
  {else}
    23 (L.S.Month) * 9 / (L.S.Day) + 2 + (L.S.Year) + (L.S.Year) 4 / + (L.S.Year) 100 / - (L.S.Year) 400 / + 7 % trunc (S.L.Navocap_Day)
  {endif}

' > LineString
  (L.L.schedule_active)
  {if}
    0 (M.V.GetDepotStringGlobal) "Express 91.06" $= 0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= || (M.V.GetTTTerminusIndex) (M.V.GetTerminusCode) "03" $IntToStrEnh $cutEnd 06 = &&
    {if}
      (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) 12 $SetLengthL 6 $cutBegin (S.$.Navocap_TTLineString)
    {else}
      0 (M.V.GetDepotStringGlobal) "St-Servan" $=
      {if}
        (M.V.GetTTTerminusIndex) (M.V.GetTerminusCode) "03" $IntToStr 1 $cutEnd "20" $=
        (M.V.GetTTTerminusIndex) (M.V.GetTerminusCode) "03" $IntToStr 1 $cutEnd "23" $= ||
        {if}
          (M.V.GetTTTerminusIndex) (M.V.GetTerminusCode) "03" $IntToStr 1 $cutEnd (S.$.Navocap_TTLineString)
        {else}
          (M.V.GetTTLineString) (S.$.Navocap_TTLineString)
        {endif}
      {else}
        (M.V.GetTTLineString) (S.$.Navocap_TTLineString)
      {endif}
   {endif}
  {else}
    "0000" (S.$.Navocap_TTLineString)
  {endif}

(L.L.AI) !
{if}

' /// Trigger for Announcements ///
  (L.L.Navocap_DriverHasAnActiveService) (L.L.schedule_active) &&
  (M.V.GetTTBusstopIndex) s0 0 =
  l0 0 > l0 (L.L.Navocap_FirstStopIndex) = ! && (L.L.Navocap_Announcement_AntiRepeat_off) && || &&
  {if}

'   > ...When arriving at a stop / Before first stop departure (on some maps)
      (M.V.GetTTBusstopDep) (L.S.Time) - 20 <= (M.V.GetTTBusstopIndex) 0 = &&
    l0 (M.V.GetTTBusstopArr) s1 l1 86399 > 86400 * - (M.V.GetTTDelay) + (L.S.Time) - 15 < l0 && ||
    l0 (M.V.GetTTBusstopName) (L.$.Navocap_LastBusstopArrAnnouncementPlayed) $= ! &&
    {if}
      (M.L.Navocap_PlayBusstopArrAnnouncement)
      (M.V.GetTTBusstopIndex) (M.V.GetTTBusstopName) (S.$.Navocap_LastBusstopArrAnnouncementPlayed)
    {endif}

'   > ...When departing from a stop (on some maps)
    (M.V.GetTTBusstopIndex) (M.V.GetTTBusstopName) (L.$.Navocap_LastBusstopDepAnnouncementPlayed) $= !
    {if}
      (M.L.Navocap_PlayBusstopDepAnnouncement)
      (M.V.GetTTBusstopIndex) (M.V.GetTTBusstopName) (S.$.Navocap_LastBusstopDepAnnouncementPlayed)
    {endif}

'   > ...When opening the doors (on some maps)
    (L.L.door_0) 0.9 > (L.L.door_1) 0.9 > ||
    (C.L.Navocap_DoorAnnouncement_DoorBack) (L.L.door_2) 0.9 > (L.L.door_3) 0.9 > || (L.L.door_4) 0.9 > || (L.L.door_5) 0.9 > || (L.L.door_6) 0.9 > || (L.L.door_7) 0.9 > || && ||
    {if}
      (L.L.Navocap_DoorAnnouncement_Blocked) !
      (L.L.Navocap_DoorAnnouncement_Played) ! &&
      {if}
        (M.L.Navocap_PlayDoorAnnouncement)
        1 (S.L.Navocap_DoorAnnouncement_Blocked)
          (S.L.Navocap_DoorAnnouncement_Played)
      {endif}
    {else}
      0 (S.L.Navocap_DoorAnnouncement_Played)
    {endif}

  {endif}

  (L.L.Navocap_DoorAnnouncement_Blocked)
  {if}
    (L.L.Navocap_DoorAnnouncement_Blocked_timer) (L.S.Timegap) + (C.L.Navocap_DoorAnnouncement_Block_time_insec) min (S.L.Navocap_DoorAnnouncement_Blocked_timer) (C.L.Navocap_DoorAnnouncement_Block_time_insec) =
    {if}
      0 (S.L.Navocap_DoorAnnouncement_Blocked) (S.L.Navocap_DoorAnnouncement_Blocked_timer)
    {endif}
  {endif}

' > Refresh IBIS and Display data automatically
  (M.V.GetTTLineString) (M.V.GetTTTerminusIndex) 0 (M.V.GetTerminusString) $+ (L.$.Navocap_LastTargetKnown) $= !
  (L.L.Navocap_DriverHasAnActiveService) &&
  {if}
    (L.L.schedule_active)
    {if}
      (L.L.IBIS_TerminusCode_auto_set)
      {if}
        (L.$.Navocap_TTLineString) (S.$.Matrix_Nr) (S.$.Matrix_Liniennummerstring)
        (M.V.GetTTTerminusIndex) (S.L.IBIS_TerminusIndex) (M.V.GetTerminusCode) (S.L.IBIS_TerminusCode)
        -1 (S.L.Matrix_TerminusIndex_Last) (M.L.Navocap_RefreshTerminusText)
      {endif}
      4 (S.L.Navocap_Mode) (M.V.GetTTBusstopIndex) (S.L.Navocap_FirstStopIndex)
      0 (S.L.Navocap_Blink_Timegap) (S.L.Navocap_BusstopIndex_Offset)
    {endif}
    (M.V.GetTTLineString) (M.V.GetTTTerminusIndex) 0 (M.V.GetTerminusString) $+ (S.$.Navocap_LastTargetKnown)
  {endif}

' > Return to the main screen automatically when starting from the first stop and prevent that the first stop announcement is played
  (M.V.GetTTLineString) (M.V.GetTTTerminusIndex) 0 (M.V.GetTerminusString) $+ (L.$.Navocap_LastTargetKnown) $= (M.V.GetTTBusstopIndex) (L.L.Navocap_FirstStopIndex) > && (M.V.GetTTBusstopIndex) (M.V.GetTTBusstopName) (L.L.Navocap_FirstStopIndex) (M.V.GetTTBusstopName) $= ! && (S.L.Navocap_Announcement_AntiRepeat_off) (L.L.Navocap_Mode) 4 = && {if} -1 (S.L.Navocap_FirstStopIndex) (S.L.Navocap_FirstStopIndex_Hour) 0 (S.L.Navocap_Blink_Timegap) (S.L.Navocap_BusstopIndex_Offset) 5 (S.L.Navocap_Mode) {endif}

{else}

' >>> AI <<<
  (L.L.elec_busbar_main)
  {if}
    (L.L.Navocap_DriverHasAnActiveService) !
    {if}
      6251826 random 1 max (S.L.Navocap_Srv)
      (L.L.Navocap_AI_ID) (S.L.Navocap_ID)
    {endif}
    5 (S.L.Navocap_Mode)
    1 (S.L.Navocap_IsAI)
  {endif}

{endif}

{end}

{macro:Navocap_RefreshTerminusText}
  (L.L.IBIS_TerminusIndex) 0 (M.V.GetTerminusString) (S.$.IBIS_terminus_name)
{end}

{macro:Navocap_ChangeDriver}
  0
  (S.L.Navocap_ID) (S.L.Navocap_Pwd) (S.L.Navocap_Srv) (S.L.Navocap_input_mode)
  (S.L.Navocap_Redirect_Timegap) (S.L.Navocap_Blink_Timegap) (S.L.Navocap_BusstopIndex_Offset)
  (S.L.Navocap_DoorAnnouncement_Played) (S.L.Navocap_DoorAnnouncement_Blocked) (S.L.Navocap_DoorAnnouncement_Blocked_timer)
  (S.L.Navocap_IsAI)
  -1
  (S.L.Navocap_FirstStopIndex) (S.L.Navocap_FirstStopIndex_Hour)
  (S.L.Navocap_BusstopIndex_LastIndex)
  ""
  (S.$.Navocap_input_User) (S.$.Navocap_ID_input_User) (S.$.Navocap_Pwd_input_User) (S.$.Navocap_Srv_input_User)
  (S.$.Navocap_LastTargetKnown) (S.$.Navocap_LastBusstopKnown) (S.$.Navocap_LastBusstopArrAnnouncementPlayed) (S.$.Navocap_LastBusstopDepAnnouncementPlayed)
{end}

{macro:Navocap_EndRun}
  0
  (S.L.Navocap_Srv) (S.L.Navocap_input_mode)
  (S.L.Navocap_Redirect_Timegap) (S.L.Navocap_Blink_Timegap) (S.L.Navocap_BusstopIndex_Offset)
  (S.L.Navocap_DoorAnnouncement_Played) (S.L.Navocap_DoorAnnouncement_Blocked) (S.L.Navocap_DoorAnnouncement_Blocked_timer)
  (S.L.Navocap_IsAI)
  -1
  (S.L.Navocap_FirstStopIndex) (S.L.Navocap_FirstStopIndex_Hour)
  (S.L.Navocap_BusstopIndex_LastIndex)
  ""
  (S.$.Navocap_input_User) (S.$.Navocap_ID_input_User) (S.$.Navocap_Pwd_input_User) (S.$.Navocap_Srv_input_User)
  (S.$.Navocap_LastTargetKnown) (S.$.Navocap_LastBusstopKnown) (S.$.Navocap_LastBusstopArrAnnouncementPlayed) (S.$.Navocap_LastBusstopDepAnnouncementPlayed)

{end}

' ** ANNOUNCEMENTS ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_PlayBusstopArrAnnouncement}

  (L.L.Navocap_TargetHasNoAnsagen) !
  {if}

    "..\..\Announcements\"
    0 (M.V.GetDepotStringGlobal) $+
    "\" $+ s0 $length s5

    (M.V.GetTTBusstopIndex) 0 >
    {if}

'     Express 91.06 / Grand Paris-Moulon
      0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
      0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= ||
      {if}

        (M.V.GetTTBusstopCount) 1 - (M.V.GetTTBusstopIndex) = !
        {if}

          (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) 11 $SetLengthL "LIGNE 91.06" $=
          {if}
            l0 (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) $RemoveSpaces 3 $SetLengthR $+ s0
          {else}
            l0 (M.V.GetTTLineString) $+ s0
          {endif}

          0 (M.V.GetDepotStringGlobal) "Express 91.06" $= (M.V.GetTTLineString) "11" $= ! &&
          0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= (L.$.Yard) "Grand Paris-Moulon Keolis" $= ! (L.$.Yard) "Grand Paris-Moulon GPM" $= ! && && ||
          {if}
            l0 (M.V.GetTTTerminusIndex) (M.L.Navocap_GetTTTerminusPrefix) $+ s0
          {else}
            l0 "_" $+ s0
          {endif}
          l0 "A_" $+ (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ s0

        {else}

          (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) 11 $SetLengthL "LIGNE 91.06" $=
          {if}
            l0 "06" $+ s0
          {else}
            l0 (M.V.GetTTLineString) $+ s0
          {endif}

          (L.$.Yard) "Grand Paris-Moulon Keolis" $= {if} l0 "_Term" $+ s0 {endif}

          l0 "_A_" $+ (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ "_#terminus" $+ s0

        {endif}

      {else}

'     Hamburg / Gladbeck(? untested) / Ruhr(? untested)
      0 (M.V.GetDepotStringGlobal) "HamburgTagUndNacht" $=
      0 (M.V.GetDepotStringGlobal) "HamburgHafenCity"   $= ||
      0 (M.V.GetDepotStringGlobal) "Gladbeck"           $= ||
      0 (M.V.GetDepotStringGlobal) "Ruhrgebiet"         $= ||
      {if}
        l0 (M.V.GetTTLineString) "_" $+ $+
        (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) (M.V.GetBusstopIndex) 3 (M.V.GetBusstopString) $+ s0

        (M.V.GetTTBusstopCount) 1 - (M.V.GetTTBusstopIndex) =
        {if}
          l0 "_#terminus" $+ s0
        {endif}

      {else}

'     Horizon16
      0 (M.V.GetDepotStringGlobal) "Horizon16" $=
      {if}

        (M.V.GetTTBusstopCount) 1 - (M.V.GetTTBusstopIndex) = !
        {if}
          l0 (M.V.GetTTLineString) $+ "_" $+
          (M.V.GetTTTerminusIndex) (M.L.Navocap_GetTTTerminusPrefix) $+ "_" $+
          (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ s0
        {else}
          l0 (M.V.GetTTBusstopIndex) (M.V.GetTTBusstopName) $+
          "_#terminus" $+ s0
        {endif}

      {else}

'     Other maps (classic functionning) + Chicago Downtown
        0 (M.V.GetDepotStringGlobal) "DBC_Chicago" $=
        {if}
          l0 (M.V.GetTTLineString) "_" $+ $+ s0
        {endif}

        l0 (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ s0

        (M.V.GetTTBusstopCount) 1 - (M.V.GetTTBusstopIndex) =
        {if}
          l0 "_#terminus" $+ s0
        {endif}

      {endif}
      {endif}
      {endif}

    {else}

'   > Play an announcement just before the departure of the terminus (on some maps only)

'     Express 91.06 / Grand Paris-Moulon
      0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
      0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= ||
      {if}
        (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) 11 $SetLengthL "LIGNE 91.06" $=
        {if}
          l0 (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) $RemoveSpaces 3 $SetLengthR $+ s0
        {else}
          l0 (M.V.GetTTLineString) $+ s0
        {endif}

        l0 (M.V.GetTTTerminusIndex) (M.L.Navocap_GetTTTerminusPrefix) $+ s0

        0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
        {if}
          l0 "Dep_" $+ s0
        {else}
          l0 "Dep_vers_" $+ s0
        {endif}

        l0 0 (M.L.Navocap_GetTTBusstopName) $+ s0

      {else}

'     Horizon16
      0 (M.V.GetDepotStringGlobal) "Horizon16" $=
      {if}

        l0 (M.V.GetTTLineString) $+ "_" $+
        (M.V.GetTTTerminusIndex) (M.L.Navocap_GetTTTerminusPrefix) $+ "_" $+
        (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ s0

      {else}

      0 (M.V.GetDepotStringGlobal) "St-Servan" $=
      {if}

        l0 (L.$.Navocap_TTLineString) $+ "_" $+
        (M.V.GetTTTerminusIndex) 0 (M.V.GetTerminusString) $+
        "_#target" $+ s0

      {endif}
      {endif}
      {endif}

    {endif}

    l0 ".wav" $+ $length l5 + l5 - 4 >
    {if}
      (T.F.ev_IBIS_Ansagen)
    {endif}

  {endif}

{end}

{macro:Navocap_PlayBusstopDepAnnouncement}

  (M.V.GetTTBusstopIndex)
  (L.L.Navocap_TargetHasNoAnsagen) ! &&
  {if}

    "..\..\Announcements\"
    0 (M.V.GetDepotStringGlobal) $+
    "\" $+ s0 $length s5

'   Express 91.06 / Grand Paris-Moulon
    0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
    0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= ||
    {if}

      (M.V.GetTTBusstopCount) 1 - (M.V.GetTTBusstopIndex) = !
      {if}
        (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) 11 $SetLengthL "LIGNE 91.06" $=
        {if}
          l0 "06" $+ s0
        {else}
          l0 (M.V.GetTTLineString) $+ s0
        {endif}

        l0 "_PA_" $+ (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ s0
      {endif}

    {else}

'   Horizon16
    0 (M.V.GetDepotStringGlobal) "Horizon16" $=
    {if}

      (M.V.GetTTBusstopCount) 1 - (M.V.GetTTBusstopIndex) = !
      {if}
        l0 (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) $+ s0
      {endif}

    {endif}
    {endif}

    l0 ".wav" $+ $length l5 + l5 - 4 >
    {if}
      (T.F.ev_IBIS_Ansagen)
    {endif}

  {endif}

{end}

{macro:Navocap_PlayDoorAnnouncement}

  (L.L.Navocap_TargetHasNoAnsagen) !
  {if}

    "..\..\Announcements\"
    0 (M.V.GetDepotStringGlobal) $+
    "\" $+ s0 $length s5

'   Express 91.06
    0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
    {if}
'      (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) 11 $SetLengthL "LIGNE 91.06" $=
'      {if}
'        l0 (M.V.GetTTTerminusIndex) 1 (M.V.GetTerminusString) $RemoveSpaces 3 $SetLengthR $+ s0
'      {else}
'        l0 (M.V.GetTTLineString) $+ s0
'      {endif}
'
'      l0 (M.V.GetTTTerminusIndex) (M.L.Navocap_GetTTTerminusPrefix) $+
'      "_#ext" $+ s0

    {else}

'   Horizon16
    0 (M.V.GetDepotStringGlobal) "Horizon16" $=
    {if}
      l0 (M.V.GetTTLineString) $+ "_" $+
      (M.V.GetTTTerminusIndex) (M.L.Navocap_GetTTTerminusPrefix) $+ "_" $+ s0

      (M.V.GetTTBusstopIndex) (M.L.Navocap_GetTTBusstopName) (L.$.Navocap_LastBusstopArrAnnouncementPlayed) $= !
      {if} (M.V.GetTTBusstopIndex) 1 - {else} (M.V.GetTTBusstopIndex) {endif} s1

      l0 l1 $+ (M.L.Navocap_GetTTBusstopName) $+ s0

    {else}

'   St-Servan
    0 (M.V.GetDepotStringGlobal) "St-Servan" $=
    {if}

      l0 (L.$.Navocap_TTLineString) $+ "_" $+
      (M.V.GetTTTerminusIndex) 0 (M.V.GetTerminusString) $+
      "_#target" $+ s0

    {else}

'   Other Maps + DBC_Chicago

      l0 (M.V.GetTTLineString) $+ s0

      0 (M.V.GetDepotStringGlobal) "DBC_Chicago" $=
      {if}
        l0 "_EXT_" $+ s0
      {else}
        l0 "_" $+ s0
      {endif}

      l0 (M.V.GetTTTerminusIndex) 0 (M.V.GetTerminusString) $+ s0

      0 (M.V.GetDepotStringGlobal) "DBC_Chicago" $= !
      {if}
        l0 "_#ext" $+ s0
      {endif}

    {endif}
    {endif}
    {endif}

    l0 ".wav" $+ $length l5 + l5 - 4 >
    {if}
'     debug: supprimer l'ansagen classique
      (T.F.ev_IBIS_Ansagen)
      (T.F.ev_IBIS_Ansagen_ext)
    {endif}

  {endif}

{end}

' ** GetTTMacros *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

'Determines the prefix used for announcements file
{macro:Navocap_GetTTTerminusPrefix}
  s0 (M.V.GetTerminusCode) s1

' >>> Express 91.06  / Grand Paris-Moulon <<<
  0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
  (L.$.Yard) "Grand Paris-Moulon" $= ||
  {if}

    l1 111 =
    {if}
      "_BG_"
    {else}
    l1 62 = l1 64 = ||
    {if}
      "_CG_"
    {else}
    l1 113 =
    {if}
      "_JM_"
    {else}
    l1 61 = l1 63 = || l1 65 = || l1 67 = ||
    {if}
      "_MG_"
    {else}
    l1 66 = l1 68 = ||
    {if}
      "_PM_"
    {else}
    l1 112 =
    {if}
      "_QR_"
    {else}
      ""
    {endif}
    {endif}
    {endif}
    {endif}
    {endif}
    {endif}

  {else}

' >>> Horizon16 <<<
  0 (M.V.GetDepotStringGlobal) "Horizon16" $=
  {if}

    l0 0 (M.V.GetTerminusString) 1 $SetLengthL

  {else}

' >>> St-Servan <<<
  0 (M.V.GetDepotStringGlobal) "St-Servan" $=
  {if}

    l1 "03" $IntToStr 1 $cutEnd "20" $=
    l1 "03" $IntToStr 1 $cutEnd "23" $= ||
    {if}
      l1 "03" $IntToStr 1 $cutEnd
    {else}
      (M.V.GetTTLineString)
    {endif}

  {else}
    ""
  {endif}
  {endif}
  {endif}

{end}

'Custom Busstop Initials
{macro:Navocap_GetTTBusstopInitials}
    (M.V.GetTTBusstopName) s0 (S.$.Navocap_tmpstr3)

' Custom initials for Express 91.06 / Grand Paris-Moulon
  0 (M.V.GetDepotStringGlobal) "Express 91.06" $=
  0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= ||
  {if}
  (L.$.Navocap_tmpstr3) 5 $SetLengthL "MASSY" $= {if} "MG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Palaiseau Ville" $= {if} "PV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 10 $cutBegin 7 $SetLengthL "La Vall" $= {if} "RLV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 6 $cutBegin "Camille Claudel" $= {if} "LCC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Campus Paris-Moulon" $= {if} "CPM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Groupe Airbus" $= {if} "GAB" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Danone Research" $= {if} "DR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 5 $SetLengthL "ENSTA" $= {if} "EMS" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les Joncherettes" $= {if} "JCR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 5 $SetLengthL "PMSud" $= {if} "THA" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les Tuileries" $= {if} "TU" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les Algorithmes" $= {if} "ALG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Mare du Vivier" $= {if} "CEA" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 4 $cutEnd "La Martin" $= {if} "MRT" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Plateau du Moulon" $= {if} "PM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Croix Pasquier" $= {if} "CP" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Place du village" $= {if} "PV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 4 $cutEnd "Noisy le B" $= {if} "NLB" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Petit plan" $= {if} "PP" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Jules Verne" $= {if} "JV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Rond-point" $= {if} "RD" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) $cutEnd "Jean Mac" $= {if} "JM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 6 $SetLengthL "Genevi" $= {if} "GA" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Avenue Cormeilles Sud" $= {if} "CS" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les Gobelins" $= {if} "GBL" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Cormeilles Gare quai C3" $= {if} "PCG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Pause CORMEILLES Gare" $= {if} "CG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Mairie de Nozay" $= {if} "MNZ" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Petit bois" $= {if} "PB" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 3 $cutBegin "vres Gare" $= {if} "BG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Quartier residentiel" $= {if} "QR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Place 1802" $= {if} "LCM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 6 $SetLengthL "Keolis" $= {if} "KEM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Petit Viltain" $= {if} "VLT" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Gare de Vauboyen" $= {if} "VAU" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Clos Normand" $= {if} "NRM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Val de Grace" $= {if} "VDG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Route de Chevreuse" $= {if} "RDC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Haut-Pre" $= {if} "HP" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Ferme Neuve" $= {if} "FN" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "La Vauve" $= {if} "VV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Fresnel" $= {if} "FSN" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Polytech Paris-Moulon" $= {if} "PLY" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 16 $SetLengthL "Residence Emilie" $= {if} "EDC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Paris Sud XI" $= {if} "PXI" (S.$.Navocap_tmpstr3) {endif}
  {endif}

' Custom initials for Horizon16
  0 (M.V.GetDepotStringGlobal) "Horizon16" $= {if}
  (L.$.Navocap_tmpstr3) 4 $cutBegin "e du commerce" $= {if} "ADC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Anatole France" $= {if} "AF" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) $cutEnd "Balsan Universit" $= {if} "BU" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) $cutEnd "Beaupr" $= {if} "BPR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Bel air" $= {if} "AIR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 2 $cutBegin "cile Sorel" $= {if} "SOR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Ecole Les Planches" $= {if} "PLA" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Etang de Von" $= {if} "EV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 4 $SetLengthR "Faye" $= {if} "HF" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 2 $cutBegin "tel de ville" $= {if} "HDV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Jules Ferry" $= {if} "JF" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "La loge" $= {if} "LOG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 8 $SetLengthR "Occitane" $= {if} "OCC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "La nourat" $= {if} "NOU" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les clefs moreaux" $= {if} "CM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les coteaux" $= {if} "COT" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les Gauthiers" $= {if} "GAU" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les grouailles" $= {if} "GR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les ormeaux" $= {if} "ORM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Les silos" $= {if} "SIL" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 8 $SetLengthR "s France" $= {if} "MFR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Notz" $= {if} "NTZ" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 12 $SetLengthL "Parc d'activ" $= {if} "PAG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Place de Blois" $= {if} "PLB" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Plateau de Bel Air" $= {if} "AIR" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 6 $SetLengthR "Naudin" $= {if} "NAU" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 3 $cutBegin "fecture" $= {if} "PRF" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 2 $cutBegin "publique" $= {if} "RPB" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Route de Niherne" $= {if} "NIH" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Saint Maur" $= {if} "STM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "Saint Maur Centrale" $= {if} "SMC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "St Pierre" $= {if} "STP" (S.$.Navocap_tmpstr3) {endif}
'Terminus
  (L.$.Navocap_tmpstr3) 8 $SetLengthR "Voltaire" $= {if} "VOL" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 11 $SetLengthR "Voltaire SP" $= {if} "VOL" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) "1 Beaulieu SP" $= {if} "BEA" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 10 $SetLengthR "Saint Maur" $= {if} "STM" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 9 $SetLengthR "Pointerie" $= {if} "POI" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 12 $SetLengthR "Pointerie SP" $= {if} "POI" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 7 $SetLengthR "La loge" $= {if} "LOG" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 4 $SetLengthR "Notz" $= {if} "NTZ" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 13 $SetLengthR "St Christophe" $= {if} "STC" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 9 $SetLengthR "St Pierre" $= {if} "STP" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 8 $SetLengthR "Provence" $= {if} "PRO" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 6 $SetLengthR "MACH36" $= {if} "M36" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 12 $SetLengthR "Etang de Von" $= {if} "EV" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 18 $SetLengthR "Ecole Les Planches" $= {if} "PLA" (S.$.Navocap_tmpstr3) {endif}
  (L.$.Navocap_tmpstr3) 14 $SetLengthR "Place de Blois" $= {if} "PLB" (S.$.Navocap_tmpstr3) {endif}
  {endif}

' 2nd BusstopString as initials for Hamburg (if the string is not empty)
  0 (M.V.GetDepotStringGlobal) "HamburgHafenCity" $=
  0 (M.V.GetDepotStringGlobal) "HamburgTagUndNacht" $= ||
  (L.$.Navocap_tmpstr3) (M.V.GetBusstopIndex) 2 (M.V.GetBusstopString) $length 0 > &&
  {if}
    (S.$.Navocap_tmpstr3)
  {endif}

$+ 3 $SetLengthL
{end}

'Replaces (M.V.GetTTBusstopName) for announcement and terminus names that need typo correction
{macro:Navocap_GetTTBusstopName} s0
   (M.V.GetTTBusstopName) s1
  (S.$.Navocap_tmpstr1)

' Express 91.06 / Grand Paris-Moulon
  0 (M.V.GetDepotStringGlobal) "Express 91.06" $= 0 (M.V.GetDepotStringGlobal) "Grand Paris-Moulon" $= || {if}
  (L.$.Navocap_tmpstr1) "MASSY Gare - Terminus" $= {if} "MASSY Gare" s1 {endif}
  (L.$.Navocap_tmpstr1) "Cormeilles Gare - Terminus" $= {if} "Cormeilles Gare" s1 {endif}
  (L.$.Navocap_tmpstr1) 7 $SetLengthR "quai C3" $= {if} "Cormeilles Gare" s1 {endif}
  (L.$.Navocap_tmpstr1) "PAUSE PM3" $= {if} "Plateau du Moulon" s1 {endif}
  (L.$.Navocap_tmpstr1) 5 $SetLengthL "PMSud" $= {if} "PMSud Thalès" s1 {endif}
  (L.$.Navocap_tmpstr1) 5 $SetLengthL "ENSTA" $= {if} "ENSTA Moulon Sud" s1 {endif}
  (L.$.Navocap_tmpstr1) "Place 1802" $= {if} "Depot Transdev" s1 {endif}
  (L.$.Navocap_tmpstr1) 6 $SetLengthL "Keolis" $= {if} "Depot Keolis" s1 {endif}
  (L.$.Navocap_tmpstr1) 8 $SetLengthL "Quartier" $= {if} "Vauhallan Quartier résidentiel" s1 {endif}
  {endif}

' Horizon16
  0 (M.V.GetDepotStringGlobal) "Horizon16" $= {if}
  (L.$.Navocap_tmpstr1) "1 Voltaire" $= {if} "Voltaire" s1 {endif}
  (L.$.Navocap_tmpstr1) "1 Cap Sud" $= {if} "Cap Sud" s1 {endif}
  (L.$.Navocap_tmpstr1) "1 Voltaire SP" $= {if} "Voltaire SP" s1 {endif}
  (L.$.Navocap_tmpstr1) "1 Beaulieu SP" $= {if} "Beaulieu SP" s1 {endif}
  (L.$.Navocap_tmpstr1) "2 Voltaire" $= {if} "Voltaire" s1 {endif}
  (L.$.Navocap_tmpstr1) "2 Saint Maur" $= {if} "Saint Maur" s1 {endif}
  (L.$.Navocap_tmpstr1) "2 Voltaire SP" $= {if} "Voltaire SP" s1 {endif}
  (L.$.Navocap_tmpstr1) "2 Pointerie SP" $= {if} "Pointerie SP" s1 {endif}
  (L.$.Navocap_tmpstr1) "8 La loge" $= {if} "La loge" s1 {endif}
  (L.$.Navocap_tmpstr1) "8 Notz" $= {if} "Notz" s1 {endif}
  (L.$.Navocap_tmpstr1) "8 Saint Maur" $= {if} "Saint Maur" s1 {endif}
  (L.$.Navocap_tmpstr1) "8a La Loge" $= {if} "La Loge" s1 {endif}
  (L.$.Navocap_tmpstr1) "8a St Christophe" $= {if} "St Christophe" s1 {endif}
  (L.$.Navocap_tmpstr1) "8b La Loge" $= {if} "La Loge" s1 {endif}
  (L.$.Navocap_tmpstr1) "8b St Pierre" $= {if} "St Pierre" s1 {endif}
  (L.$.Navocap_tmpstr1) "9 La Loge" $= {if} "La Loge" s1 {endif}
  (L.$.Navocap_tmpstr1) "9 Provence" $= {if} "Provence" s1 {endif}
  (L.$.Navocap_tmpstr1) "B Pointerie" $= {if} "Pointerie" s1 {endif}
  (L.$.Navocap_tmpstr1) "B St Christophe" $= {if} "St Christophe" s1 {endif}
  (L.$.Navocap_tmpstr1) "CSL MACH36" $= {if} "MACH36" s1 {endif}
  (L.$.Navocap_tmpstr1) "CSL Etang de Von" $= {if} "Etang de Von" s1 {endif}
  (L.$.Navocap_tmpstr1) "F3 Voltaire" $= {if} "Voltaire" s1 {endif}
  (L.$.Navocap_tmpstr1) "S4 Ecole Les Planches" $= {if} "Ecole Les Planches" s1 {endif}
  (L.$.Navocap_tmpstr1) "S4 Place de Blois" $= {if} "Place de Blois" s1 {endif}
  {endif}

"" $+
{end}

' ** STARTUP PHASE ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

{macro:Navocap_Boot}
  (L.L.Navocap_init_timer) (L.S.Timegap) + (S.L.Navocap_init_timer) s0
             {if} "Navocap\nvcp_init1.dds"  {endif}
  l0 0.85 >  {if} "Navocap\nvcp_init2.dds"  {endif}
  l0 0.90 >  {if} "Navocap\nvcp_init3.dds"  {endif}
  l0 0.95 >  {if} "Navocap\nvcp_init4.dds"  {endif}
  l0 1.00 >  {if} "Navocap\nvcp_init5.dds"  {endif}
  l0 1.05 >  {if} "Navocap\nvcp_init6.dds"  {endif}
  l0 1.10 >  {if} "Navocap\nvcp_init7.dds"  {endif}
  l0 1.15 >  {if} "Navocap\nvcp_init8.dds"  {endif}
  l0 1.20 >  {if} "Navocap\nvcp_init9.dds"  {endif}
  l0 1.25 >  {if} "Navocap\nvcp_init10.dds" {endif}
  l0 1.30 >  {if} "Navocap\nvcp_init11.dds" {endif}
  l0 1.35 >  {if} "Navocap\nvcp_init12.dds" {endif}
  l0 1.40 >  {if} "Navocap\nvcp_init13.dds" {endif}
  l0 1.45 >  {if} "Navocap\nvcp_init14.dds" {endif}
  l0 1.50 >  {if} "Navocap\nvcp_init15.dds" {endif}
  l0 1.55 >  {if} "Navocap\nvcp_init16.dds" {endif}
  l0 1.60 >  {if} "Navocap\nvcp_init17.dds" {endif}
  l0 1.65 >  {if} "Navocap\nvcp_init18.dds" {endif}
  l0 3.00 >  {if} "Navocap\nvcp_main.dds" 1 (S.L.Navocap_Mode) {endif}
  (S.$.Navocap_Display)

  l0 1 <
  {if}
    1 (S.L.Navocap_LIGHT_State_Orange)   0 (S.L.Navocap_LIGHT_State_Green) (S.L.Navocap_LIGHT_State_Red)
    1 (S.L.Navocap_LIGHT_Radio_Orange)   0 (S.L.Navocap_LIGHT_Radio_Green) (S.L.Navocap_LIGHT_Radio_Red)
    1 (S.L.Navocap_LIGHT_GPS_Orange)     0 (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_GPS_Red)
    1 (S.L.Navocap_LIGHT_TTDelay_Orange) 0 (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Red)
  {else}
  l0 1.05 > l0 2 < &&
  {if}
    1 (S.L.Navocap_LIGHT_State_Green)   0 (S.L.Navocap_LIGHT_State_Orange) (S.L.Navocap_LIGHT_State_Red)
    1 (S.L.Navocap_LIGHT_Radio_Green)   0 (S.L.Navocap_LIGHT_Radio_Orange) (S.L.Navocap_LIGHT_Radio_Red)
    1 (S.L.Navocap_LIGHT_GPS_Green)     0 (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_GPS_Red)
    1 (S.L.Navocap_LIGHT_TTDelay_Green) 0 (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Red)
  {else}
  l0 2 >
  {if}
    1 (S.L.Navocap_LIGHT_State_Red)
    0 (S.L.Navocap_LIGHT_State_Green) (S.L.Navocap_LIGHT_State_Orange)
    0 (S.L.Navocap_LIGHT_Radio_Green) (S.L.Navocap_LIGHT_Radio_Orange) (S.L.Navocap_LIGHT_Radio_Red)
    0 (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_GPS_Red)
    0 (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Orange)
  {else}
    0 (S.L.Navocap_LIGHT_State_Orange) (S.L.Navocap_LIGHT_State_Green) (S.L.Navocap_LIGHT_State_Red)
    0 (S.L.Navocap_LIGHT_Radio_Orange) (S.L.Navocap_LIGHT_Radio_Green) (S.L.Navocap_LIGHT_Radio_Red)
    0 (S.L.Navocap_LIGHT_GPS_Orange) (S.L.Navocap_LIGHT_GPS_Green) (S.L.Navocap_LIGHT_GPS_Red)
    0 (S.L.Navocap_LIGHT_TTDelay_Orange) (S.L.Navocap_LIGHT_TTDelay_Green) (S.L.Navocap_LIGHT_TTDelay_Red)
  {endif}
  {endif}
  {endif}
{end}

' ********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
