How many lines can there be? Endless? What should happen with text 1 when it got replaced by 11. Do you still need it or can it be deleted / overwritten?

I would suggest to do a for loop an used arrays. Although array functions are not supported.

Here is a suggestion. You need a function to fill your npc_text array. But if I understand it right, you have it already.


Code:
var npc_text[n][10]; // [n = ammount of string sets][0-10 lines => 1 to 10 shown + 0 for new] 

// Your text function should fill array like this
STRING* npc_text[n][0] = "text for 11th (=new) text"; // repace n!!!
STRING* npc_text[n][1] = "text for first text";
...


// check which string set is needed
var check_npc; // use this to check which npc is right clicked or use me
var npc_ypos; // set y Position of text elements

// Here you have to set new chat entry to npc_text[n][0]

function 

// check if there is a new entry in npc_text[n][0]


if(!str_cmp(npc_text[n][0],""))
{
   npc_text[n][0] = "New Text"
   // Switch all "old" text to number before.
   for(i=10;i<=1;i--)
   {
     npc_text[n][i] =  npc_text[n][i-1];
     str_npc_ypos = 300-i*15;
     digits(30,npc_ypos, "String%i: %s","Arial#14",1,npc_text[check_npc][i]);
   }
   // After that clear npc_text[n][0] for next entry check
   npc_text[n][0] = "";
}
else 
{
   // if there are less than 10 entries
   for(i=1;i<=10;i++)
   {
      str_ypos = 30+i*15;
      if(!str_cmp(npc_text[n][i],"")) digits(30,str_ypos, "String%i: %s","Arial#14",1,npc_text[check_npc][i]);
   }
}



Last edited by Ditje; 08/16/10 07:31.