What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Replace letters

Replace letters
Author: Message:
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. Replace letters
Hi.
I'm from Denmark and my english isn't good, but i'll try..

I'm trying to make a 1337/leet-generator which makes a message letters to 1337/leet-letters. (Example: A = 4, B = 8), but i can't find out to make the code replace distinct letters.

Is there anyone who can and wants to help me?

- Simon
08-18-2006 07:31 PM
Profile E-Mail PM Web Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
RE: Replace letters
Hi SnuZZer,

Try this :

code:
function OnEvent_ChatWndSendMessage(ChatWnd,Message) {
     Message = Message.replace(/A/gi,'4');
     Message = Message.replace(/B/gi,'8');
     // etc,...
     return Message;
}


Note :
gi = case insensitive
g = case sensitive

;)

This post was edited on 08-18-2006 at 08:45 PM by KnRd_WC.
08-18-2006 08:22 PM
Profile PM Web Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Replace letters
quote:
Originally posted by KnRd_WC
Hi SnuZZer,

Note :
gi = case insensitive
g = case sensitive

;)

Actually i is indeed case-insensitive, but just removing it will enable case-sensitive mode, the g is non-lazy, so it will search the entire string for a many matches as it can find without it it will stop when it finds the first match.
[Image: 1-0.png]
             
08-18-2006 08:54 PM
Profile PM Web Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
RE: Replace letters
Lol, I knew it already but I did not want to describe more because I am French... In fact, I did not have the words to say that ! :P

But you do it very well... :D
08-18-2006 09:35 PM
Profile PM Web Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: Replace letters
Hi.
I can't get it work.
This is my code (The text is danish):

code:
var Status = "fra";
var Besked = "";

// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : START
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
    if (Status == "til")
    {
        Besked = Message.replace(/A/g,'4');
        Besked = Message.replace(/B/g,'8');
        return Besked;
    }
   
    if (Message == "/leettil") {
    Status = "til";
    MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået til.");
    return;
    }
   
    if (Message == "/leetfra") {
    Status = "fra";
    MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået fra.");
    return;
    }   
}
// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : SLUT

// LAVER KOMMANDO MENU : START
function OnGetScriptCommands(){
    var kommandoer = '<ScriptCommands>';
        kommandoer += '<Command>';
            kommandoer += '<Name>leettil</Name>';
            kommandoer += '<Description>Slår Leet beskeder til.</Description>';
        kommandoer += '</Command>';
        kommandoer += '<Command>';
            kommandoer += '<Name>leetfra</Name>';
            kommandoer += '<Description>Slår Leet beskeder fra.</Description>';
        kommandoer += '</Command>';
    kommandoer += '</ScriptCommands>';
    return kommandoer;
}
// LAVER KOMMANDO MENU : SLUT

I'm new to MSG Plus! Live programming.
08-19-2006 09:22 AM
Profile E-Mail PM Web Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
RE: Replace letters
Hi Snuzzer,

Try this :

code:
var Status = "fra";
var Besked = "";

// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : START
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
if (Status == "til")
{
Message = Message.replace(/A/g,'4');
Message = Message.replace(/B/g,'8');
return Message;
// Original Code :
// Besked = Message.replace(/A/g,'4'); // Ok, here you will replace "A" in Message string and store the new string in Besked.
// Besked = Message.replace(/B/g,'8'); // And here, you do the same thing, but with "B". You will ONLY replace "B" in Message string.
// return Besked;
}

if (Message == "/leettil") {
Status = "til";
MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået til.");
return ""; // Here you have to return "", if not, it's the message error
}

if (Message == "/leetfra") {
Status = "fra";
MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået fra.");
return ""; // Same as above
}
}
// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : SLUT

// LAVER KOMMANDO MENU : START
function OnGetScriptCommands(){
var kommandoer = '<ScriptCommands>';
kommandoer += '<Command>';
kommandoer += '<Name>leettil</Name>';
kommandoer += '<Description>Slår Leet beskeder til.</Description>';
kommandoer += '</Command>';
kommandoer += '<Command>';
kommandoer += '<Name>leetfra</Name>';
kommandoer += '<Description>Slår Leet beskeder fra.</Description>';
kommandoer += '</Command>';
kommandoer += '</ScriptCommands>';
return kommandoer;
}
// LAVER KOMMANDO MENU : SLUT


;)
08-19-2006 09:53 AM
Profile PM Web Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: Replace letters
Hi again!
Oh!! I't works! It replace the letters.
But.. Now i got another problem :-(

When i type /leettil it says that the command doesn't exists :-S

code:
var Status = "fra";
var Besked = "";

// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : START
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
if (Status == "til")
{
Message = Message.replace(/A/g,'4');
Message = Message.replace(/B/g,'8');
Message = Message.replace(/E/g,'3');
Message = Message.replace(/L/g,'1');
Message = Message.replace(/O/g,'0');
Message = Message.replace(/S/g,'5');
Message = Message.replace(/T/g,'7');
Message = Message.replace(/a/g,'4');
Message = Message.replace(/b/g,'8');
Message = Message.replace(/e/g,'3');
Message = Message.replace(/l/g,'1');
Message = Message.replace(/o/g,'0');
Message = Message.replace(/s/g,'5');
Message = Message.replace(/t/g,'7');
return Message;
}

if (Message == "/leettil") {
Status = "til";
MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået til.");
return "";
}

if (Message == "/leetfra") {
Status = "fra";
MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået fra.");
return "";
}
}
// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : SLUT

