What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » i have a problem with my script

i have a problem with my script
Author: Message:
crzymike13
New Member
*


Posts: 6
Joined: Aug 2007
O.P. Happy  i have a problem with my script
someone plz help me i am almost done with my first script and when i save it i get this in the debug window:

Error:  Expected '}' (code: -2146827279
           File:  Pizza Shop.js. Line: 139

heres the line:

saveAll(); // I save the data

someone plz help me

This post was edited on 08-01-2007 at 10:22 PM by crzymike13.
08-01-2007 10:21 PM
Profile E-Mail PM Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: i have a problem with my script
you'll have to post a bit more code than that, preferably the entire script. you probably missed the } in the previous function or statement
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
08-01-2007 10:24 PM
Profile PM Web Find Quote Report
crzymike13
New Member
*


Posts: 6
Joined: Aug 2007
O.P. RE: i have a problem with my script
k then heres the script

var ScriptName = "Pizza Shop 1.0";
var nbrPizza;
var nbrEaten;
var nbrMoney;
var lang;
var givPizza = false;
var givMoney = false;
var givMoneyS = false;
var hmmcig = [25, 50, 75, 100, 500, 1000, 5000, 10000, 100000];
var ungivPizza = false;
var ungivMoney = false;
var ungivMoneyS = false;
var nbrDonEachMess = 50;
var toastEn;

function OnEvent_Initialize(MessengerStart)
{
    Debug.Trace("Welcome To The Pizza Shop!");
}

function OnEvent_Uninitialize(MessengerExit)
{
}

function OnEvent_Signin(Email)
{
    if(Email == "michael1194@roadrunner.com")
    {
        var Message = "Hello " + Messenger.MyName + "!";
        Message = MsgPlus.RemoveFormatCodes(Message);
        MsgPlus.DisplayToast("", Message);
    }
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message) {
        nbrMoney = nbrDonEachMess+Number(nbrMoney); // I give you money when you speek
        switch (Message) {
                case "!givePizza": //you want give him/her a pizza
                        if (nbrPizza >= 1){
                                if (!givPizza) {
                                        givPizza = ChatWnd;
                                        if (toastEn == "Yes") MsgPlus.DisplayToast("Pizza Shop", lang[11]);
                                } else {
                                        return "!cancelgivepizza";
                                }
                        } else {
                                if (toastEn == "Yes") MsgPlus.DisplayToast("PizzaShop", lang[11]);
                                return "";
                        }
                        nbrMoney -= nbrDonEachMess; // No give Money
                break;
               
                case "!cancelgivepizza": // you dont want to give him/her a pizza
                        if (!givPizza) {
                                return "!givepizza";
                        } else {
                                givPizza =  false;
                                if (toastEn == "yes") MsgPlus.DisplayToast("PizzaShop", lang[19]);
                        }
                        nbrMoney -= 50 // No give money
                break;
               
                case "!cancelgivemoney": //you dont want to give him/her money
                        if (!givMoney) {
                                return "";
                        } else {
                                givMoney = false;
                                givMoneyS = false;
                                if (toastEn == "Yes") MsgPlus.DisplayToast("PizzaShop", lang[19]);
                        }
                        nbrMoney -= nbrDonEachMess; // No give money
                break;
               
                case "!nogivepizza": // you dont want a pizza
                        if (!ungivPizza) {
                                return "";
                        } else {
                                ungivPizza = false;
                        }
                        nbrMoney -= nbrDonEachMess; // No give money
                break;
               
                case "!yesgivepizza": //you want a pizza
                        if (!ungivPizza) {
                                return "";
                        } else {
                                ungivPizza = false
                                nbrPizza++;
                        }
                        nbrMoney -=nbrDonEachMess; // No give Money
                break;
               
                case "!nogivemoney": //you dont want money
                        if (ungivMoney) {
                               return "";
                        } else {
                               ungivMoney = false;
                        }
                        nbrMoney -= nbrDonEachMess; // No give money
                break;
               
                case "!yesgivemoney": // you want money
                        if (ungivMoney) {
                               return "";
                        } else {
                                ungivMoney = false;
                                nbrMoney += hmmcig[ungivMoneyS];
                                ungivMoneyS = false;
                        }
                        nbrMoney -= nbrDonEachMess; // No give money
                break;
        }
        if (Message.substring(0, 11) == "!givemoney ") { // you want to give him/her money
                if (!givMoney) {
                        if (nbrMoney >= hmmcig[Message.substring(11, Message.length)]) {
                                givMoney = ChatWnd;
                                givMoneyS = Message.substring(11, Message.length);
                                if (toastEn == "Yes") MsgPlus.DisplayToast("PizzaShop", lang[18]);
                        } else {
                                return "";
                        }
                } else {
                        return "";
                }
                nbrMoney -=nbrDonEachMess; // No give money
        }
        saveAll(); // I save the data
08-01-2007 10:31 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: i have a problem with my script
You are missing a } at the very end of the script.
08-01-2007 10:35 PM
Profile E-Mail PM Find Quote Report
crzymike13
New Member
*


Posts: 6
Joined: Aug 2007
O.P. RE: i have a problem with my script
k its fixet ty
08-01-2007 10:36 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: i have a problem with my script
Your welcome but I don't mean to be rude but people need to start reading the error message they are descriptive and explain that there is a problem and where it is.
08-01-2007 10:38 PM
Profile E-Mail PM Find Quote Report
LifelesS
Full Member
***


Posts: 115
Reputation: 4
32 / Male / Flag
Joined: Dec 2006
RE: i have a problem with my script
More important than that, at least in my opinion, I think code organization is a very good thing:P

For example, if you use

code:
if(code...)
{
    a little more code...
}

instead of

code:
if(code...){
    the code... }

and so on...

Another good thing, is to use something else that the default script editor. I use phpDesigner and it matches the () and {}, it would work like so in the above example:

code:
if(code...)
{
    a little more code...
}
Best Regards,
Joćo Godinho
08-02-2007 12:02 AM
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