3 Replies Latest reply on Feb 1, 2007 6:08 PM by Newsgroup_User

    End of Line Error

    jpowerw
      The following lines (particularly the first line - dashes) are causing Director 5.0 to give a "string does not end correctly" error. I tried to fine the code(s) to the char(s) at the end of the line but to no avail. I can't get the string into the program to replace the char(s) that Director likes. The error comes up as soon as the set statement is executed. Does anyone have any suggestions? They would be most appreciated.

      0:00 ------------------------------------------------------------
      0:00 InitGame: \sv_punkbuster\0\g_maxGameClients\0\capturelimit\0\sv_maxclients\8\timelimit\20\fraglimit \0\dmflags\0\sv_floodProtect\1\sv_maxPing\0\sv_minPing\0\sv_maxRate\0\sv_hostname\noname\v ersion\Q3 1.32 win-x86 Oct 7 2002\g_gametype\0\protocol\68\mapname\Q3DM1\sv_privateClients\0\sv_allowDownload\0\gamena me\baseq3\g_needpass\0

      --Program Lines:
      on startMovie
      formatText
      HALT --used during development
      end startMovie

      on formatText
      set a to " 0:00 ------------------------------------------------------------
      0:00 InitGame: \sv_punkbuster\0\g_maxGameClients\0\capturelimit\0\sv_maxclients\8\timelimit\20\fraglimit \0\dmflags\0\sv_floodProtect\1\sv_maxPing\0\sv_minPing\0\sv_maxRate\0\sv_hostname\noname\v ersion\Q3 1.32 win-x86 Oct 7 2002\g_gametype\0\protocol\68\mapname\Q3DM1\sv_privateClients\0\sv_allowDownload\0\gamena me\baseq3\g_needpass\0"

      set CRLF to RETURN&numToChar(10)
      set strLen to length(a)
      set i to 0
      repeat while i <= length(a)
      set i to i + 1
      if char i of a = numToChar(10) then put CRLF into char i of a --this code is coming up most of the time when
      -- the string passes through the program
      if i = strLen then EXIT repeat
      end repeat
      end formatText
        • 1. Re: End of Line Error
          James Newton, ACP Level 3
          You need to balance your quote marks:

          set a to " 0:00"
          • 2. Re: End of Line Error
            Level 7
            "jpowerw" <webforumsuser@macromedia.com> posted in
            macromedia.director.lingo:

            > The following lines (particularly the first line - dashes) are causing
            > Director 5.0 to give a "string does not end correctly" error.

            A line over 400 characters long just might be too much for Dir 5.

            You might try using the line continuation char for that version of Director,
            ¬ (hit Alt+Enter in the script editor if I recall correctly).

            If it's still no go, try concatenation. You wouldn't need to break it down
            this short, but for illustration:

            set a=" 0:00 ------------------------------------------------------------"
            set a=a &"0:00 InitGame: \sv_punkbuster\0\g_maxGameClients\0\capturelimit\"
            set a=a &"0\sv_maxclients\8\timelimit\20\fraglimit\0\dmflags\0\"
            set a=a &"sv_floodProtect\1\sv_maxPing\0\sv_minPing\0\sv_maxRate\0\"
            etc...


            --
            Mark A. Boyd
            Keep-On-Learnin' :)
            • 3. Re: End of Line Error
              Level 7
              "jpowerw" <webforumsuser@macromedia.com> posted in
              macromedia.director.lingo:

              > if char i of a = numToChar(10) then put CRLF into char i of a

              Woa. I just realized you're replacing *nix line feeds. I'm not sure how Dir 5
              will deal with those in a string. Why not format the string how you want
              before pasting into the script editor?

              Of course, if you're using fileIO to get that string instead of pasting into
              the script editor, you might need to use readToken() on the open file rather
              than readFile(). I seem to recall doing something like that back in Dir 4 or
              5 myself (floppy disks!)


              --
              Mark A. Boyd
              Keep-On-Learnin' :)