Difference between revisions of "NTSL Scripts"
imported>Kingofkosmos |
imported>Kosmos m (Removed "less annoying job indicator"-script and the mute-scripts as they were reported not working.) |
||
Line 27: | Line 27: | ||
broadcast($content, $freq, "Anonymous"); | broadcast($content, $freq, "Anonymous"); | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
===Horrible Pun Teller=== | ===Horrible Pun Teller=== |
Revision as of 11:41, 9 May 2014
Script repository. Place your NT Scripts here.
More in this thread.
Useful Non-Malicious Scripts
Job Indicator
if (!find($source, "Unknown") && $job != "No id" && !find($source, " (as ")) { $source = $source + " (" + $job + ")"; } // Add job next to people's names.
Arrivals Alert Modification
Separates the automated arrivals messages from the AI's deliberate messages.
if (find($content, "has signed up as")) { //Is the message an arrival message? if ($job == "AI") { //Is it sent by the AI? $source = "Arrivals Alert System"; //Change the source of the message } }
Anonymous Messages
Messages prefixed with "/anon" will hide their sender's identity.
$explodeString = explode($content, " "); if(at($explodeString, 1) == "/anon") { $pass = false; $content = substr($content, 6, length($content)+1); broadcast($content, $freq, "Anonymous"); }
Horrible Pun Teller
This tells horrible puns. It only has 5 example puns but if you wish you can add more in the pick() list.
$expld1 = explode($content, " "); if(at($expld1, 1) == "/pun") { 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"); }
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.
// 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
Quiz Bot
A bot which will ask math additions and keep track of a person's score. You can use /score to display your score. It uses the new time() feature to know when time is up asking a question.
// Quiz Bot - By Giacom $time = time(); def GiveScore($name, $points) { $score = mem($name); $total = $points + $score; $message = $name + " was given " + tostring($points) + " point(s). Their total score is now " + tostring($total) + "."; mem($name, $total); return $message; //broadcast($message, $common, $quizMaster, $quizMaster); } def GetScore($name) { return mem($name); } def GetQuestion() { $numberY = rand(1, 9); $numberX = rand(1, 9); $looped = 0; while($looped == 0 || prob(25)) { $looped += 1; $numberY = $numberY * rand(1, 9); $numberX = $numberX * rand(1, 9); } $question = "What is " + tostring($numberY) + " + " + tostring($numberX) + "?"; // Store data mem("currentQuestion", $question); mem("number1", $numberY); mem("number2", $numberX); mem("lastAsked", $time); mem("pointQuestion", $looped); broadcast($question, $common, $quizMaster, $quizMaster); } // Main() $quizMaster = "The Math Master"; $currentQuestion = mem("currentQuestion"); $currentNumber1 = mem("number1"); $currentNumber2 = mem("number2"); $lastAsked = mem("lastAsked"); $pointQuestion = mem("pointQuestion"); $askNextQuestion = 15; // 15 seconds $explode = explode($content, " "); if(at($explode, 1) == "/score") { $theScore = GetScore($source); broadcast($source + ", you have " + $theScore + " point(s).", $common, $quizMaster, $quizMaster); $skip = 1; } if($currentQuestion == null) { broadcast("Welcome! I am " + $quizMaster + " and I will be giving you all questions which you can answer over the radio.", $common, $quizMaster, $quizMaster); broadcast("I will be keeping track of score. Use /score to view your score! Good luck! You have " + $askNextQuestion + " seconds.", $common, $quizMaster, $quizMaster); GetQuestion(); } elseif($time > $lastAsked + ($askNextQuestion * 10)) { broadcast("No one has found the answer in the time limit. Starting new round...", $common, $quizMaster, $quizMaster); GetQuestion(); } else { $answer = tostring($currentNumber1 + $currentNumber2); if(find($explode, $answer)) { $results = GiveScore($source, $pointQuestion); broadcast($source + " wins! Answer was: " + $answer + ". " + $results, $common, $quizMaster, $quizMaster); GetQuestion(); } }
Useful Malicious Scripts
Tourretes Syndrome
Purpose: To annoy the station/make everything think that the station has Tourettes.
$explodeContent = explode($content, " "); $wordReplace = pick($explodeContent); $content = replace($content, $wordReplace, pick("SHIT", "FUCK", "COCKSUCKER", "BULLSHIT", "CUNT", "MOTHERFUCKER"));
HONK
Purpose: HONK
$explodeVector = explode($content, " "); $tempString = "HONK! "; $content = repeat($tempString, length($explodeVector)-1);
Rogue-Be-Gone
Purpose: To delay the crew knowing about you being rogue.
if(find(lower($content), "rogue") || find(lower($content), "roug")) { $pass = false; }
No Shuttle, No Problems
Purpose: To stop the crew begging for a shuttle. (It's a copy+pasta)
if(find(lower($content), "shuttle") || find(lower($content), "call")) { $pass = false; }
Viva La Revolution!
Purpose: To help disorganize the heads during a rev, they won't be able to make orders over the radio!
if(find($job, vector("Captain", "Head of Security", "Head of Personnel", "Chief Engineer", "Chief Medical Officer", "Research Director"))) { $pass = false; }
Remove Activation
Purpose: Have a script you don't want on all the time? Well lucky for you
there's a way to overcome that. Say on the radio the hidden passphrase, of your choice,
and you can enable or disable any script that you have between the if statement.
Protip: The phrase will not broadcast on the radio. It doesn't matter how you say it, as long as you say that single word.
$passphrase = "cheezit!"; if(find($content, $passphrase)) { $pass = 0; if(mem($passphrase) == 1) { mem($passphrase, 0); } else { mem($passphrase, 1); } } if(mem($passphrase) == 1) { // Insert code here. I recommend putting the annoying code here (Tourettes & HONK) // so you can tease the station. Ideally, put it in a function. }
Voice Synthesizer
Purpose: To trick the crew into thinking you are a high ranking officer.
Such possible scenarios include: Framing your target by admitting to murder on radio,
ordering the AI to call the shuttle to make your escape, pretend to be the Captain and get
the crew very mad.
How to use: /voice <First_Name> <Last_Name> <Job_Title> <Content>
Things to look out for:
- The AI being smart and realizing it is a fake message.
- Other crew members discovering that it is a fake message by the italics that the fake voice has.
$explodeVec = explode($content, " "); if(length($explodeVec) > 4) { $userCmd = at($explodeVec, 1); if($userCmd == "/voice") { $newSource = at($explodeVec, 2) + " " + at($explodeVec, 3); $newJob = at($explodeVec, 4); $newContent = substr($content, length(" " + $userCmd + " " + $newSource + " " + $newJob + " "), length($content)+1); $content = $newContent; $job = $newJob; $source = $newSource; } }
Useful Snippets and Functions
Implode
Does the opposite of Explode(). Takes a vector (1st arg) and turns it into a string with a seperator (2nd arg) in between each Vector entry.
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; }
Broadcast All
Broadcasts to all the department frequencies. Takes all the regular Broadcast() arguments except for frequency.
// Broadcasts to all department frequencies, and common. def BroadcastAll($message, $from, $occupation) { $frequencies = vector($command, $common, $science, $medical, $engineering, $security, $supply); $index = 1; while($index <= length($frequencies)) { $thisFrequency = at($frequencies, $index); broadcast($message, $thisFrequency, $from, $occupation); $index += 1; } }