Advertisement
silvaplex512

OpenGarlandOS

Mar 13th, 2018
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //                   __                 __   _______ _______
  2. //.-----.---.-.----.|  |.---.-.-----.--|  | |       |     __|
  3. //|  _  |  _  |   _||  ||  _  |     |  _  |=|   -   |__     |
  4. //|___  |___._|__|  |__||___._|__|__|_____| |_______|_______|
  5. //|_____| - - - - - - authored by silvaplex512  (Syd Garland)
  6. //O//P//E//N/////S//O//U//R//C//E/////E//D//I//T//I//O//N//
  7.  
  8. // SCRIPT INITIALISATION
  9.  
  10. // a lot of these variables are very messy and inconsistent
  11. // most of them were jury-rigged just to get it to compile
  12.  
  13. $explodeVec = explode($content, " ");
  14. $arg1 = at($explodeVec, 1); // $args 1-5 are the first 5 words of the message
  15. $arg2 = at($explodeVec, 2);
  16. $arg3 = at($explodeVec, 3);
  17. $arg4 = at($explodeVec, 4);
  18. $arg5 = at($explodeVec, 5);
  19. $time = timestamp("hh:mm:ss");
  20. $versionno = "1.0.0"; // version number - usually I set this to date of last edit
  21. $joblow = lower($job); // old wiki variable that never got removed
  22. $out = ""; // former wiki variable used for new job names
  23. $crewlist = vector(); // I stripped most database functionality from OGOS, this is mostly useless
  24. $clist = 0;
  25. $flag = 0; // flags whether a command has been properly parsed, private commands have higher value flags
  26. $inc = 0; // jury-rigged database variable
  27. $admin = "admin";
  28. $aname = "aname";
  29. $locats = pick("sci", "sci maint", "telesci", "engineering", "arrivals", "cargo", "the library", "HoP office", "QM office", "mining"); // could use optimisation
  30. $n1 = "";
  31. $mflag = false;
  32. $meme = 0;
  33. mem(1337,"CentComm"); mem(1347,"Supply"); mem(1349,"Service"); mem(1351,"Science"); mem(1353,"Command"); mem(1355,"Medical"); mem(1357,"Engineering"); mem(1359,"Security"); mem(1447,"AI Private"); mem(1459,"Common");
  34.  
  35. // debug broadcast function. Broadcasts to debug channel.
  36.  
  37. def dbroadcast($dcontent)
  38. {
  39.   broadcast($dcontent, 1457, "OGOS", "Announcer");
  40. }
  41.  
  42.  
  43. // frequency broadcast function. Broadcasts to current frequency.
  44.  
  45. def fbroadcast($fcontent)
  46. {
  47.   broadcast($fcontent, $freq, "OGOS", "Announcer");
  48. }
  49.  
  50.  
  51. // meme name changes go here
  52.  
  53. if($source == "Ian Hitchkoff")
  54. {
  55.   $source = "Ian Bitchkoff";
  56.   $mflag = true;
  57. }
  58.  
  59. if($source == "Ana Bow")
  60. {
  61.   $source = "Bow Ana Arrow";
  62.   $mflag = true;
  63. }
  64.  
  65. if($source == "Ana Bourgone")
  66. {
  67.   $source = "Ana Borg-Gone";
  68.   $mflag = true;
  69. }
  70.  
  71. if($source == "Lily Shots")
  72. {
  73.   $source = "Lily Shits";
  74.   $mflag = true;
  75. }
  76.  
  77. if(find($source, "Automated Announcement")) // not really a meme name, but same code
  78. {
  79.   $source = "AAS";
  80.   $mflag = true;
  81. }
  82.  
  83.  
  84. // increment message to crew database
  85. // /stats is the only database function
  86. // in this version of the script
  87.  
  88. if(mem($source))
  89. {
  90.   $inc = mem($source) + 1;
  91. }
  92. else
  93. {
  94.   $inc = 1;
  95.   dbroadcast($source + " has transmitted for the first time on channel " + $freq + ". Creating new database entry.");
  96.   if(mem("database"))
  97.   {
  98.     $dtb = vector(mem("database"));
  99.     $dtb = $dtb + $source;
  100.     mem("database", $dtb);
  101.   }
  102.   else
  103.   {
  104.     $dtb = vector($source);
  105.     mem("database", $dtb);
  106.   }
  107. }
  108.  
  109. mem($source, $inc);
  110.  
  111.  
  112. // font handling
  113.  
  114. if(find($joblow, "clown")) // clowns get a stupid font
  115. {
  116.   $filters = vector($wacky);
  117. }
  118.  
  119. if(find($joblow, "mime")) // mimes don't speak
  120. {
  121.   $content = "HEY EVERYBODY I BROKE MY VOW, LYNCH ME";
  122.   $filters = vector($loud, $commanding, $wacky);
  123. }
  124.  
  125. // channel leak detection
  126.  
  127. if(lower($arg1) == "h" || lower($arg1) == ".h" || lower($arg1) == "c" || lower($arg1) == ".c" || lower($arg1) == "s" || lower($arg1) == ".s" || lower($arg1) == "u" || lower($arg1) == ".u" || lower($arg1) == "n" || lower($arg1) == ".n")
  128. {
  129.   if($freq != 1459 && $freq != 1359) // user managed to say something like ":s:hwhat's going on"
  130.   {
  131.     fbroadcast("User used multiple department keywords in the message. Please consult your headset reference label for proper channel keyword usage.");
  132.   }
  133.   else
  134.   {
  135.     dbroadcast("NOTE: " + $source + " nearly leaked: " + $content + " over frequency: " + $freq);
  136.     $content = "[leaked department chatter removed]";
  137.   }
  138. }
  139.  
  140. // check to see if script was initialized already
  141. // if not, display bootup message and version #
  142.  
  143. if(!mem("boot")) // this part was copied word-for-word from the wiki and gradually improved over time
  144. {
  145.   fbroadcast("Initializing OpenGarlandOS, version " + $versionno + " for channel " + $freq + ".");
  146.   mem("boot",TRUE);
  147.   $words = vector("assistant","Asst.","captain","Capt","head of personnel","HoP","bartender","Bar","botanist","Botany","quartermaster","QM","cargo technician","C-Tech","shaft miner","Miner","chaplain","chief engineer","CE","station engineer","Engineer","atmospheric technician","A-Tech","chief medical officer","CMO","medical doctor","MD","chemist","Chem","geneticist","Genetics","virologist","Viro","research director","RD","scientist","Sci","roboticist","Robo","head of security","HoS","detective","Det","security officer","Officer","security cyborg","Secborg","medical cyborg","Mediborg","engineering cyborg","Engiborg","peacekeeper cyborg","Cookie Dispenser","janitor cyborg","Janiborg","clown cyborg","ClownBorg","personal ai","pAI","signal technician","Admin");
  148.   $index = 1;
  149.   while($index <= length($words))
  150.   {
  151.     $key = at($words, $index);
  152.     $value = at($words, $index+1);
  153.     mem($key,$value);
  154.     $index += 2;
  155.   }
  156. }
  157.  
  158.  
  159. // hide all messages with a command in them
  160.  
  161. if(find($arg1, "/"))
  162. {
  163.   $pass = false;
  164. }
  165.  
  166.  
  167. // reset the authentication script
  168. // this generates a new passphrase and wildcards $aname
  169. // so that you can get back in if you were locked out
  170.  
  171. if($arg1 == "/reset")
  172. {
  173.   mem($admin, "");
  174.   mem("password", 0);
  175.   dbroadcast("ALERT: " + $source + " has reset the authentication script for frequency " + $freq + ". Anyone may now become administrator.");
  176.   mem($aname, "#");
  177.   $flag = 2;
  178. }
  179.  
  180.  
  181. // pick a channel passphrase
  182.  
  183. $phrasep = "phrasep"; // TODO: needs optimisation
  184.  
  185. if(!mem("password"))
  186. {
  187.   $pphrase = tostring(rand(100));
  188.   dbroadcast("Channel passphrase for " + $freq + ": " + $pphrase);
  189.   mem($phrasep, $pphrase);
  190.   mem("password", 1);
  191. }
  192.  
  193.  
  194. // this command checks what the channel passphrase is
  195. // anyone can use it, in case there's an issue
  196. // with the login script
  197.  
  198. if($arg1 == "/pphrase")
  199. {
  200.   $pphrase = mem($phrasep);
  201.   dbroadcast("Channel passphrase for " + $freq + ": " + $pphrase);
  202.   $flag = 2;
  203. }
  204.  
  205.  
  206. // login command, establishes who the tcommsadmin is
  207. // based on who enters in the correct password
  208. // tcommsadmin is the only person that can use
  209. // private commands, but anyone can use public ones
  210. // provided the tcommsadmin is logged in
  211.  
  212. if(mem($aname) == "")
  213. {
  214.   dbroadcast("ALERT: No admin found, wildcarding /login command.");
  215.   mem($aname, "#");
  216. }
  217.  
  218. if($arg1 == "/login")
  219. {
  220.   $pphrase = mem($phrasep);
  221.   $abool = 0;
  222.   if($source == mem($aname) || mem($aname) == "#")
  223.   {
  224.     $abool = 1;
  225.   }
  226.   if($arg2 == $pphrase && $abool)
  227.   {
  228.     if(mem($admin))
  229.     {
  230.       mem($admin, 0);
  231.       dbroadcast("Administrator: " + $source + " has logged out of frequency: " + $freq + ", timestamp: " + $time);
  232.     }
  233.     else
  234.     {
  235.       mem($admin, 1);
  236.       mem($aname, $source);
  237.       dbroadcast("Administrator: " + $source + " has logged into frequency: " + $freq + ", timestamp: " + $time, 1445, "GarlandOS");
  238.     }
  239.   }
  240.   else
  241.   {
  242.     dbroadcast("ALERT: Unauthorized login attempt by User: " + $source + " for frequency: " + $freq + " detected and logged at timestamp: " + $time);
  243.     dbroadcast("Passphrase mismatch. Correct password was: " + $pphrase + ", $aname was: " + $aname + ", $abool was " + $abool);
  244.   }
  245.   $flag = 1;
  246. }
  247.  
  248. $aflag = 0;
  249.  
  250. if(mem($admin)) // TODO: redundant, needs removal
  251. {
  252.   if($source == mem($aname))
  253.   {
  254.     $out = "Admin";
  255.     $aflag = 1;
  256.   }
  257. }
  258.  
  259.  
  260. // SPELLCHECK FILTERS BELOW
  261.  
  262. if($content == "..." || lower($content) == "uh" || lower($content) == "fuck" || lower($content) == "um" || lower($content) == "lol" || lower($content) == "nvm" || lower($content) == "xd" || lower($content) == "cocksucker" || lower($content) == "tits" || lower($content) == "motherfucker" || lower($content) == "piss" || lower($content) == "cunt")
  263. {
  264.   dbroadcast("NOTE: " + $source + " said something useless: " + $content);
  265.   $pass = false;
  266. }
  267.  
  268.  
  269. // PRIVATE COMMANDS BELOW
  270.  
  271. if($source == mem($aname) && find($arg1, "/"))
  272. {
  273.   // Remember to tune in to channel 145.7
  274.   // to check script toggles.
  275.  
  276.  
  277.   // Voice command, 4 arguments:
  278.   // first name, last name, job, font
  279.   // $pass = false, so completely stealthy
  280.   // anything after this will be content
  281.  
  282.   if($arg1 == "/voice") // NOTE NOTE NOTE: THIS IS BROKEN IN OGOS
  283.   { // fix involves using $flag to conditionally turn off the tcommsadmin filters
  284.     $pass = true;
  285.     $n1 = $arg2 + " " + $arg3;
  286.     $n2 = $arg4;
  287.     $n3 = $arg5;
  288.     $n4 = substr($content, length(" " + $arg1 + " " + $n1 + " " + $n2 + " " + $n3 + " "), length($content)+1);
  289.     $content = $n4;
  290.     $job = $n2;
  291.     $source = $n1;
  292.     $filters = vector($n3);
  293.     dbroadcast("EXEC: /voice");
  294.     $flag = 1;
  295.   }
  296.  
  297.  
  298.   //voice command, 3 arguments:
  299.   //name, job, font
  300.  
  301.   if($arg1 == "/vce") // BROKEN, see above for fix
  302.   {
  303.     $pass = true;
  304.     $n1 = $arg2;
  305.     $n2 = $arg3;
  306.     $n3 = $arg4;
  307.     $n4 = substr($content, length(" " + $arg1 + " " + $n1 + " " + $newJob + " " + $newFilter + " "), length($content)+1);
  308.     $content = $n4;
  309.     $job = $n2;
  310.     $source = $n1;
  311.     $filters = vector($n3);
  312.     dbroadcast("EXEC: /vce");
  313.     $flag = 1;
  314.   }
  315.  
  316.  
  317.   // TOGGLEABLE SCRIPTS BELOW
  318.    
  319.   // AI voice masking alert, can be toggled. Defaults on
  320.  
  321.   if($arg1 == "/mask") // tested, works
  322.   {
  323.     $meme = !mem("mask");
  324.     mem("mask",$meme);
  325.     dbroadcast("TOGGLE: /mask, " + $meme);
  326.     $flag = 1;
  327.   }
  328.  
  329.  
  330.   // UUID scrambler. Use this to fuck up AI tracking
  331.   // Remember to do /mask first.
  332.  
  333.   if($arg1 == "/scblr") // tested, works
  334.   {
  335.     $meme = !mem("scblr");
  336.     mem("scblr",$meme);
  337.     dbroadcast("TOGGLE: /scblr, " + $meme);
  338.     $flag = 1;
  339.   }
  340.  
  341.  
  342.   // /aio command. If there is no working
  343.   // AI, type this in to notify crew
  344.  
  345.   if($arg1 == "/aio") // tested, works
  346.   {
  347.     $meme = !mem("aio");
  348.     mem("aio",$meme);
  349.     dbroadcast("TOGGLE: /aio, " + $meme);
  350.     $flag = 1;
  351.   }
  352.  
  353.  
  354.   // panic disable comms. toggleable
  355.  
  356.   if($arg1 == "/panic") // tested, works
  357.   {
  358.     $meme = !mem("panic");
  359.     mem("panic",$meme);
  360.     dbroadcast("TOGGLE: /panic, " + $meme);
  361.     $flag = 1;
  362.   }
  363.  
  364.   if($flag == 0)
  365.   {
  366.     dbroadcast("Unrecognized private command: '" + $arg1 + "'"); // TODO: using public commands as admin triggers this
  367.     $flag = 1;
  368.   }
  369. }
  370.  
  371.  
  372. // PRIVATE COMMAND CHECKS
  373.  
  374. if($uuid != $source && $joblow != "signal technician" && $mflag == false)
  375. {
  376.   if(mem("mask") != 1)
  377.   {
  378.     broadcast("ALERT: Voice-masking properties detected from " + $source + "'s transmission.", 1447, "GarlandOS", "Announcer");
  379.   }
  380.   else
  381.   {
  382.     dbroadcast("ALERT: Redacted message from /mask.");
  383.   }
  384. }
  385.  
  386. if(mem("aio"))
  387. {
  388.   if(find(lower($content), "ai ") || find(lower($content), " ai"))
  389.   {
  390.     fbroadcast("NOTICE: AI is not operational.");
  391.   }
  392. }
  393.  
  394. if(mem("panic"))
  395. {
  396.   $pass = false;
  397.   dbroadcast("ALERT: /panic filtered message in channel " + $freq + ": " + $source + ": " + $content);
  398. }
  399.  
  400. if(find($arg1, "/") && mem($admin)) // delete the mem($admin) part if you want public commands enabled 24/7
  401. {
  402.   // PUBLIC COMMANDS BELOW
  403.  
  404.   // time command
  405.  
  406.   if($arg1 == "/time")
  407.   {
  408.     fbroadcast("Current time is: " + $time);
  409.     $flag += 2;
  410.   }
  411.  
  412.  
  413.   // likewise with the word 'date'
  414.  
  415.   if($arg1 == "/date")
  416.   {
  417.     $date = timestamp("DDD MMM DD");
  418.     $year = timestamp(" YYYY");
  419.     $year = tonum($year) + 540;
  420.     fbroadcast("Current date is: " + $date + " " + $year);
  421.     $flag += 2;
  422.   }
  423.  
  424.  
  425.   // return number of messages broadcasted
  426.  
  427.   if($arg1 == "/stats")
  428.   {
  429.     fbroadcast("User: " + $source + " has transmitted a total of " + $inc + " signals.");
  430.     $flag += 2;
  431.   }
  432.  
  433.  
  434.   // display all commands
  435.  
  436.   if($arg1 == "/help")
  437.   {
  438.     fbroadcast("*** Current available public commands ***");
  439.     fbroadcast("/time - - - Displays the time.");
  440.     fbroadcast("/date - - - Displays today's date.");
  441.     fbroadcast("/stats - - Displays the user's number of messages.");
  442.     $flag += 2;
  443.   }
  444.  
  445.  
  446.   // if the admin is logged in and nothing caught the user's command, do this
  447.  
  448.   if($flag == 0 && find($arg1, "/") && $aflag)
  449.   {
  450.     fbroadcast("Unrecognized public command: '" + $arg1 + "'. Type '/help' for a list of commands.");
  451.   }
  452. }
  453. else
  454. {
  455.   if(find($content, "/") && !$aflag && $flag == 1) // delete && !$aflag part for adminless public commands
  456.   {
  457.     fbroadcast("Commands are disabled while the administrator is logged out. We apologize for the inconvenience.");
  458.   }
  459. }
  460.  
  461. // END COMMAND SECTION
  462.  
  463.  
  464. // FINAL PROCESSING STEPS
  465.  
  466. // store appropriate jobname to $out
  467.  
  468. if(mem($joblow))
  469. {
  470.   $out = mem($joblow);
  471. }
  472. else
  473. {
  474.   $out = substr($job, 1, 31);
  475. }
  476.  
  477. // if user is on the manifest, add their job to the verb
  478.  
  479. if($joblow != "unknown" && $joblow != "no id")
  480. {
  481.   if($aflag)
  482.   {
  483.     $say = "dictates";
  484.     $ask = "demands";
  485.     $exclaim = "declares";
  486.     $yell = "roars";
  487.   }
  488.   else
  489.   {
  490.     $say = "(" + $out + ") " + pick("remarks", "comments", "says", "says", "notes", "points out", "reports", "alleges", "interjects", "mentions", "speaks up", "retorts", "elucidates", "dictates");
  491.     $ask = "(" + $out + ") " + pick("inquires", "queries", "asks", "asks", "requests", "questions", "investigates", "solicits");
  492.     $exclaim = "(" + $out + ") " + pick("declares", "proclaims", "shouts", "calls out", "ejaculates");
  493.     $yell = "(" + $out + ") " + pick("cries out", "roars", "shouts", "calls out", "yells", "screams");
  494.   }
  495. }
  496.  
  497.  
  498. // if user is not on the manifest, make it known
  499.  
  500. else
  501. {
  502.   if(rand(10) == 2 && $inc <= 20)
  503.   { // crew manifest can be bypassed in this version of garlandOS
  504.     fbroadcast("ADVISORY: " + $source + " is not on the crew manifest. This means the source is either a machine, a(n un)welcome visitor or an animal.");
  505.   }
  506.   dbroadcast("NOTE: Non-crewmember '" + $source + "' has job: " + $joblow);
  507.   $source = $source + " (Non-Crew)";
  508.   $say = pick("remarks", "comments", "says", "says", "notes", "points out", "reports", "alleges", "interjects", "mentions", "speaks up", "retorts", "elucidates", "dictates");
  509.   $ask = pick("inquires", "queries", "asks", "asks", "requests", "questions", "investigates", "solicits");
  510.   $exclaim = pick("declares", "proclaims", "shouts", "calls out", "ejaculates");
  511.   $yell = pick("cries out", "roars", "shouts", "calls out", "yells", "screams");
  512. }
  513.  
  514.  
  515. // if source is the administrator, apply appropriate filters
  516.  
  517. if($aflag && $flag != 2)
  518. {
  519.   $source = "TCOMMSADMIN: " + $source;
  520.   $filters = vector($loud);
  521. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement