Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Ancient code published for archival purposes. May or may not work or be relevant.
- Feel free to do whatever you want with this, if anything.
- Archive from 2017-10-07 - contents may be older. */
- // MPP.chat.send('::' + localStorage.names)
- MPP.client.on("a", function (msg) {
- // functions //
- function sendChat(text) {
- MPP.chat.send(text);
- }
- function randNum(min, max) {
- return Math.round(Math.random() * (max - min) + min);
- }
- // defines //
- var args = msg.a.split(" "); // split message into an array at each space
- var cmd = args[0].toLowerCase(); // the first part should be the command
- var input = msg.a.substring(cmd.length).trim(); // trim off everything past the command, and that's our input
- var cmdChar = ">";
- // Commands //
- if (cmd == cmdChar+"cham") {
- sendChat("Cham Bot v. 1.0 type /help for help.");
- }
- if (cmd == cmdChar+"dice") {
- sendChat("Dice:"+randNum(1,6));
- }
- if (cmd == cmdChar+"credits") {
- sendChat("Special thanks to Logan And Fennece for helping me figure out how to bot. :)");
- }
- if (cmd == cmdChar+"help") {
- sendChat("Complete Commands: >help, >credits, >cham, >dodge.");
- }
- /* if (cmd == "hello" || cmd == "hi" || cmd == "hola" || cmd == "meow" || cmd == "aye") {
- sendChat("Hi there!");
- } */
- if (cmd == cmdChar +"/swag/") {
- sendChat("Playing Swag.mid.");
- sendChat("Error: Too little Swag :(")
- }
- if (cmd == cmdChar +"logan") {
- sendChat("The definition of \"Meow\"");
- }
- if (cmd == cmdChar+"dodge") {
- if (input == "") {
- sendChat("Dodge: >dodge [value]");
- } else {
- // input less than one OR input greater than 3
- if (input < 1 || input > 3) {
- sendChat("Enter a number between 1 and 3. [Dodge Failed]");
- // if the above condition is false they enter it within the bounds
- } else {
- if (input == randNum(1,3) ) {
- sendChat("[Dodge Succeeded]");
- }
- else {
- sendChat("[Dodge Failed]");
- }
- }
- }
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement