NTSL Scripts

Revision as of 02:20, 13 September 2019 by TheDL (talk | contribs)
Ntflagfire.gif This page is in need of critical revision!

The following page may be not in use or majorly out of date. If the page's guide needs revision, see here for an example.
The revision reason is: "NTSL is way out of date this needs to be updated."
Marked by: "Swissloaf (talk) 19:41, 21 August 2019 (CEST)"



This is the NTSL script repository where you can place your scripts.

For a guide how to use these scripts look here.

Useful Scripts

Job Indicator

Jobs will appear in brackets after names.

sig.source+=" ("+sig.job+")";

Abbr. Job Indicator

Gives abbreviations instead of full titles.

//Abbr. Job Indicator - by TheDL
jobs=list("Admiral", "Adm", "Assistant", "Ass", "Atmospheric Technician", "Atmo", "Bartender", "Bar", "Botanist", "Hydr", "Captain", "Cap", "Cargo Technician", "Carg", "Chaplain", "Chap", "Chemist", "Chem", "Chief Engineer", "CE", "Chief Medical Officer", "CMO", "Clerk", "Clrk", "Clown", "Clwn", "Curator", "Cura", "Detective", "Det", "Geneticist", "Gene", "Head of Personnel", "HoP", "Head of Security", "HoS", "Janitor", "Jani", "Lawyer", "Law", "Librarian", "Lib", "Medical Doctor", "MD", "Mining Medic", "Medi", "Paramedic", "Para", "Psychiatrist", "Psyc", "Quartermaster", "QM", "Research Director", "RD", "Roboticist", "Robo", "Scientist", "Sci", "Security Officer", "Sec", "Shaft Miner", "Mine", "Signal Technician", "Sig", "Station Engineer", "Engi", "Tourist", "Tour", "Unassigned", "Unas", "Unknown", "Unkn", "Virologist", "Viro", "Warden", "Ward", "Personal AI", "pAI", "Default Cyborg", "DefB", "Engineering Cyborg", "EngB", "Janitor Cyborg", "JanB", "Medical Cyborg", "MedB", "Miner Cyborg", "MnrB", "Peacekeeper Cyborg", "PceB", "Security Cyborg", "SecB", "Service Cyborg", "SrvB", "Standard Cyborg", "StnB");

if(find(jobs,sig.job)){ sig.job=jobs[find(jobs,sig.job)+1]; }
sig.source+="["+sig.job+"]";

Spam Jammer

Blocks hulkouts and tourettes ticks.

if(find(list("RAAAAAAAARGH!!!", "HNNNNNNNNNGGGGGGH!!!",
 "GWAAAAAAAARRRHHH!!!", "NNNNNNNNGGGGGGGGHH!!!",
 "AAAAAAARRRGH!!!", "CUNT", "FUCK", "PISS", "SHIT", "TITS",
 "COCKSUCKER", "MOTHERFUCKER"), sig.content)){ sig.pass=0;}


Anonymous Messages

Messages starting with /anon will broadcast under the name "Anonymous".

// Anonymous Messages - by TheDL

x=explode(sig.content," ");
if(x[1]=="/anon"){ sig.pass=0;
 broadcast(signal(implode(x-x[1]," "), sig.freq, "Anonymous")); }

// This one preserves language...

x=explode(sig.content," ");
if(x[1]=="/anon"){ sig.pass=0;
 anon=signal(implode(x-x[1]," "), sig.freq, "Anonymous");
 anon.language=sig.language; broadcast(anon); }

// ...this one randomizes filters, too.

x=explode(sig.content," ");
if(x[1]=="/anon"){ sig.pass=0; a=list("italics", "robot", "sans", "yell");
 anon=signal(implode(x-x[1]," "), sig.freq, "Anonymous");
 n=1; while(n<length(a)){ if(prob(50)){ anon.filters+=a[n]; } n+=1; }
 anon.language=sig.language; broadcast(anon); }

Broadcast to All

Messages starting with /all will be broadcasted to all departments, and common. Admins hate this, though. Expect to get bwoinked.

// Broadcast to All - by TheDL

x=explode(sig.content," ");
freqs=list( 1459, 1447, 1359, 1357, 1355, 1353, 1351, 1349, 1347);
if(x[1]=="/all"){ sig.pass=0; sig.content=implode(x-x[1]," "); n=1;
 while(n<=length(freqs)){ sig.freq=freqs[n]; broadcast(sig); n+=1; } }

Broadcast to Any or All

Messages starting with a channel code will be broadcast to the corresponding department. The channel codes are /c for command, /e for engineering, /m for medical, /n for science, /o for AI private, /s for security, /u for supply, and /v for service. As above, messages starting with /all will be broadcasted to all departments, and common. Again, admins hate this. Expect to get bwoinked.

// Broadcast to Any or All - by TheDL

x=explode(sig.content," ");
freqs=list( 1459, 1447, 1359, 1357, 1355, 1353, 1351, 1349, 1347);
codes=list( "/all", "/o", "/s", "/e", "/m", "/c", "/n", "/v", "/u");
if(find(codes,x[1])){ n=find(codes,x[1]); sig.content=implode(x-x[1]," ");
 if(codes[n]!="/all"){ sig.freq=freqs[n]; } else{ sig.pass=0; n=1;
  while(n<=length(freqs)){ sig.freq=freqs[n]; broadcast(sig); n+=1; } } }


Phrase Toggle

Enable or disable a script using a phrase. Any phrase can be used. Add the script to be toggled where indicated. User restricted, message blocked. Remove &&sig.source=="Name" to let anyone use it. Remove sig.pass=0; to not block the message.

// Phrase Toggle - By TheDL

toggle="Phrase"; if(find(sig.content,toggle)&& sig.source=="Name"){
 sig.pass=0; if(mem(toggle)!=1){ mem(toggle,1); } else{ mem(toggle,0); } }
if(mem(toggle)==1){
// Insert script here.
}

Pun Pun Teller

Say /pun to have the Ghost of Pun Pun tell an awful pun!

//Pun-Pun Teller - by TheDL

exp=explode(sig.content," ");
if(exp[1]=="/pun"){ sig.pass=0;
broadcast(signal(pick("Did you hear about the guy that got cut in half? Don't worry, he's all right now.", "I started a business selling landmines disguised as prayer mats. Prophets are going through the roof!", "Why don't thieves get puns? Because they take things literally.", "My dog has no nose. How does he smell? Awful.", "A man entered ten puns in a pun contest, hoping that one would win. Unfortunately, no pun in ten did."),sig.freq,"The Ghost of Pun Pun"));}


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. (Credit to Giacom for providing the code i used to create this)

// 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 / mid evil 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 Servant",
					"money", "gold coins",
					"friend", "brother",
					"station", "town",
					"shuttle", "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

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();
	}

}


All Channel Communication for the AI

To ease the AI's way of communicating to each department separately.

//Usage: Set private to speaker/mic, set public to speaker only, use "sBlah" for sec etc, upload everywhere
if (mem("init") != 1) {
   $freqs = vector("1359", "s", "1357", "e", "1355", "m", "1353", "c", "1351", "n", "1347", "u", "1349", "v");
   $index = 1;
   while ($index <= length($freqs)) {
      $tfreq = at($freqs, $index);
      $tid = at($freqs, $index + 1);
      mem($tfreq, $tid);
      mem($tid, $tfreq);
      $index += 2;
   }
   mem("init", 1);
}
$clen = length($content) + 1;
$first = substr($content, 1, 2);
$rest = substr($content, 2, $clen);
$freqs = tostring($freq);
if ($freq == 1447 && $job == "AI" && mem($first)) {
   $tfreq = mem($first);
   broadcast($rest, $tfreq, $source, $job);
} elseif ($freq == 1447 && $job == "AI") {
   broadcast($content, 1459, $source, $job);
} elseif (mem($freqs)) {
   $tid = mem($freqs);
   broadcast("["+$tid+"]"+$content, 1447, $source, $job);
}

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;

	}
}

