Shoutbox

T3XT SCRiiPT - 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: T3XT SCRiiPT (/showthread.php?tid=75926)

T3XT SCRiiPT by Chunk1993 on 07-07-2007 at 04:34 PM

Can anyone please make a script that changes all letters to capitals, all i's to small ii and E's to 3's?

Thanks In Advance...


RE: T3XT SCRiiPT by toddy on 07-07-2007 at 04:55 PM

code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    switch (Message){
        default:
            {
                Message = Message.replace(/a/gi,"A");
                Message = Message.replace(/b/gi,"B");
                Message = Message.replace(/c/gi,"C");
                Message = Message.replace(/d/gi,"D");
                Message = Message.replace(/e/gi,"3");
                Message = Message.replace(/f/gi,"F");
                Message = Message.replace(/g/gi,"G");
                Message = Message.replace(/h/gi,"H");
                Message = Message.replace(/i/gi,"ii");
                Message = Message.replace(/j/gi,"J");
                Message = Message.replace(/k/gi,"K");
                Message = Message.replace(/l/gi,"L");
                Message = Message.replace(/m/gi,"M");
                Message = Message.replace(/n/gi,"N");
                Message = Message.replace(/o/gi,"O");
                Message = Message.replace(/p/gi,"P");
                Message = Message.replace(/q/gi,"Q");
                Message = Message.replace(/r/gi,"R");
                Message = Message.replace(/s/gi,"S");
                Message = Message.replace(/t/gi,"T");
                Message = Message.replace(/u/gi,"U");
                Message = Message.replace(/v/gi,"V");
                Message = Message.replace(/w/gi,"W");
                Message = Message.replace(/x/gi,"X");
                Message = Message.replace(/y/gi,"Y");
                Message = Message.replace(/z/gi,"Z");
                return Message
        }
    }
}


RE: T3XT SCRiiPT by Chunk1993 on 07-07-2007 at 04:59 PM

Thanks so much :D


RE: T3XT SCRiiPT by toddy on 07-07-2007 at 05:25 PM

quote:
Originally posted by Chunk1993
Thanks so much :D
most people will hate you tho if you always type in caps.

anyways, updated it abit. so you can enable & disable it

code:
function OnGetScriptCommands ()
{
    commands  = "<ScriptCommands>";
    commands +=     "<Command>";
    commands +=         "<Name>startcaps</Name>";
    commands +=         "<Description>Replace lower Case to caps - Start</Description>";
    commands +=     "</Command>";
    commands +=     "<Command>";
    commands +=         "<Name>stopcaps</Name>";
    commands +=         "<Description>Replace lower Case to caps - Stop</Description>";
    commands +=     "</Command>";
    commands += "</ScriptCommands>";
    return commands;
}

var sEnabled = false;
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
    switch (Message){
        case "/startcaps":
            sEnabled = true
            return '';
        case "/stopcaps":
            sEnabled = false;
            return '';
        default:
            if (sEnabled = true){
                Message = Message.replace(/a/gi,"A");
                Message = Message.replace(/b/gi,"B");
                Message = Message.replace(/c/gi,"C");
                Message = Message.replace(/d/gi,"D");
                Message = Message.replace(/e/gi,"3");
                Message = Message.replace(/f/gi,"F");
                Message = Message.replace(/g/gi,"G");
                Message = Message.replace(/h/gi,"H");
                Message = Message.replace(/i/gi,"ii");
                Message = Message.replace(/j/gi,"J");
                Message = Message.replace(/k/gi,"K");
                Message = Message.replace(/l/gi,"L");
                Message = Message.replace(/m/gi,"M");
                Message = Message.replace(/n/gi,"N");
                Message = Message.replace(/o/gi,"O");
                Message = Message.replace(/p/gi,"P");
                Message = Message.replace(/q/gi,"Q");
                Message = Message.replace(/r/gi,"R");
                Message = Message.replace(/s/gi,"S");
                Message = Message.replace(/t/gi,"T");
                Message = Message.replace(/u/gi,"U");
                Message = Message.replace(/v/gi,"V");
                Message = Message.replace(/w/gi,"W");
                Message = Message.replace(/x/gi,"X");
                Message = Message.replace(/y/gi,"Y");
                Message = Message.replace(/z/gi,"Z");
                return Message
        }
    }
}



RE: T3XT SCRiiPT by Chunk1993 on 07-07-2007 at 05:27 PM

Probably yeah - but oh well, thanks again :)


RE: T3XT SCRiiPT by Volv on 07-07-2007 at 06:10 PM

toddy, what happens if i type the message "E" - unless i've missed something your script won't pick it up :p
EDIT: nevermind, misread reg expression

A much better alternative would be to use JScript's in-built toUpperCase() function.

Message = Message.toUpperCase();
Message = Message.replace(/E/g,"3");
Message = Message.replace(/I/g,"ii");


RE: T3XT SCRiiPT by John Anderton on 07-07-2007 at 06:15 PM

quote:
Originally posted by toddy
if (sEnabled = true){
I hope you mean
code:
if (sEnabled == true)
;)

Else your code will always be switched on :)
RE: T3XT SCRiiPT by Chunk1993 on 07-07-2007 at 06:19 PM

I wondered why it wasn't working! I had to turn it on and off manually. Thanks it works now!


RE: T3XT SCRiiPT by toddy on 07-07-2007 at 08:33 PM

quote:
Originally posted by John Anderton
quote:
Originally posted by toddy
if (sEnabled = true){
I hope you mean
code:
if (sEnabled == true)
;)

Else your code will always be switched on :)
oops :P

as you can tell, i didn't test it :P
RE: T3XT SCRiiPT by markee on 07-08-2007 at 02:56 PM

quote:
Originally posted by John Anderton
quote:
Originally posted by toddy
if (sEnabled = true){
I hope you mean
code:
if (sEnabled == true)
;)
I hope you mean
code:
if(sEnabled === true)
Else your code will take longer to do the same thing ;)

* markee runs