What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [split] What scripts can't do.

[split] What scripts can't do.
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [split] What scripts can't do.
quote:
Originally posted by waterbottle
the example said - 1 so I added that too... I also tried without it, still didn't work.
Because, as Plik said, you pass a character as parameter to the function charCodeAtTest( n ) in this code:
code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
    return '' + charCodeAtTest(Message.charAt(0));
}
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:
Originally posted by waterbottle
What I'm trying to do first is get the ascii equivalent of the char.
for example, ' ' = 32, 'a' = 97, 'b' = 98, 'A' = 65, '1' = 49.
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.

;)

This post was edited on 12-15-2006 at 11:57 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-15-2006 11:43 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread


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