Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var favGame = ""; //Favorite game name
- var currentGame = ""; //Current game name
- var favConsole = ""; //Favorite game console
- //The HTML stuff for the text.
- document.getElementById("sidepane").innerHTML += "<strong>Your Statistics:</strong><br>";
- favGame = readStorage("favoriteGame");
- document.getElementById("sidepane").innerHTML += "<p style=\"margin: 0 0 0 0\" id=\"favgame\">Favorite game: \"" + favGame + "\"</p>";
- currentGame = readStorage("currentGame");
- document.getElementById("sidepane").innerHTML += "<p style=\"margin:0 0 0 0\" id=\"currentgame\">Current game: \"" + currentGame + "\"</p>";
- favConsole = readStorage("favConsole");
- document.getElementById("sidepane").innerHTML += "<p style=\"margin: 0 0 0 0\" id=\"favconsole\">Favorite console: \"" + favConsole + "\"</p>";
- commands.push(new Command("games", function(str){ //Push the command to the command stack
- //Storage for favorite game: "favoriteGame"
- //Storage for current game: "currentGame"
- //Storage for favorite console: "favConsole"
- favGame = "";
- currentGame = "";
- favConsole = "";
- var args = str.split(" "); //Split the arguments string into separate parts and put them into an array
- var i = 0; //Used for any for loops.
- if(args[1] == "favorite"){ //If the first argument is "favorite"
- if(args[2] == "set"){ //If the second argument is "set"
- for(i = 3; i <= args.length - 1; i++){ //Read through the remaining arguments, join to string
- if(i == 3){ //If the argument is 3, then it is the first word of the title
- favGame = favGame + args[i]; //Take the first word of the title and put it into string
- } else { //Otherwise, it is all of the other words in the title
- favGame = favGame + " " + args[i]; //Take other words of title, add a space and word
- }
- }
- document.getElementById("favgame").innerHTML = "Favorite game: \"" + favGame + "\"";
- writeStorage("favoriteGame", favGame); //Store the data
- sendMessage("/me set their favorite game to: \"" + favGame + "\"."); //Send the message
- } else if(args[2] == "tell"){ //If the second argument is "tell"
- favGame = readStorage("favoriteGame"); //Read the data, store into favGame
- sendMessage("/me - favorite game is: \"" + favGame + "\"."); //Send the message
- } else if(args[2] == "recall"){ //If the second argument is "recall"
- favGame = readStorage("favoriteGame"); //Read the data, store into favGame
- systemMessage("Your favorite game is: \"" + favGame + "\"."); //Show the message
- }
- } else if(args[1] == "current"){ //If the first argument is "current"
- if(args[2] == "set"){ //If the second argument is "set"
- for(i = 3; i <= args.length - 1; i++){ //Read through the remaining arguments, join to string
- if(i == 3){ //If the argument is 3, then it is the first word in the title
- currentGame = currentGame + args[i]; //Take the first word of the title, put into string
- } else { //Otherwise, it is all of the other words in the title
- currentGame = currentGame + " " + args[i]; //Take remaining args, add with space
- }
- }
- document.getElementById("currentgame").innerHTML = "Current game: \"" + currentGame + "\"";
- writeStorage("currentGame", currentGame); //Store the data
- sendMessage("/me is currently playing: \"" + currentGame + "\"."); //Send the message
- } else if(args[2] == "clear"){ //If the second argument is "clear"
- currentGame = ""; //Empty out the string
- document.getElementById("currentgame").innerHTML = "Current game: \"" + currentGame + "\"";
- writeStorage("currentGame", currentGame); //Write the data
- sendMessage("/me is not currently playing a game.");
- } else if(args[2] == "tell"){ //If the second argument is "tell"
- currentGame = readStorage("currentGame"); //Read the data
- if(currentGame == ""){ //If the string is blank
- sendMessage("/me - not currently playing a game."); //Send the message
- } else { //Otherwise, the string is not empty
- sendMessage("/me - currently playing: \"" + currentGame + "\"."); //Send the message
- }
- } else if(args[2] == "recall"){ //If the second argument is "recall"
- currentGame = readStorage("currentGame"); //Read the data
- if(currentGame == ""){ //If the string is blank
- systemMessage("You are not currently playing a game."); //Send the message
- } else { //Otherwise, the string is not empty
- systemMessage("You are currently playing: \"" + currentGame + "\"."); //Send the message
- }
- }
- } else if(args[1] == "console"){ //If the first argument is "system"
- if(args[2] == "set"){ //If the second argument is "set"
- for(i = 3; i <= args.length - 1; i++){ //Read through the remaining arguments
- if(i == 3){ //If it is the first word in the console name, put it into the string
- favConsole = favConsole + args[i]; //Put the word into favConsole
- } else { //Otherwise, it is any of the other words in the console name
- favConsole = favConsole + " " + args[i]; //Add to string with a space separating
- }
- }
- document.getElementById("favconsole").innerHTML = "Favorite console: \"" + favConsole + "\"";
- writeStorage("favConsole", favConsole); //Store the data
- sendMessage("/me has set their favorite console to: \"" + favConsole + "\"."); //Send the message
- } else if(args[2] == "tell"){ //If the second argument is "tell"
- favConsole = readStorage("favConsole"); //Read the data
- sendMessage("/me - favorite console is: \"" + favConsole + "\"."); //Send the message
- } else if(args[2] == "recall"){ //If the second argument is "recall"
- favConsole = readStorage("favConsole"); //Read the data
- systemMessage("Your favorite console is: \"" + favConsole + "\"."); //Send the message
- }
- }
- }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement