RiftWorks
Найти
Персональное меню
Вы не представились системе
user-interface-preferences
Персональные инструменты
Обсуждение
Вклад
Создать учётную запись
Войти
Параметры
notifications
Редактирование:
NTSL Scripts
(раздел)
associated-pages
Статья
Обсуждение
Просмотры
Читать
Править
Править код
История
Внимание:
Вы не вошли в систему. Ваш IP-адрес будет общедоступен, если вы запишете какие-либо изменения. Если вы
войдёте
или
создадите учётную запись
, её имя будет использоваться вместо IP-адреса, наряду с другими преимуществами.
Анти-спам проверка.
Не
заполняйте это!
=== 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>
Описание изменений:
Обратите внимание, что все изменения в RiftWorks рассматриваются как выпущенные на условиях лицензии Creative Commons Attribution-NonCommercial-ShareAlike (см.
RiftWorks:Авторские права
). Если вы не хотите, чтобы ваши тексты свободно распространялись и редактировались любым желающим, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений или скопировали их из источника в общественном достоянии или под совместимой лицензией.
Не размещайте без разрешения материалы, защищённые авторским правом!
Отменить
Справка по редактированию
(в новом окне)