Choreographed Always Look on the Bright Side of Life

//to bring some joy to a station in dire need just say "/happy all" over general radio
//to bring joy to a single person one just needs to say "/happy [insert downer]"
//remember to fill the authority slot with your name 
//and as always capitalisation is important

$authority ="[insert name here]";

$Bright = vector("Some things in life are bad,They can really make you mad","Other things just make you swear and curse.","When you're chewing on life's gristle ","Don't grumble, give a whistle","And this'll help things turn out for the best...","And... always look on the bright side of life... tudum tudu-tudu-tudum","Always look on the light side of life... tudum tudu-tudu-tudum","If life seems jolly rotten","There's something you've forgotten","And that's to laugh and smile and dance and sing.","When you're feeling in the dumps","Don't be silly, chumps!","Just purse your lips and whistle - that's the thing.","And... always look on the bright side of life... tudum tudu-tudu-tudum","Always look on the light side of life... tudum tudu-tudu-tudum","For life is quite absurd","And death's the final word","You must always face the curtain with a bow.","Forget about your sin - give the audience a grin","Enjoy it - it's your last chance anyhow.","So always look on the bright side of death tudum tudu-tudu-tudum","Just before you draw your terminal breath tudum tudu-tudu-tudum","Life's a piece of shit","When you look at it","Life's a laugh and death's a joke, it's true.","You'll see it's all a show","Keep 'em laughing as you go","Just remember that the last laugh is on you.","And always look on the bright side of life... tudum tudu-tudu-tudum","Always look on the right side of life... tudum tudu-tudu-tudum","Come on guys, cheer up!","Always look on the bright side of life... tudum tudu-tudu-tudum","Always look on the bright side of life... tudum tudu-tudu-tudum","Worse things happen at sea, you know.","Always look on the bright side of life... tudum tudu-tudu-tudum","I mean - what have you got to lose?","You know, you come from nothing - you're going back to nothing.What have you lost? Nothing!","Always look on the right side of life... tudum tudu-tudu-tudum");

def implode($vector)

{
        $str = at($vector, 1);
        remove($vector, $str);
        if(length($vector) > 0) 
        {
                $str += " ";
                $str += implode($vector);
        }
        return $str;
}
if (mem("Happy") == mem("invalid"))
{
        mem("Happy","0");
}
if($source == $authority)
{
        if(at(explode($content, " "), 1) == "/happy")
        {
                $vec = explode($content, " ");
                remove($vec, "/happy");
                $name = implode($vec);          
                $pass = 0;
                mem($name,$name);
        }
        if(at(explode($content, " "),1) == "/unhappy")
        {
                $pass = 0;
                $vec = explode($content, " ");
                remove($vec, "/unhappy");
                $temp = implode($vec);
                mem($temp, 0);
        }       
}
if ("all" == mem("all"))
{
        $temp = mem("Happy");
        $count = tonum($temp);
        $content = at($Bright,$count);
        $count = $count +1;
        $temp2 = length($Bright);
        if ($count > $temp2)
        {
                $count = 1;
        } 
        $temp3 = tostring($count);
        mem("Happy",$temp3); 
}
if($source == mem($source))
{
        $output = implode($Bright);
        $content = $output;
}
if ($pass == 0 && $job =="AI")
{
        $pass = 1;
        $content = "beep";
}


Useful Snippets and Functions

Outdated Scripts

Misleading Locations

Copy and paste this into the def Initialize() block in the English to Pirate -translator. You can also change words within the "" to suit any other needs like making "blood rune" to "retard". Be sure to go into other comm channels, copy/paste and set active for maximum evil laughter.

$words = vector("scripts", "clown", "storage", "brig",
"maintenance", "bar", "main", "escape", "sec", "medbay",
"brig", "arrivals", "cargo", "engineering", "science", "security",
"bar", "vacant", "chapel", "bridge", "dorms", "locker room",
"office", "donuts", "upload", "ass", "solars", "escape",
"core", "heart", "engineering", "botany", "locker room", "science");