Gui , Message , Text, Touch and Question ?

PS- Sorry for the title of the question.
So, i am trying to make a message box seen in rpgs and visual novels , i am working on Android platform and i have this script:

alt text

so what problem is , when i touch the gui on the screen , it skips the line “man,.” and everything that would come in between to the last one that is “i am getting late for the battle” So anyone got something i can do ? Thanx

Why not use an array, then cycle trough your lines when the touchCont is touched?

Edit : ok, here's an exemple (just to let you know i code in C# usually so the code might not be right but the algorythm is) :

var touchCont : GUITexture;
var line1 : GUIText;
var line2 : GUIText;
var line3 : GUIText;
var lines = new Array;
lines[0] = "man...";
lines[1] = "i am going to be late for the
battle";
var line : int = 0;

function FixdUpdate()
{
    for (var touch : Touch in Input.touches)
    {
      if (touchCont.HitTest(touch.position))
           line++;
    }
    AssignLine();
}

function AssignLine()
{
  var linetab = lines[line].split("
");
  for (var i = 0; i < linetab.length; i++)
   {
    if (i == 0)
     line1 = linetab*;*
 *if (i == 1)*
 _line2 = linetab*;*_
 _*if (i == 2)*_
 <em>_line3 = linetab*;*_</em>
 <em>_*}*_</em>
<em>_*}*_</em>
<em>_*```*_</em>
<em>_*<p>Didn't write it properly, but the the idea is there :*_</em>
<em>_*Use an array to put all your sentences in, then cycle trough the array on each touch. Use another function to split the sentences into the lines as you see fit.</p>*_</em>
<em>_*<p>Edit : Below is the C# version of the code (JS and C# don't mix well in Unity so you better stick to only one of those) :</p>*_</em>
<em>_*```*_</em>
<em>_*using UnityEngine;*_</em>
<em>_*using System;*_</em>
<em>_*using System.Collections;*_</em>
<em>_*using System.Collections.Generic;*_</em>
<em>_*public class LineManager : MonoBehaviour //Symbolic name, change to whatever you want*_</em>
<em>_*{*_</em>
 <em>_*//The texture to touch and change the lines*_</em>
 <em>_*public GUITexture touchCont;*_</em>
 <em>_*//The array containing the line to show*_</em>
 <em>_*private GUIText[] shownLines = new GUIText[3];*_</em>
 <em>_*//The array containing the lines to cycle trough*_</em>
 <em>_*private string[] charLines = new string[] { "man...", "i am going to be late for the
battle", "some other line"};*_</em>
 <em>_*//The current line number*_</em>
 <em>_*private int currentLine = 0;*_</em>
 <em>_*void FixedUpdate()*_</em>
 <em>_*{*_</em>
 <em>_*//Check for each touch if it's on the button(?), and launch the line showing if it is*_</em>
 <em>_*foreach (var item in Input.touches)*_</em>
 <em>_*{*_</em>
 <em>_*if (touchCont.HitTest(item.position))*_</em>
 <em>_*FillLine();*_</em>
 <em>_*}*_</em>
 <em>_*}*_</em>
 <em>_*void FillLine()*_</em>
 <em>_*{*_</em>
 <em>_*//Split the sentence in lines if there is more than 1 line*_</em>
 <em>_*var tmp = charLines[currentLine].Split(new char[] { '
' });*_</em>
 <em>_*//A safety check*_</em>
 <em>_*if (tmp != null)*_</em>
 <em>_*//Go from first to last line and put in the array to show on screen*_</em>
 <em>_*for (int i = 0; i < tmp.Length; i++)*_</em>
 <em>_*{*_</em>
 <em><em><em>shownLines_.text = tmp*;*_</em></em></em>
 <em><em><em>_*}*_</em></em></em>
 <em><em><em>_*//If the next line number is inferior to the max lines number we go to the next, othewise go to the begining*_</em></em></em>
 <em><em><em>_*if (currentLine == (charLines.Length - 1))*_</em></em></em>
 <em><em><em>_*currentLine++;*_</em></em></em>
 <em><em><em>_*else*_</em></em></em>
 <em><em><em>_*currentLine = 0;*_</em></em></em>
 <em><em><em>_*}*_</em></em></em>
<em><em><em>_*}*_</em></em></em>
<em><em><em>_*```*_</em></em></em>

You’re overwriting the text later on. You have two for loops, both identical, and two if statements, both identical, so when one is true the other will be true. You assign to line1.text, and then assign again to line1.text immediately afterward. Did you mean to do the following?

line1.text = “man,.”;

line2.text = “i am going late for the”;
line3.text = “battle”;