Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
/VM/station wiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
NTSL Scripts
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===English To Pirate Translator=== 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 Pirate Translator Script - By Giacom // 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 / pirate word $words = vector("gun", "cannon", "heaven", "davy jones' locker", "I", "aye", "my", "meh", "yes", "aye", "are", "argh", "yeah", "yarh", "captain", "Cap'n", "hos", "First Mate", "hop", "Crewmaster", "ai", "Navigator", "money", "treasure", "friend", "matey", "station", "vessel", "shuttle", "rowboat", "engine", "sails", "space", "sea"); //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>
Summary:
Please note that all contributions to /VM/station wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
/VM/station wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width