// LAVER KOMMANDO MENU : START
function OnGetScriptCommands(){
var kommandoer = '<ScriptCommands>';
kommandoer += '<Command>';
kommandoer += '<Name>leettil</Name>';
kommandoer += '<Description>Slår Leet beskeder til.</Description>';
kommandoer += '</Command>';
kommandoer += '<Command>';
kommandoer += '<Name>leetfra</Name>';
kommandoer += '<Description>Slår Leet beskeder fra.</Description>';
kommandoer += '</Command>';
kommandoer += '</ScriptCommands>';
return kommandoer;
}
// LAVER KOMMANDO MENU : SLUT


Will you please help me? :-$
08-19-2006 10:24 AM
Profile E-Mail PM Web Find Quote Report
KnRd_WC
Junior Member
**

Avatar
Florian PAQUET

Posts: 74
Reputation: 1
35 / Male / Flag
Joined: Aug 2006
RE: Replace letters
Hi again Snuzzer, I found the problem !

code:
var Status = "fra";
var Besked = "";

// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : START
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{

// The problem was here...
// Cause when you will type "/leettil", Status will be changed to "til".. and in your original script, "if (Status == "til")..." was placed BEFORE checking the commands !
// So, the first time you typed "/leettil", it worked... and second time, it do not because, in your string remplacement, the return Message = "/1337711", :D

if (Message == "/leettil") {
Status = "til";
MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået til.");
return "";
}

if (Message == "/leetfra") {
Status = "fra";
MsgPlus.DisplayToast("Leet beskeder", "Leet beskeder er slået fra.");
return "";
}

if (Status == "til")
{
Message = Message.replace(/A/g,'4');
Message = Message.replace(/B/g,'8');
Message = Message.replace(/E/g,'3');
Message = Message.replace(/L/g,'1');
Message = Message.replace(/O/g,'0');
Message = Message.replace(/S/g,'5');
Message = Message.replace(/T/g,'7');
Message = Message.replace(/a/g,'4');
Message = Message.replace(/b/g,'8');
Message = Message.replace(/e/g,'3');
Message = Message.replace(/l/g,'1');
Message = Message.replace(/o/g,'0');
Message = Message.replace(/s/g,'5');
Message = Message.replace(/t/g,'7');
return Message;
}


}
// LAVER BESKED TIL 1337 HVIS STATUS ER "TIL" // TJEKKER OM DER ER LAVET EN KOMMANDO : SLUT

// LAVER KOMMANDO MENU : START
function OnGetScriptCommands(){
var kommandoer = '<ScriptCommands>';
kommandoer += '<Command>';
kommandoer += '<Name>leettil</Name>';
kommandoer += '<Description>Slår Leet beskeder til.</Description>';
kommandoer += '</Command>';
kommandoer += '<Command>';
kommandoer += '<Name>leetfra</Name>';
kommandoer += '<Description>Slår Leet beskeder fra.</Description>';
kommandoer += '</Command>';
kommandoer += '</ScriptCommands>';
return kommandoer;
}
// LAVER KOMMANDO MENU : SLUT


Oh, if you are interested, take a look here, you will find all leet codes

This post was edited on 08-19-2006 at 10:42 AM by KnRd_WC.
08-19-2006 10:34 AM
Profile PM Web Find Quote Report
SnuZZer
Full Member
***

Avatar

Posts: 114
32 / Male / Flag
Joined: Jun 2006
O.P. RE: Replace letters
Hi.
Oh!! I'm stupid! :-)

Thanks!! :-*

Oh! Cool (H)
Hi.
If there is someone who wants to see my leet-generator it can be downloaded here (It's danish):
www.snuzzer.dk/Leet.rar
08-19-2006 10:48 AM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Replace letters
Message = Message.replace(/A/g,'4');
Message = Message.replace(/B/g,'8');
Message = Message.replace(/E/g,'3');
Message = Message.replace(/L/g,'1');
Message = Message.replace(/O/g,'0');
Message = Message.replace(/S/g,'5');
Message = Message.replace(/T/g,'7');
Message = Message.replace(/a/g,'4');
Message = Message.replace(/b/g,'8');
Message = Message.replace(/e/g,'3');
Message = Message.replace(/l/g,'1');
Message = Message.replace(/o/g,'0');
Message = Message.replace(/s/g,'5');
Message = Message.replace(/t/g,'7');

change that to:

Message = Message.replace(/A/gi,'4');
Message = Message.replace(/B/gi,'8');
Message = Message.replace(/E/gi,'3');
Message = Message.replace(/L/gi,'1');
Message = Message.replace(/O/gi,'0');
Message = Message.replace(/S/gi,'5');
Message = Message.replace(/T/gi,'7');

as described in second and third post of this thread.


PS: don't forget that Plus! has already a build in replacer; you don't need scripts for something like this (although in this case it is a bit more convenient and can be turned on/off more easly):
Plus! > Preferences > Conversations > Quick Texts > Add > Automatically replace text in messages I send.

This post was edited on 08-19-2006 at 01:16 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
08-19-2006 01:12 PM
Profile 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