What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Replacing Text Using Scripts (I think I'm dumb lol)

Pages: (3): « First « 1 2 [ 3 ] Last »
[Help] Replacing Text Using Scripts (I think I'm dumb lol)
Author: Message:
aNILEator
Skinning Contest Winner
*****

Avatar
...in the wake of the aNILEator

Posts: 3718
Reputation: 90
35 / Male / Flag
Joined: Oct 2003
Status: Away
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
why don't you just simply edit the txt file in autocorrector.....?
07-12-2006 06:22 PM
Profile PM Web Find Quote Report
Silentdragon
Full Member
***

Avatar
if(life==null && wrists) EmoAlert();

Posts: 148
Reputation: 2
34 / Male / –
Joined: Jun 2006
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
My script detects links and ignores them when apply the text modifications.
07-12-2006 07:25 PM
Profile E-Mail PM Web Find Quote Report
Joereynolds89
Junior Member
**


Posts: 69
Joined: Jul 2006
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
because theres too much unneeded code, i thought creating a personal font would be sooo much easier :P

So what would the script be to ignore any changes if / , http or www is at the start and to change every instance of one letter to another :S pai just confused me, im an amateur scripter :P

EDIT: maybe something i did wrong last time, pais thing now works, ill test the ignorance if certain values are found next, but big thanx to pia :D

EDIT2:
How would i make it so changes dont occur if www, http or / is displayed anywhere within the message?? thanks
code:
function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
sMessage = sMessage.replace(/a/g,"A");
sMessage = sMessage.replace(/b/g,"B");
sMessage = sMessage.replace(/c/g,"C");
sMessage = sMessage.replace(/d/g,"D");
sMessage = sMessage.replace(/e/g,"E");
sMessage = sMessage.replace(/f/g,"F");
sMessage = sMessage.replace(/g/g,"G");
sMessage = sMessage.replace(/h/g,"H");
sMessage = sMessage.replace(/i/g,"I");
sMessage = sMessage.replace(/j/g,"J");
sMessage = sMessage.replace(/k/g,"K");
sMessage = sMessage.replace(/l/g,"L");
sMessage = sMessage.replace(/m/g,"M");
sMessage = sMessage.replace(/n/g,"N");
sMessage = sMessage.replace(/o/g,"O");
sMessage = sMessage.replace(/p/g,"P");
sMessage = sMessage.replace(/q/g,"Q");
sMessage = sMessage.replace(/r/g,"R");
sMessage = sMessage.replace(/s/g,"S");
sMessage = sMessage.replace(/t/g,"T");
sMessage = sMessage.replace(/u/g,"U");
sMessage = sMessage.replace(/v/g,"V");
sMessage = sMessage.replace(/w/g,"W");
sMessage = sMessage.replace(/x/g,"X");
sMessage = sMessage.replace(/y/g,"Y");
sMessage = sMessage.replace(/z/g,"Z");
return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}

The replacment with capitals is just for example, there will be symbols here instead so no comments about using .toUppercase please

Joe

This post was edited on 07-12-2006 at 08:18 PM by Joereynolds89.
07-12-2006 07:51 PM
Profile E-Mail PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
Here's code which will replace the letters for you. Might be a bit buggy as I didn't do extensive testing, however it works.

code:
function fuck_up_string(str)
{
    var a = [ 'a','B','C','D','e','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','u','V','W','X','Y','Z' ];
    var o = "", c;
    str = str.toLowerCase();
    for (var i = 0; i < str.length; i++)
    {
        c = str.charCodeAt( i );
        if (c >= 97 && c <= 122)
            o += a[c - 97];
        else o += str.charAt( i );
    }
    return o;
}

You see that?

code:
var a = [ 'a','B','C','D','e','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','u','V','W','X','Y','Z' ];

It will replace the letters a to z with the contents of that. As you can see in my testing I simply made the vowels lowercase. If I sent a message like "this is a test" I got "THiS iS a TeST".

This post was edited on 07-12-2006 at 09:51 PM by segosa.
The previous sentence is false. The following sentence is true.
07-12-2006 09:35 PM
Profile PM Find Quote Report
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
quote:
Originally posted by Joereynolds89
How would i make it so changes dont occur if www, http or / is displayed anywhere within the message?? thanks
You use:
code:

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{

if (!sMessage.match('www') && !sMessage.match('http')) { // no link found, replace stuff

// here put the code that I showed you (that you used in your reply) or use segosa's (dunno if it works, just taking his word for it)

}

}

07-13-2006 12:43 AM
Profile PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
Try this:

code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
    if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
    {
        var a = [ 'a','B','C','D','e','F','G','H','i','J','K','L','M','N','o','P','Q','R','S','T','u','V','W','X','Y','Z' ];
        var o = "", c;
        str = str.toLowerCase();
        for (var i = 0; i < str.length; i++)
        {
            c = str.charCodeAt( i );
            if (c >= 97 && c <= 122)
                o += a[c - 97];
            else o += str.charAt( i );
        }
        return o;
    }
    return sMessage;
}
The previous sentence is false. The following sentence is true.
07-13-2006 08:54 AM
Profile PM Find Quote Report
Joereynolds89
Junior Member
**


Posts: 69
Joined: Jul 2006
RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
lol thankyou Pai, finally got it all working :( if anyone actually wants to use it ill upload but all it does is change your font :S but i wanted it :P Thankyou to everyone that helped!

Segosa, i did all yours, i dont understand yours as i do Pai's :P but it didnt work :(

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
    if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
    {
        var a = [ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ];
        var o = "", c;
        str = str.toLowerCase();
        for (var i = 0; i < str.length; i++)
        {
            c = str.charCodeAt( i );
            if (c >= 97 && c <= 122)
                o += a[c - 97];
            else o += str.charAt( i );
        }
        return o;
    }
    return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}

Remember capitals are only for example :D
07-13-2006 09:57 AM
Profile E-Mail PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: RE: [Help] Replacing Text Using Scripts (I think I'm dumb lol)
quote:
Originally posted by Joereynolds89
lol thankyou Pai, finally got it all working :( if anyone actually wants to use it ill upload but all it does is change your font :S but i wanted it :P Thankyou to everyone that helped!

Segosa, i did all yours, i dont understand yours as i do Pai's :P but it didnt work :(

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
    if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
    {
        var a = [ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ];
        var o = "", c;
        str = str.toLowerCase();
        for (var i = 0; i < str.length; i++)
        {
            c = str.charCodeAt( i );
            if (c >= 97 && c <= 122)
                o += a[c - 97];
            else o += str.charAt( i );
        }
        return o;
    }
    return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}

Remember capitals are only for example :D


Crap, sorry, I forgot to change something.

Since you've already got your own working, it won't matter, but here's the working code:

code:
function OnEvent_Initialize(MessengerStart)
{
}

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage)
{
    if (!sMessage.match('www') && !sMessage.match('http') && sMessage.charAt(0) != '/')
    {
        var a = [ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' ];
        var o = "", c;
        var str = sMessage.toLowerCase();
        for (var i = 0; i < str.length; i++)
        {
            c = str.charCodeAt( i );
            if (c >= 97 && c <= 122)
                o += a[c - 97];
            else o += str.charAt( i );
        }
        return o;
    }
    return sMessage;
}
function OnEvent_Uninitialize(MessengerExit)
{
}
The previous sentence is false. The following sentence is true.
07-13-2006 10:04 AM
Profile PM Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] Last »
« 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