[split] What scripts can't do. - 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: [split] What scripts can't do. (/showthread.php?tid=69494) RE: What scripts can't do. by waterbottle on 12-13-2006 at 09:18 PM
A bit offtopic but, RE: What scripts can't do. by Felu on 12-14-2006 at 10:30 AM
quote:You have to use && or ||. You might like to check this out too. http://www.msgpluslive.net/scripts/view/152-Windo...ipt-Documentation/ RE: What scripts can't do. by J-Thread on 12-14-2006 at 10:58 AM
&& and || are not bitwise operators but boolean operators... RE: [split] What scripts can't do. by Mnjul on 12-14-2006 at 03:07 PM You need to use charCodeAt method, waterbottle RE: [split] What scripts can't do. by waterbottle on 12-15-2006 at 10:30 PM
hmm, code: Anyone know what I'm doing wrong? RE: [split] What scripts can't do. by Plik on 12-15-2006 at 11:06 PM
quote:In that code you are passing a char (or a 1 byte string) to the function, you are then treating it as an integer when you subtract one. And if im not mistaken the n - 1 part would equate to NaN (not a number) because you are subtracting one from a string. I don't really understand what you are trying todo so i can't really give you any tips RE: [split] What scripts can't do. by waterbottle on 12-15-2006 at 11:18 PM
the example said - 1 so I added that too... I also tried without it, still didn't work. RE: [split] What scripts can't do. by Plik on 12-15-2006 at 11:37 PM
quote:in that case all you need todo is use charCodeAt, like so code: And that will return the ascii code of the first char of the message RE: [split] What scripts can't do. by CookieRevised on 12-15-2006 at 11:43 PM
quote:Because, as Plik said, you pass a character as parameter to the function charCodeAtTest( n ) in this code: code:because charAt(0) will return the first character in the string Message. So the parameter n in your function charCodeAtTest( n ) is a character, not a number... And a character minus a number (thus your n-1) results in error code NaN... And charCodeAt() expects a number (character position, starting from 0 for the first character), not NaN. Hence why it always return the same number, because your n-1 is always NaN. quote:string.charCodeAt(character position) eg: "ab1def".charCodeAt(0) equals 97 "ab1def".charCodeAt(1) equals 98 "ab1def".charCodeAt(2) equals 49 --- To check for certain bits in a number use the bitwise operators. eg: 3 & 1 will equal 1 3 & 2 will equal 2 1 | 2 will equal 3 --- PS: in the very first reply in this thread, Felu, gave you a link to the JScript documentation. And later on people gave links to that same online documentation. Plenty small examples are given in those docs. RE: RE: [split] What scripts can't do. by waterbottle on 12-16-2006 at 12:53 AM
quote:ah, right, I totally misunderstood the example Well, thanks for all the help. |