Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- importScriptPage("MediaWiki:JacobsLadderSuite.js","d97");
- var safetyPattern = /\!say/i;
- var enabled = true;
- var target = Math.floor((Math.random() * 500) + 1);
- mainRoom.model.chats.bind("afteradd", function() {
- if(JLAPI.mostRecentMessage.message().slice(0,4) == "!say" && enabled == true) {
- if(JLAPI.mostRecentMessage.message().slice(5).indexOf("!say") != -1) {
- JLAPI.message.send("No");
- } else {
- JLAPI.message.send('"'+JLAPI.mostRecentMessage.message().slice(5).replace(safetyPattern, "!say")+'" - '+JLAPI.mostRecentMessage.username());
- }
- } else if (JLAPI.mostRecentMessage.message().slice(0,4) == "!off") {
- if(enabled == true) { JLAPI.message.send("Shutting down."); }
- enabled = false;
- } else if (JLAPI.mostRecentMessage.message().slice(0,3) == "!on") {
- if(enabled == false) { JLAPI.message.send("Starting up."); }
- enabled = true;
- } else if (JLAPI.mostRecentMessage.message().search(/^[0-9]*$/) != -1) {
- console.log("Made it to position A, message is "+JLAPI.mostRecentMessage.message());
- if(parseInt(JLAPI.mostRecentMessage.message()) > target) {
- JLAPI.message.send('Nope! '+JLAPI.mostRecentMessage.message()+' is too high!');
- } else if (parseInt(JLAPI.mostRecentMessage.message()) < target) {
- JLAPI.message.send('Nope! '+JLAPI.mostRecentMessage.message()+' is too low!');
- } else if (parseInt(JLAPI.mostRecentMessage.message()) == target) {
- JLAPI.message.send('[b] [c red]Congrats '+JLAPI.mostRecentMessage.username()+'! The answer was '+target+'! [/c] [/b]');
- target = Math.floor((Math.random() * 500) + 1);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement