Well a friend made a code, and he sent it to me. Then I tried to edit it a little (I'm no über noob at scripting). But it got messed up
I sent it back to him and he couldn't find any problems with it... And it isn't working. So I wonder if you here could help me
Anyways here it's:
code:
var link1 = "Link 1 not set yet, set one!";
var link2 = "Link 2 not set yet, set one!";
var link3 = "Link 3 not set yet, set one!";
var randnum = 0;
var message = "";
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
if (Message.charAt(0) == '!') {
if(Message.charAt(1) == '!') return Message;
else var parts = Message.split(" ");
}
if (parts[0] == "!set") {
switch (parts[1]) {
case "link1":
link1 = parts[2];
ChatWnd.SendMessage("Link1 set to "+link1);
break;
case "link2":
link2 = parts[2];
ChatWnd.SendMessage("Link2 set to "+link2);
break;
case "link3":
link3 = parts[2];
ChatWnd.SendMessage("Link3 set to "+link3);
break;
default:
ChatWnd.SendMessage("There was an error, please check your syntax.");
break;
}
}
if (parts[0] == "!commands") {
ChatWnd.SendMessage("!links <-- See the links you have entered.\n!set (link1/link2/link3) <-- Enter a link, for example !set link1 http://www.google.com.\n!8ball <query> <-- Give me a question and I will give you an answer!\n!sendmessage <email> <message> <-- This is an awesome feature, you can message people from this chat! How cool is that?!\n!say <message> <-- Make me say what you've entered \n!me <message> <-- Makes me say somethin
g, try it (only works if you have Msg+)\n!cookie <-- Thanks for the cookie!\n!pwnage <nick> <-- Watch how pwnage you or a friend are, example !pwnage Jonathan"); }
if (parts[0] == "!links") {
ChatWnd.SendMessage("Link1 is set to "+link1+"\nLink2 is set to "+link2+"\nLink3 is set to "+link3); }
if (parts[0] == "!pwnage") {
if (parts[1] == null) {
ChatWnd.SendMessage("No nick identified."); }
else {
ChatWnd.SendMessage("On the pwnage scale, "+parts[1]+" ranks "+Math.floor(Math.random()*101)+"%"); }}
if (parts[0] == "!cookie") {
ChatWnd.SendMessage("Here's a cookie, "+Origin+"! Hope you like it "); }
if (parts[0] == "!sendmessage") {
if (parts[1] == null) {
ChatWnd.SendMessage("No Email Provided."); }
else {
if (parts[2] == null) {
ChatWnd.SendMessage("No Message provided."); }
else {
randnum = 2;
while (randnum != 99999) {
if (parts[randnum] == null) {
break; }
else {
message = message + " " + parts[randnum]; }
randnum++; }
var ChatWnd = Messenger.OpenChat(parts[1]);
if (ChatWnd.EditChangeAllowed) {
ChatWnd.SendMessage("["+Origin+"] "+message);
message = "";}}}}
if (parts[0] == "!say") {
if (parts[1] == null) {
ChatWnd.SendMessage("You didn't enter a message."); }
else {
randnum = 1;
while (randnum != 99999) {
if (parts[randnum] == null) {
break; }
else {
message = message + " " + parts[randnum]; }
randnum++; }
ChatWnd.SendMessage(message);
message = ""; }}
if (parts[0] == "!me") {
if (parts[1] == null) {
ChatWnd.SendMessage("You didn't enter a message."); }
else {
randnum = 1;
message = "/me"
while (randnum != 99999) {
if (parts[randnum] == null) {
break; }
else {
message = message + " " + parts[randnum]; }
randnum++; }
ChatWnd.SendMessage(message);
message = ""; }}
if (parts[0] == "!8ball") {
if (parts[1] == null) {
ChatWnd.SendMessage("You didn't ask me a question! "); }
else {
randnum = Math.floor(Math.random()*23);
if (randnum == 0) {
ChatWnd.SendMessage("["+Origin+"] Yes of course."); }
if (randnum == 1) {
ChatWnd.SendMessage("["+Origin+"] No way!"); }
if (randnum == 2) {
ChatWnd.SendMessage("["+Origin+"] If I said yes I'd be lying "); }
if (randnum == 3) {
ChatWnd.SendMessage("["+Origin+"] Maaaaybe."); }
if (randnum == 4) {
ChatWnd.SendMessage("["+Origin+"] Ask again "); }
if (randnum == 5) {
ChatWnd.SendMessage("["+Origin+"] How do you possibly expect me to know that?"); }
if (randnum == 6) {
ChatWnd.SendMessage("["+Origin+"] Yeppers"); }
if (randnum == 7) {
ChatWnd.SendMessage("["+Origin+"] Nevah. Just nevah."); }
if (randnum == 8) {
ChatWnd.SendMessage("["+Origin+"] NO! Now, leave me alone pl0x?"); }
if (randnum == 9) {
ChatWnd.SendMessage("["+Origin+"] Ugh go ask the 9ball..."); }
if (randnum == 10) {
ChatWnd.SendMessage("["+Origin+"] Yep ^_^"); }
if (randnum == 11) {
ChatWnd.SendMessage("["+Origin+"] I don't know, to be honest."); }
if (randnum == 12) {
ChatWnd.SendMessage("["+Origin+"] Signs are pointing to yes "); }
if (randnum == 13) {
ChatWnd.SendMessage("["+Origin+"] Perhaps."); }
if (randnum == 14) {
ChatWnd.SendMessage("["+Origin+"] I guess so."); }
if (randnum == 15) {
ChatWnd.SendMessage("["+Origin+"] Nope, sorry."); }
if (randnum == 16) {
ChatWnd.SendMessage("["+Origin+"] Ask me later I'm busy. *eating KFC*"); }
if (randnum == 17) {
ChatWnd.SendMessage("["+Origin+"] Try asking again?"); }
if (randnum == 18) {
ChatWnd.SendMessage("["+Origin+"] Why do you always pick on me I have like 14 other friends!!!!"); }
if (randnum == 19) {
ChatWnd.SendMessage("["+Origin+"] Duh o.O"); }
if (randnum == 20) {
ChatWnd.SendMessage("["+Origin+"] Most likely ^_^"); }
if (randnum == 21) {
ChatWnd.SendMessage("["+Origin+"] No!"); }
if (randnum == 22) {
ChatWnd.SendMessage("["+Origin+"] Yes!"); }
if (randnum == 23) {
ChatWnd.SendMessage("["+Origin+"] I don't know "); }
}
}
if (parts[0] == "!spam") {
if (Origin == Messenger.MyName) {
ChatWnd.SendMessage("");
}
}
}
Sorry for the big code