4 Replies Latest reply on Jun 20, 2007 12:11 AM by wgb14

    Another XML problem

    wgb14 Level 1
      Hi all,

      I wonder if it is possible to do the following in Director using XML.

      I have a handler that is called on mousedown and compares the input of a specific cast member (En_phrase) with a variable and if it is true it writes it in the appropriate level of the bots memory. In particular:

      on Intro_variations

      -- Introduction script to store the phrases into the bots different memory levels

      re = "[\.\,\?\!]|\s+$"
      re2 = "[\.\,\?\!]|^\s+"

      mq1I="Which attractions of the castle, are we going to visit?"
      mq2I="Why can't I create my own routes for the castle?"
      mq3I="What happens if i get lost?"
      mq4I="Can you repeat how to use the system?"

      PD0 = [mq1I,mq2I,mq3I,mq4I]

      CASE TRUE OF
      (PD0.getPos(member ("EN_text").text) <> 0):
      member("Level_1").text = RegExp_Replace(lineText, re, "", "gi")
      member("Level_1").text = RegExp_Replace(lineText, re2, "", "gi")
      END CASE

      end

      The EN_ text contains phrases that are updated based on what my user selects from a dialogue text meber on the stage that is updated through an XML database. It then compares the value of the English text meber to the variables in the list and if it is true it writes the phrase in Level 1. Now, my question is the following, is there any way to parse specific nodes of my XML phrase file (e.g. the node for Level 1 phrases) return the result in director, brake the text chunk into individual phrases and fill in the values of each variable automatically?

      For example: All the variable values(mq1I......mq4I) are contained in the xml node <level1></level1>. I know how to read this node and return the result in director, but i am not sure how to brake the result into individual phrases and fill-in the values of my variables aytomatically. Something like: 1) Brake the text chunk in phrases, 2) Fill in variable mq1I with the "Which attractions of the castle, are we going to visit?", mq2I with "Why can't I create my own routes for the castle?" and so on! Or even if it is possible to avoid the use of variables and fill in the list with each of the phrases aytomatically!

      Any ideas will be greatly appreciated

      Many thanks
        • 1. Re: Another XML problem
          wgb14 Level 1
          Anyone? I guess what i am asking is not possible!
          • 2. Re: Another XML problem
            Level 7
            It's not clear (to me) from your original post what you need to do. You say:
            <quote>
            For example: All the variable values(mq1I......mq4I) are contained in
            the xml node <level1></level1>. I know how to read this node and return
            the result in director, but i am not sure how to brake the result into
            individual phrases and fill-in the values of my variables aytomatically.
            Something like: 1) Brake the text chunk in phrases, 2) Fill in variable
            mq1I with the "Which attractions of the castle, are we going to visit?",
            mq2I with "Why can't I create my own routes for the castle?" and so on!
            </quote>
            It seems you are reading an XML node and wanting to break it up into
            individual lines and then assign each line to a named variable.
            Perhaps something like the following will help:
            --
            --tNodeString = "<node as read in from your parsed XML>"
            tList = []
            nLines = tNodeString.line.count
            repeat with l = 1 to nLines
            tList.append(tNodeString.line[l])
            end repeat
            -- tList now holds individual lines of you original node
            -- something you seemed to be doing with 'PD0 = [mq1I,mq2I,mq3I,mq4I]'
            • 3. Another XML problem
              wgb14 Level 1
              Igonre these posts this question has been answered!
              • 4. Another XML problem
                wgb14 Level 1
                Ignore these post this question has been answered!