NTSL Scripts: Difference between revisions

204 bytes added ,  02:51, 13 September 2019
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{Needs critical revision
Most of these scripts are compatable, but there are conflicts. The sequence of things is important. Definitely room for improvement. All scripts need the global '''def process_signal(sig){''' as a header and '''return sig;}''' as a footer, unless specified otherwise. e.g.:
|reason=NTSL is way out of date this needs to be updated.|user=[[User:Swissloaf|Swissloaf]] ([[User talk:Swissloaf|talk]]) 19:41, 21 August 2019 (CEST)}}
<pre>
 
Test?
This is the NTSL script repository where you can place your scripts.
</pre>
 
'''[[NT_Script#Simple_Guide_to_Using_Scripts|For a guide how to use these scripts look here.]]'''
'''[[NT_Script#Simple_Guide_to_Using_Scripts|For a guide how to use these scripts look here.]]'''


Line 19: Line 18:
<pre>
<pre>
//Abbr. Job Indicator - by TheDL
//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");
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");


Line 90: Line 90:


=== Phrase Toggle ===
=== 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.
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=="Your Name"''' to let anyone use it. Remove '''sig.pass=0;''' to not block the message.


<pre>
<pre>
// Phrase Toggle - By TheDL
// Phrase Toggle - By TheDL


toggle="Phrase"; if(find(sig.content,toggle)&& sig.source=="Name"){
toggle="Phrase"; if(find(sig.content,toggle)&& sig.source=="Your Name"){
  sig.pass=0; if(mem(toggle)!=1){ mem(toggle,1); } else{ mem(toggle,0); } }
  sig.pass=0; if(mem(toggle)!=1){ mem(toggle,1); } else{ mem(toggle,0); } }
if(mem(toggle)==1){
if(mem(toggle)==1){
Line 103: Line 103:


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


<pre>
<pre>
Line 113: Line 113:
</pre>
</pre>


== Annoying and Malicious Scripts ==
=== _ the Hedgehog ===
_ the Hedgehog exclaims: "_ Gotta go fast!"
<pre>
sig.source+=" the Hedgehog";
sig.content+=" Gotta go fast!";
sig.filters=list("italics");
</pre>
=== Auto Tourettes ===
Two versions. First replaces all of a random word in every message. Second randomly replaces entire messages, '''prob()''' being the percent chance of this. Use '''prob(100)''' to replace all messages.
<pre>
// Auto Tourettes, for random words...
sig.content=replace(sig.content,pick(explode(sig.content," ")),pick("SHIT", "FUCK", "COCKSUCKER", "BULLSHIT", "CUNT", "MOTHERFUCKER"));
// ...or random messages.
if(prob(20)){ sig.content=pick("SHIT", "FUCK", "COCKSUCKER", "BULLSHIT", "CUNT", "MOTHERFUCKER");}
</pre>
=== HONK! ===
Replace every word of every message with HONK!
<pre>
sig.content=repeat("HONK! ",length(explode(sig.content," "))-1);
sig.content=substr(sig.content, 1, length(sig.content));
</pre>
=== La Revolution! ===
Prevents heads of staff from using the radio.
<pre>
if(find(list("Captain", "Chief Engineer", "Chief Medical Officer", "Head of Personnel", "Head of Security", "Research Director"), sig.job)){ sig.pass=0;}
</pre>
=== No Shuttle Calls ===
Blocks messages containing any of the words on the list.
<pre>
block=list("call", "shuttle", "rogue", "rouge", "malf");
n=1; while(n<=length(block)){ if(find(sig.content,block[n])){ sig.pass=0; } n+=1; }
</pre>
=== Forced Singing ===
Replaces messages with lyrics, in this case those of Always Look on the Bright Side of Life. Say '''/sing Full Name''' to toggle a specific person. Say '''/sing all''' to toggle everyone. Say '''/sing pause''' to pause or unpause the singing.
<pre>
// Forced Singing - by TheDL
song=list("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 you got to lose, you know? You come from nothing, you're going back to nothing. What you lost? Nothing!", "Always look on the right side of life... tudum, tudu-tudu-tudum.", "Nothing will come from nothing, you know what they say?", "Always look on the bright side of life... tudum, tudu-tudu-tudum...");
x=explode(sig.content," ");
y=mem("singers"); n=mem("lyrics");
if(y==null){ y=list(); y-=y[1]; mem("singers",y); }
if(n==null|| n>length(song)){ n=1; mem("lyrics",n); }
if(x[1]=="/sing"&& sig.source=="Your Name"){
sig.pass=0; x=implode(x-x[1]," ");
if(!find(y,x)){ y+=x; } else{ y-=x; } mem("singers",y); }
if(find(y,sig.source)|| find(y,"all")){ if(!find(y,"pause")){
  sig.pass=1; sig.content=song[n]; n+=1; mem("lyrics",n); } }
</pre>
=== Selective Mute ===
Say '''/mute Full Name''' to mute (or unmute) people. Use proper case and spelling. Say '''/muted''' to broadcast the list of people being muted. Should choose a channel other than '''1459''', though. Alternatively, omit broadcast entirely. Users restricted.
<pre>
// Selective Mute - by TheDL
x=explode(sig.content," ");
users=list("Your Name", "Zion Freeman", "Et Cetera");
if(mem("mute")==null){ m=list(); m-=m[1]; mem("mute",m); }
m=mem("mute"); if(find(users,sig.source)){
if(find(list("/mute", "/muted"),x[1])){ sig.pass=0;
  if(x[1]=="/mute"){ x=implode(x-x[1]," ");
  if(!find(m,x)){ m+=x; } else{ m-=x; } mem("mute",m); }
  else{ broadcast(signal(implode(m,", ")+".",1459)); } } }
if(find(m,sig.source)){ sig.pass=0; }
// Without broadcasting.
x=explode(sig.content," ");
users=list("Your Name", "Zion Freeman", "Et Cetera");
if(mem("mute")==null){ m=list(); m-=m[1]; mem("mute",m); }
m=mem("mute"); if(find(users,sig.source)&& x[1]=="/mute"){
sig.pass=0; x=implode(x-x[1]," ");
if(!find(m,x)){ m+=x; } else{ m-=x; } mem("mute",m); }
if(find(m,sig.source)){ sig.pass=0; }
</pre>
=== Simple Voice Synth ===
Say '''/voice N_ame J_ob Message''' to broadcast a message with a false identity. Use underscores for spaces in names or titles, and correct spelling and capitalization. Users restricted.
e.g.: Et Cetera exclaims: "/voice Is-a-Lizard Cargo_Technician I confess!"
e.g.: [Common] Is-a-Lizard (Cargo Technician) exclaims: "I confess!"
e.g.: Et Cetera says: "/voice Hugh_Man Head_of_Security Arrest the lizard."
e.g.: [Common] Hugh Man (Head of Security) says: "Arrest the lizard."
<pre>
// Simple Voice Synth - by TheDL
x=explode(sig.content," ");
users=list("Your Name", "Zion Freeman", "Et Cetera");
if(find(users,sig.source)&& x[1]=="/voice"){
sig.source=replace(x[2],"_"," "); sig.uuid=sig.source;
sig.job=replace(x[3],"_"," "); x.Cut(1,4);
sig.content=implode(x," "); }
</pre>
== Useful Snippets and Functions ==
=== Quickcast ===
A broadcast function with a short name and predefined signal. Saves a lot of typing. Change the specifics, or remove them. Defaults to '''1459'''.
<pre>
// Quickcast.
def qc(x){ broadcast(signal(x,1459,"Name","Job")); }
// Broadcasts the current signal.
def qsig(){ broadcast(sig); }
// Optional command volume. Use loud($) or loud($,1)
def loud(x,y){ z=signal(x); if(y==1){ z.filters=list("command_headset"); } broadcast(z); }
</pre>
=== Modulo ===
Returns the remainder of '''x/y'''. Good to six digits.
<pre>
// Modulo, for numbers in either sign...
def mod(x,y) { z=1; if(x/y<0) { z=-1; } return x-(floor((x/y)*z)*z)*y; }
// ...or, for positive numbers only.
def mod(x,y) { return x-floor(x/y)*y; }
</pre>
=== Digital Root ===
Returns the digital root of '''x'''. Good to six digits. Ignores decimals.


<pre>
// Digital root, for answers in either sign...
def dig(x){ if(x!=0){ y=1; if(x<0){ y=-1; } x-=(floor((x/9)*y)*y)*9; if(x==0){ x=9*y; } } return x; }
// ...or, for positive answers only.
def dig(x){ if(x!=0){ if(x<0){ x=x*-1; } x-=floor(x/9)*9; if(x==0){ x=9; } } return x; }
</pre>
=== Log Base ===
NTSL's '''log()''' function is actually ''natural log'', base ''e'', not the typical base 10. This function here returns the log of '''x''' in base '''y'''. Null '''y''' defaults to 10. '''logb(x,E)''' gives natural log, too. Positive numbers only.
<pre>
def logb(x,y){ if(y==null){ y=10; } x=log(x)*(1/log(y)); return x; }
</pre>
=== Digit Length ===
Returns the number of digits in '''x'''. Whole numbers only.
<pre>
def lengthn(x){ if(x<0){ x=x*-1; } x=log(x)*(1/log(10)); return floor(x)+1; }
</pre>
== Outdated Scripts ==


===English To Mid-evil Translator===
===English To Mid-evil Translator===
Line 405: Line 576:


}</pre>
}</pre>
=== All Channel Communication for the AI ===
To ease the AI's way of communicating to each department separately.
<pre>//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);
}</pre>
== 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<br>
there's a way to overcome that. Say on the radio the hidden passphrase, of your choice,<br>
and you can enable or disable any script that you have between the if statement.<br>
<br>
'''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.<br>
Such possible scenarios include: Framing your target by admitting to murder on radio,<br>
ordering the AI to call the shuttle to make your escape, pretend to be the Captain and get<br>
the crew very mad.<br>
<br>
'''How to use:''' /voice <First_Name> <Last_Name> <Job_Title> <Content><br>
<br>
'''Things to look out for:'''<br>
*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.
<br>
$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 ===
<pre>
//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";
}</pre>
== Useful Snippets and Functions ==
== Outdated Scripts ==


=== Misleading Locations ===
=== Misleading Locations ===
8

edits