0 Replies Latest reply on Jan 16, 2010 1:22 PM by wgb14

    File operations-Please help

    wgb14 Level 1

      I have one last thing to implement in my two year project. Its basically a workaround. If someone can help me to speed up please make it so.

       

      The following is a script executed by the 3D engine of my systems (not shockwave). What I am trying to implement is a pause function. Here are the steps

       

      a) Once the user clicks on a button in director a value (e.g., 7.7840) is returned representing the time (in seconds) in which the user pressed the pause button. The Lingo script that returns this value is a follows:

      Code:
        sprite(2).Query = "soundmgr currenttime Use_3.ogg"
        -- Close to the end of the presenation open the dialogue window
        timer1 = sprite(2).QueryReturn
      b) What I want is for Director to read the scripts (currently in external txt files) and get only the lines that have times (t=) greater than the value returned inside Director (i.e., timer1). Given a return value 7.7840 Director would get and store line 4-5. c) It should calculate the difference in times between the two lines and write the results in a new file. To be more specific below is an old file and how the new file should look like.

       

      Old file: (rturned value = 7.7840 )

       

      \clock [t= 0.0] \load [file= [sounds\Use_3.ogg]]
      \clock [t= 0] \SetSwitch [figure= fullBod switch= count3 state= three]
      \clock [t= 3] \SetSwitch [figure= fullBod switch= map_me state= start]
      \clock [t= 9] \SetSwitch [figure= fullBod switch= interesting state= start]
      \clock [t= 11] \SetSwitch [figure= fullBod switch= hope state= start]

       

      New File:

       

      \clock [t= 0] \SetSwitch [figure= fullBod switch= interesting state= start]
      \clock [t= 3] \SetSwitch [figure= fullBod switch= hope state= start] (11-9 = 3)

       

      Here is my Lingo code so far.

       

      Code:
      on hap_temp
        
        global gFileIO
        
        gFileIO = new(xtra "FileIO")
        
        gFileIO.openFile(the moviePath & "Use_3.hap", 1)
        script_line = gFileIO.readLine()
        gFileIO.closeFile()
        
        if script_line contains ("clock ") then 
          script("QuestionTracker").AddPhrase(script_line)
        else 
          -- do nothing
          
        end if 
        questions = script("QuestionTracker").GetPhrases()
       
      end