5 Replies Latest reply on Dec 28, 2006 5:31 AM by Lakerol

    get line from a field

    Lakerol
      i want to use this script to select a line from field one, and make it appear in field2.. It doens't work =(

      global clickLine, toAdd


      on mouseUp me

      clickLine = _mouse.mouseLine
      toAdd = member("field1").line[klikLijn]
      toAdd = member("field2").text

      end

        • 1. Re: get line from a field
          James Newton, ACP Level 3
          Drop this behavior on the sprite containing field1:

          on mouseUp me
          vMember = sprite(me.spriteNum).member
          vLine = the mouseLine
          vText = line vLine of field(vMember)

          put RETURN&vText after field ("field2")
          end
          • 2. Re: get line from a field
            Lakerol Level 1
            Yeah works great..
            But how can I manage it that he add's the clicked items to field2 instead of replacing them each time..?
            • 3. Re: get line from a field
              Lakerol Level 1
              Well i've found it do to so.. This is my script so far:

              global vMember, vLine, vText, vKies, vAantal

              on mouseUp me
              vMember = sprite(me.spriteNum).member
              vKies = sprite(me.spriteNum +1).member
              vLine = the mouseLine
              vText = line vLine of field(vMember)
              vAantal = member(vKies).linecount

              if vAantal = 9 then
              _player.alert ("you can only add 9 things")
              else
              member(vKies).line[vAantal+1] = vText
              end if

              end


              Next problem: field1 contains objects like "breadcrumb" and each of those items has a value like "5".. In field 2 the user makes a list of 9 items and wants to make the sum of the values of those items..
              How can I do this??
              • 4. Re: get line from a field
                James Newton, ACP Level 3
                Where is the value stored? Does it appear on the same line, as in...

                breadcrumb 5

                ...?

                If so, what characters are used to separate the text from the numbers. Are you aware of the "word" and "item" keywords for strings? And the value() function which converts a string expression to a value? Can you use these to retrieve the numerical value?
                • 5. Re: get line from a field
                  Lakerol Level 1
                  Thx openspark..

                  I was thinking to store the value in the same line as the word, but I don't know if this can work...
                  I'm experimenting with the "word" and "item" keywords..