Shoutbox

Whats wrong with this (debuging will not open as well) :(... - 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: Whats wrong with this (debuging will not open as well) :(... (/showthread.php?tid=70652)

Whats wrong with this (debuging will not open as well) :(... by plus on 01-13-2007 at 09:15 PM

Say this was a script nothing else what would be wrong with it.

code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage){
    if (sMessage === 'hello'){
        MsgPlus.DisplayToast('hello', 'Capital letters remember and full stops');
    }
    else if (sMessage === 'hiya'){
        MsgPlus.DisplayToast('hiya', 'Capital letters remember and full stops');
    }

The debuging dosnt open some how?
RE: Whats wrong with this (debuging will not open as well) :(... by J-Thread on 01-13-2007 at 09:26 PM

The only thing I see is that you're missing a closing bracket ( } ) of the function...


RE: Whats wrong with this (debuging will not open as well) :(... by plus on 01-13-2007 at 09:33 PM

Were?


RE: Whats wrong with this (debuging will not open as well) :(... by Eljay on 01-13-2007 at 09:56 PM

quote:
Originally posted by L. Coyote
Not only are you missing a closing bracket for the function, but you are also using === instead of ==.

=== doesn't mean anything, it's not correct.

umm dont post when you dont know what youre talking about :P

=== is a perfectly valid operator, it does the same thing as the == operator with the addition of checking the type of the two variables being compared (which in this case is not really needed, but wont make any difference).

The only thing wrong with that code is the missing closing bracket.
RE: RE: Whats wrong with this (debuging will not open as well) :(... by J-Thread on 01-13-2007 at 10:45 PM

quote:
Originally posted by .2007
Were?

Sorry, but I'm not going to answer that one.

I advice you to search these forums / the internet for a programming course to learn some very basics. If you  have problems with it, you can always ask (polite) and me or (more probable) one of the other forum members will help you. But promise me that you will read the answers carefully, because the answer is in my previous post.
RE: Whats wrong with this (debuging will not open as well) :(... by plus on 01-13-2007 at 11:47 PM

ok i am asking,

Can you please tell me were the missing } is.

Thank you very mutch.


RE: Whats wrong with this (debuging will not open as well) :(... by NanaFreak on 01-13-2007 at 11:51 PM

code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage){
    if (sMessage === 'hello'){
        MsgPlus.DisplayToast('hello', 'Capital letters remember and full stops');
    }
    else if (sMessage === 'hiya'){
        MsgPlus.DisplayToast('hiya', 'Capital letters remember and full stops');
    }
}

;)
RE: Whats wrong with this (debuging will not open as well) :(... by plus on 01-13-2007 at 11:56 PM

Thanks NanaFreak :)


RE: RE: Whats wrong with this (debuging will not open as well) :(... by CookieRevised on 01-14-2007 at 02:56 AM

quote:
Originally posted by .2007
Were?
quote:
Originally posted by J-Thread
The only thing I see is that you're missing a closing bracket ( } ) of the function...
read underlined part carefully ;)

In most programming languages you always must enclose a group of statements with some sort of character or other start/ending statement.

In JScript, when you start a group of statements with "{" you always must close the group with "}".

To avoid such mistakes it is almost mandatory to properly indent each line of code so you can easly see where you're missing some starting/closing character.

quote:
Originally posted by Eljay
=== is a perfectly valid operator, it does the same thing as the == operator with the addition of checking the type of the two variables being compared. (which in this case is not really needed, but wont make any difference)
yes and no... It is the other way around...

When you use === no additional type conversions are done. It is with the use of == that extra stuff is done. Hence I would personally always use === wherever possible. And I see == as a special case of ===, not the other way around.

But you're right that in this case it wont make a difference in the outcome of the function since both are strings already.

So it is == which wouldn't be realy needed.

Ref: CookieRevised's reply to Nudges, Updated.

;)