NTSL Scripts: Difference between revisions

Jump to navigation Jump to search
2,869 bytes added ,  02:36, 11 December 2014
→‎Useful Non-Malicious Scripts: Added mid-evil script
imported>Kosmos
m (Small fixes.)
imported>Hellafied
(→‎Useful Non-Malicious Scripts: Added mid-evil script)
Line 152: Line 152:
broadcast(pick("When I went to the French poultry farm, it was a mess! The poulet everywhere.", "History’s most agreeable tyrant: William the Concurrer.", "What’s a real estate lawyer’s least favourite  song? “Lien On Me“.", "Do all houses come with decks? Un porch innately not.", "My dog was banned from the oil sands, because he bitumeny people."), 1459, "Automated Pun Teller", "Horrible Jokes Ahoy");
broadcast(pick("When I went to the French poultry farm, it was a mess! The poulet everywhere.", "History’s most agreeable tyrant: William the Concurrer.", "What’s a real estate lawyer’s least favourite  song? “Lien On Me“.", "Do all houses come with decks? Un porch innately not.", "My dog was banned from the oil sands, because he bitumeny people."), 1459, "Automated Pun Teller", "Horrible Jokes Ahoy");
}</pre>
}</pre>
===English To Mid-evil Translator===
// English To Mid-evil Translator Script - By Hellafed
This script initializes a list of words by using the mem() function as a hash table. By doing this it has to initialize first, if you are running this script and then add words later, you must clear the memory of the server first so it initializes again and learns the new words.
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.
<pre>// English To Mid-evil Translator Script - By Hellafed
// Helper Functions
def implode($vector, $adder)
{
$returnString = "";
$index = 1;
while($index <= length($vector))
{
$at = at($vector, $index);
$toAdd = $adder;
if($index == 1)
{
$toAdd = "";
}
$returnString = $returnString + $toAdd + $at;
$index += 1;
}
return $returnString;
}
def Initialize()
{
// Our words! Format: real word / midevil word
$words = vector("gun", "cannon",
"my", "my own",
"security", "town watch",
"are", "art",
"yeah", "aye",
"captain", "King",
"hos", "Town Watch Commander",
"ce", "Head Builder",
"dead", "gone to Sovngarde",
          "rd", "Lead Scientist",
"assistant", "peasant",
"Borg", "dwarven automaton",
"Borgs", "dwarven automatons",
"cyborg", "dwarven automaton",
"cyborgs", "dwarven automatons",
"fucker", "milk drinker",
"syndicate", "dragons",
"brig", "dungeon",
"yours", "thine",
"you", "thou",
"do", "dost",
"has", "hath",
"nothing", "naught",
"thanks", "Grammarcy",
"hop", "inn Manager",
"ai", "King's Servent",
"money", "gold coins",
"friend", "brother",
"station", "town",
"shuttle", "Evacuation Wagon",
"engine", "waterwheel",
"space", "unknown");
//broadcast("Starting Initialization...");
$index = 1;
while($index <= length($words))
{
$key = at($words, $index);
$key = lower($key);
$value = at($words, $index+1);
mem($key, $value);
$index += 2;
}
//broadcast("Initialization Complete!");
}
// Script Begin
if(mem("initialized") != 1)
{
Initialize();
mem("initialized", 1);
}
$newContent = explode($content, " ");
$index = 1;
while($index <= length($newContent))
{
$entry = at($newContent, $index);
$value = mem(lower($entry));
if($value)
{
at($newContent, $index, $value);
}
$index += 1;
}
$content = implode($newContent, " ");
// Script End</pre>


===English To Pirate Translator===
===English To Pirate Translator===
Anonymous user

Navigation menu