What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Problem With String Lengths

Problem With String Lengths
Author: Message:
Master Jake
New Member
*

Haii

Posts: 7
32 / Male / Flag
Joined: Feb 2009
O.P. Problem With String Lengths
Hi! I'm trying to do something to change people's messages. I know I can only see it on my screen but I still want it cause its cool. This is what I have so far.

code:
var gayMessages = new Array("I'm Gay!", "Did you know I'm homosexual now?", "Yes, I finally came out of the closet.", "I know it's shocking, but I really am gay..!", "My life sucks now that I'm gay :(", "Please don't tell anyone I'm gay!!!", "Can I suck your weener?", "I wish I was as cool as you....");

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind)
{
    if (Origin != Messenger.MyName)
    {
        Debug.Trace(Message);
       
        var randnum = Math.floor(Math.random()*gayMessages.length)
        Message = gayMessages[randnum];
        return Message;
    }
}


The problem with this? It only writes out as many characters of the new message as they originally typed. So if they type "hello" and it gets the message "I know it's shucking, but I really am gay..!" then it will only display "I kno" because thats 5 letters and their original message "hello" was 5 letters. I need it to display the whole, regardless.
02-12-2009 10:56 PM
Profile E-Mail PM Web Find Quote Report
pollolibredegrasa
Full Member
***

Avatar
formerly fatfreechicken

Posts: 483
Reputation: 34
35 / Male / Flag
Joined: May 2005
RE: Problem With String Lengths
As explained in the scripting documentation:
quote:
It is important to remember that the new message cannot be longer than the original one (use Message.length) and will be cut if necessary.

AFAIK, there is no workaround either, so what you want is not possible.
;p

[Image: chickennana.gif] Vaccy is my thin twin! [Image: chickennana.gif]
02-12-2009 11:21 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Problem With String Lengths
Also you need to use gayMessages.length-1 because the Array is 0 based but length isn't because it is the total number of items in the array.
02-13-2009 04:19 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