NTSL Scripts: Difference between revisions

Jump to navigation Jump to search
54 bytes added ,  20:36, 6 August 2013
imported>Giacom
imported>Giacom
Line 269: Line 269:


After initialization, this transmission and the rest all skip to splitting the transmission's contents and check each word against the memory, using the word as a key. Because of not needing to loop through the list of words, this is a fast process. If it finds a valid word to replace, it will replace the word with the value that the key led to. Finally, after it is finished it will convert the vector into a string again and then replace the contents of the transmission with the final message.
After initialization, this transmission and the rest all skip to splitting the transmission's contents and check each word against the memory, using the word as a key. Because of not needing to loop through the list of words, this is a fast process. If it finds a valid word to replace, it will replace the word with the value that the key led to. Finally, after it is finished it will convert the vector into a string again and then replace the contents of the transmission with the final message.
 
  // English To Pirate Translator Script - By Giacom
  // English To Pirate Translator Script - By Giacom
   
   
Line 320: Line 320:
   while($index <= length($words))
   while($index <= length($words))
  {
  {
  mem(lower(at($words, $index)), at($words, $index+1));
  $key = at($words, $index);
$key = lower($key);
$value = at($words, $index+1);
mem($key, $value);
  $index += 2;
  $index += 2;
  }
  }
Line 329: Line 332:
   
   
  if(mem("initialized") != 1)
  if(mem("initialized") != 1)
  {
  {  
  Initialize();
  Initialize();
  mem("initialized", 1);
  mem("initialized", 1);
Anonymous user

Navigation menu