Редактирование:
NTSL Scripts
(раздел)
Перейти к навигации
Перейти к поиску
Внимание:
Вы не вошли в систему. Ваш IP-адрес будет общедоступен, если вы запишете какие-либо изменения. Если вы
войдёте
или
создадите учётную запись
, её имя будет использоваться вместо IP-адреса, наряду с другими преимуществами.
Анти-спам проверка.
Не
заполняйте это!
==Useful Non-Malicious Scripts== === Job Indicator === Shows everyone's jobs. <pre>if (!find($source, "Unknown") && $job != "No id" && !find($source, " (as ")) { $source = $source + " (" + $job + ")"; } // Add job next to people's names.</pre> === Arrivals Alert Modification === Separates the automated arrivals messages from the AI's deliberate messages. <pre>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 } }</pre> === Anonymous Messages === Messages prefixed with "/anon" will hide their sender's identity. <pre>$explodeString = explode($content, " "); if(at($explodeString, 1) == "/anon") { $pass = false; $content = substr($content, 6, length($content)+1); broadcast($content, $freq, "Anonymous"); }</pre> === Less Annoying Job Indicator === Only shows abbreviations of job titles instead of full titles. <pre>def Initialize() { $words = vector( "assistant", "Assnt", "captain", "Capt", "head of personnel", "HoP", "bartender", "Bar", "chef", "Chef", "botanist", "Hydro", "quartermaster", "QM", "cargo technician", "Cargo", "shaft miner", "Miner", "clown", "Clown", "mime", "Mime", "janitor", "Jan-r", "librarian", "Lib-n", "lawyer", "Law", "chaplain", "Chapl", "chief engineer", "CE", "station engineer", "Engi", "atmospheric technician", "Atmos", "chief medical officer", "CMO", "medical doctor", "MD", "chemist", "Chem", "geneticist", "G-tic", "virologist", "Viro", "research director", "RD", "scientist", "Sci", "roboticist", "Robo", "head of security", "HoS", "warden", "Ward", "detective", "D-tiv", "security officer", "Sec", "ai", "AI", "cyborg", "Borg", "personal ai", "pAI", ); $index = 1; while($index <= length($words)) { $key = at($words, $index); $value = at($words, $index+1); mem($key,$value); $index += 2; } } if(mem("initialized") != 1) { Initialize(); mem("initialized", 1); } $foo = ""; $joblow = lower($job); if(mem($joblow)) { $foo = mem($joblow); } else { $foo = substr($job, 1, 6); } if (!find($source, "Unknown") && $job != "No id" && !find($source, " (as ")) { $source = $source + " [" + $foo + "]"; }</pre> ===Selective Mute === Mute and unmute people merely by saying "/mute FULL NAME" the name has to be capitalized and spelled properly.<br> Authorizes by one or more sources, but could be configured for a password if you really wanted to.<br> Great for traitor AIs who don't want their victim screaming about the oxygen siphoning! <pre>//recursive implode function, takes a vector and //combines each member into a string with a space to separate //by perogi def implode($vector) { $str = at($vector, 1); remove($vector, $str); if(length($vector) > 0) { $str += " "; $str += implode($vector); } return $str; } //mute and unmute function //use: type /mute or /unmute then the name of the person exactly as it is spelled //by perogi $exp = explode($content, " "); if($source == "YOUR NAME HERE") //only the name in this line can use script { if(at($exp, 1) == "/mute") { remove($exp, "/mute"); $name = implode($exp); $pass = 0; mem($name,$name); } if(at($exp,1) == "/unmute") { $pass = 0; remove($exp, "/unmute"); $muteremove = implode($exp); mem($muteremove, 0); } } //checks if source is muted //possible to get around mute by taking off ID and being unknown, hence why unknowns are all blocked if($source == mem($source) || $source == "Unknown") { $pass = 0; }</pre> ===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. <pre>$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"); }</pre> ===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) <pre>// 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</pre> ===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> === 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. <pre>// 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(); } }</pre> === Spam Removal === To remove radio clutter when there's too many hulks and/or tourettes. Filters them out. <pre>$npass = 1; if ($content == "GWAAAAAAAARRRHHH!!!" || $content == "HNNNNNNNNNGGGGGGH!!!" || $content == "RAAAAAAAARGH!!!" || $content == "AAAAAAARRRGH!!!" || $content == "NNNNNNNNGGGGGGGGHH!!!") { $npass = 0; } if ($content == "CUNT" || $content == "SHIT" || $content == "FUCK" || $content == "COCKSUCKER" || $content == "TITS" || $content == "MOTHERFUCKER") { $npass = 0; } if (mem($source) == $content) { $npass = 0; } if (mem($source) != $content) { mem($source, $content); } $space = 1; while ($space) { $space = 0; $init = substr($content, 1, 2); if ($init == " ") { $space = 1; $content = substr($content, 2, length($content)+1); } } $firstchar = substr($content, 1, 2); if ($firstchar == lower($firstchar)) { $firstchar = upper($firstchar); } $content = $firstchar + substr($content, 2, length($content)+1); $end = substr($content, length($content), length($content)+1); if ($end != "." && $end != "!" && $end != "?") { $content += "."; } if ($content == upper($content)) { $content = lower($content); $init = upper(substr($content, 1, 2)); $seq = substr($content, 2, length($content)+1); $content = $init + $seq; } $pass = 0; if ($npass && $job != "Cyborg" && $job != "AI") { broadcast($content, $freq, $source, $job); }</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>
Описание изменений:
Пожалуйста, учтите, что любой ваш вклад в проект «MassMeta» может быть отредактирован или удалён другими участниками. Если вы не хотите, чтобы кто-либо изменял ваши тексты, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений, или скопировали их из источника, допускающего свободное распространение и изменение своего содержимого (см.
MassMeta:Авторские права
).
НЕ РАЗМЕЩАЙТЕ БЕЗ РАЗРЕШЕНИЯ ОХРАНЯЕМЫЕ АВТОРСКИМ ПРАВОМ МАТЕРИАЛЫ!
Отменить
Справка по редактированию
(в новом окне)
Навигация
Персональные инструменты
Вы не представились системе
Обсуждение
Вклад
Создать учётную запись
Войти
Пространства имён
Статья
Обсуждение
русский
Просмотры
Читать
Править
Править код
История
Ещё
Поиск
/tg/station 13
Главная страница
Новым игрокам
Правила
Профессии
Гайды
Предметы
Локации
Карты
Игровые режимы
Вклад
Руководство по участию в разработке билда
Маппинг
Спрайтинг
Руководство по пониманию кода
Разработка
Wiki
Свежие правки
Случайная страница
Инструменты
Ссылки сюда
Связанные правки
Служебные страницы
Сведения о странице