What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Need help with a script (not mine)

Need help with a script (not mine)
Author: Message:
Jonte135
Junior Member
**


Posts: 57
– / – / Flag
Joined: Aug 2007
O.P. Need help with a script (not mine)
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
02-16-2008 05:44 PM
Profile E-Mail PM Find Quote Report
Jesus
Scripting Contest Winner
****

Avatar
Koffie, my cat ;)

Posts: 623
Reputation: 15
37 / Male / Flag
Joined: Jul 2005
RE: Need help with a script (not mine)
could you please point out what it is that is not working?
and is there any info being printed to the debug window?
Man is least himself when he is in his own person. Give him a mask and he will tell you the truth. (Oscar Wilde)
02-16-2008 05:54 PM
Profile PM Find Quote Report
Jonte135
Junior Member
**


Posts: 57
– / – / Flag
Joined: Aug 2007
O.P. RE: Need help with a script (not mine)
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.
02-16-2008 06:06 PM
Profile E-Mail PM Find Quote Report
Vilkku
Veteran Member
*****

Avatar

Posts: 1411
Reputation: 27
35 / Male / Flag
Joined: Mar 2003
RE: Need help with a script (not mine)
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.
[Image: signature.php]
02-16-2008 06:26 PM
Profile E-Mail PM Web Find Quote Report
Jonte135
Junior Member
**


Posts: 57
– / – / Flag
Joined: Aug 2007
O.P. RE: Need help with a script (not mine)
Ahh ye "String constant" :P Well the code in the first post is the same as "AshBot.js"
02-16-2008 06:29 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Need help with a script (not mine)
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"); }
02-16-2008 06:32 PM
Profile E-Mail PM Find Quote Report
Jonte135
Junior Member
**


Posts: 57
– / – / Flag
Joined: Aug 2007
O.P. RE: Need help with a script (not mine)
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.

This post was edited on 02-16-2008 at 06:48 PM by Jonte135.
02-16-2008 06:39 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On