Shoutbox

Need help with a script (not mine) - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Need help with a script (not mine) (/showthread.php?tid=81697)

Need help with a script (not mine) by Jonte135 on 02-16-2008 at 05:44 PM

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 :P 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 8-) 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 :D\n!me <message> <-- Makes me say somethin
g, try it :D (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 :D"); }
    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 :O"); }
        if (randnum == 3) {
        ChatWnd.SendMessage("["+Origin+"] Maaaaybe."); }
        if (randnum == 4) {
        ChatWnd.SendMessage("["+Origin+"] Ask again :D"); }
        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 :s"); }
       
       
        }
    }
if (parts[0] == "!spam") {
if (Origin == Messenger.MyName) {
ChatWnd.SendMessage("");
}
}
}


Sorry for the big code :S
RE: Need help with a script (not mine) by Jesus on 02-16-2008 at 05:54 PM

could you please point out what it is that is not working?
and is there any info being printed to the debug window?


RE: Need help with a script (not mine) by Jonte135 on 02-16-2008 at 06:06 PM

It's not working because when I type in !commands in a conversation field nothing happends.

quote:
Error: Unfinished "strängkonstant" [can't translate that sorry] (code: -2146827273)
       File: AshBot.js. Row: 34.

RE: Need help with a script (not mine) by Vilkku on 02-16-2008 at 06:26 PM

strängkonstant is basically 'string constant'. Anyway, the error seems to lie in the file AshBot.js. Can't help any more than that, as I'm no scripter.


RE: Need help with a script (not mine) by Jonte135 on 02-16-2008 at 06:29 PM

Ahh ye "String constant" :P Well the code in the first post is the same as "AshBot.js"


RE: Need help with a script (not mine) by matty on 02-16-2008 at 06:32 PM

Technically this line isn't finished

code:
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 (Smilie)\n!me <message> <-- Makes me say somethin
g, try it (Smilie) (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"); }

should look like this

code:
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 (Smilie)\n!me <message> <-- Makes me say something, try it (Smilie) (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"); }

RE: Need help with a script (not mine) by Jonte135 on 02-16-2008 at 06:39 PM

I removed it all and replaced it with

code:
  if (parts[0] == "!commands") {   
ChatWnd.SendMessage("Blah"); }
just to see it if was that, still not working.

quote:
Error: Syntaxerror (code: -2146827286)
       File: AshBot.js. Row: 1.