Shoutbox

Script Request- Developers please view - 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: Script Request- Developers please view (/showthread.php?tid=65270)

Script Request- Developers please view by CH33z on 08-23-2006 at 08:54 AM

Attention script developers---

     Would somebody please create a script for a word filter? I'd really appreciate it if someone could make and post one in the script section. Sometimes it is really annoying when every second word should be packed with tons of ***'s but it isn't. 8o|

     Someone please try, and if you succeed, post a reply on this thread. Thanx. :D


RE: Script Request- Developers please view by Matti on 08-23-2006 at 09:21 AM

Do you mean, filtering the words you send or the ones you recieve? ^o)


RE: Script Request- Developers please view by Jesus on 08-23-2006 at 12:17 PM

received I guess...
how else can he find it annoying ;)


RE: Script Request- Developers please view by phalanxii on 08-23-2006 at 12:28 PM

I've made this script which will filter all messages (both sent and received). To add words to the list, you will need to edit the array at the top. You can have as many or as little filtered words as you want.

code:
// Add words that you want censored to the wf_FilteredWords array.
// Enclose the words with quotation marks (") and separate each word with a comma (,).

var wf_FilteredWords = new Array("FilteredWord0", "FilteredWord1", "FilteredWord2");

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    var wf_FilteredMessage = Message;
    Debug.Trace("Filtered message defined.")
   
    for(i = 0; i < wf_FilteredWords.length; i++) {
        while(wf_FilteredMessage.toLowerCase().search(wf_FilteredWords[i].toLowerCase()) != -1) {
            Debug.Trace("Filtered word found.")
            var wf_IndexArray = new Array(wf_FilteredMessage.toLowerCase().search(wf_FilteredWords[i].toLowerCase()), wf_FilteredMessage.toLowerCase().search(wf_FilteredWords[i].toLowerCase()) + wf_FilteredWords[i].length);
            var wf_ReplacedStars = "";
           
            for(j = 0; j < wf_FilteredWords[i].length; j++) {
                wf_ReplacedStars += "*";
            }
            Debug.Trace("Star replacement created.")
           
            var wf_Temp = wf_FilteredMessage.substring(0, wf_IndexArray[0]) + wf_ReplacedStars + wf_FilteredMessage.substr(wf_IndexArray[1]);
            wf_FilteredMessage = wf_Temp;
            Debug.Trace("Filtered word censored.")
        }
    }
   
    Debug.Trace("All filtered words censored.")
   
    return wf_FilteredMessage;
    Debug.Trace("Filtered message sent.")
}

RE: Script Request- Developers please view by saralk on 08-23-2006 at 12:33 PM

quote:
Originally posted by -!Felu!-
quote:
Originally posted by Mattike
Do you mean, filtering the words you send or the ones you recieve? ^o)
Whatever he means, there's a way out.

For Outgoing you can just use Quick Texts.

And for Incoming(except emoticons) use something like this(Make sure Edit is not longer than Message) -
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind){
if (Origin != Messenger.MyName){
if (Message == "Message 1"){
return "Edit 1";
}
if (Message == "Message 2"){
return "Edit 2";
}
if (Message == "Message 3"){
return "Edit 3";
}
}
}


That wouldn't work, if someone wrote "hey fool, go Message 3 yourself" it wouldn't replace that.
RE: Script Request- Developers please view by CH33z on 08-23-2006 at 10:35 PM

Thanx guyz- I'm gonna try them out now. :D

   And yes, I meant recieving not outgoing messages.

Thanks 4 all your help. :)


RE: Script Request- Developers please view by KnRd_WC on 08-23-2006 at 10:59 PM

Hi everybody ;)

Just a suggestion to phalanxii, your scripts works fine, but there are some ameliorations to do... I say that for helping... Because your script  seems very hard to do ! xD

code:
var wf_FilteredWords = new Array("Word1", "Word2", "Word3");

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
    for(i = 0; i < wf_FilteredWords.length; i++) {
        var FilterWord=wf_FilteredWords[i];
        var Repl = new RegExp("("+FilterWord+")","gi")
        Message=Message.replace(Repl,GetStars(FilterWord.length));
    }
    return Message;
}

function GetStars(Length) {
    var ReturnVal=""
    for(k = 0; k < Length; k++) {
        ReturnVal+="*"
    }
    return ReturnVal;
}

That should work too ;)
RE: Script Request- Developers please view by CH33z on 08-23-2006 at 11:08 PM

BTW: Is there a way to get it to work with personal messages as well? If yes I'd appreciate the help.

Also, if only part of the word is a filtered one, will it replace the filtered part? :huh:


RE: Script Request- Developers please view by Shondoit on 08-24-2006 at 12:12 AM

No, you can't change others PSMs

Yes it will...

If you don't want that,
This will fix it:

code:
var wf_FilteredWords = new Array("Word1", "Word2", "Word3");

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin,Message,MessageKind) {
    for(i = 0; i < wf_FilteredWords.length; i++) {
        var FilterWord=wf_FilteredWords[i];
        var Repl = new RegExp("(?:^|\\b)"+FilterWord+"(?:\\b|$)","gi")
        Message=Message.replace(Repl,GetStars(FilterWord.length));
    }
    return Message;
}

function GetStars(Length) {
    var ReturnVal=""
    for(k = 0; k < Length; k++) {
        ReturnVal+="*"
    }
    return ReturnVal;
}

RE: Script Request- Developers please view by CH33z on 08-24-2006 at 07:24 AM

Hey guyz- a good idea would be to post that script on the database but give credit to the others.

BTW: I couldn't get your script to work saralk. Maybe I'm doing something wrong or it just doesn't work. :(

Thanks again for all that help. :)


RE: Script Request- Developers please view by saralk on 08-24-2006 at 09:15 AM

quote:
Originally posted by CH33z
I couldn't get your script to work saralk.

I didn't make a script :S
RE: Script Request- Developers please view by CH33z on 08-24-2006 at 10:25 PM

OK soz- it was just an example. (of course) :P

KnRd_WC- I found your script best, so I think you should post it in the script database.

Shondoit- I did want "if only part of the word is a filtered one it replaced the filtered part" but others may like your script, so thanx 4 trying 2 help. :)