Script Request- Developers please view |
Author: |
Message: |
CH33z
New Member
Posts: 5
Joined: Aug 2006
|
O.P. Script Request- Developers please view
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.
Someone please try, and if you succeed, post a reply on this thread. Thanx.
|
|
08-23-2006 08:54 AM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Script Request- Developers please view
Do you mean, filtering the words you send or the ones you recieve?
|
|
08-23-2006 09:21 AM |
|
|
Jesus
Scripting Contest Winner
Koffie, my cat ;)
Posts: 623 Reputation: 15
38 / /
Joined: Jul 2005
|
RE: Script Request- Developers please view
received I guess...
how else can he find it annoying
|
|
08-23-2006 12:17 PM |
|
|
phalanxii
Full Member
Posts: 146 Reputation: 5
32 / /
Joined: Aug 2006
Status: Away
|
RE: Script Request- Developers please view
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.")
}
|
|
08-23-2006 12:28 PM |
|
|
saralk
Veteran Member
Posts: 2598 Reputation: 38
35 / /
Joined: Feb 2003
|
RE: Script Request- Developers please view
quote: Originally posted by -!Felu!-
quote: Originally posted by Mattike
Do you mean, filtering the words you send or the ones you recieve?
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.
The Artist Formerly Known As saralk
London · New York · Paris
Est. 1989
|
|
08-23-2006 12:33 PM |
|
|
CH33z
New Member
Posts: 5
Joined: Aug 2006
|
O.P. RE: Script Request- Developers please view
Thanx guyz- I'm gonna try them out now.
And yes, I meant recieving not outgoing messages.
Thanks 4 all your help.
|
|
08-23-2006 10:35 PM |
|
|
KnRd_WC
Junior Member
Florian PAQUET
Posts: 74 Reputation: 1
35 / /
Joined: Aug 2006
|
RE: Script Request- Developers please view
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
This post was edited on 08-23-2006 at 11:01 PM by KnRd_WC.
|
|
08-23-2006 10:59 PM |
|
|
CH33z
New Member
Posts: 5
Joined: Aug 2006
|
O.P. RE: Script Request- Developers please view
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?
|
|
08-23-2006 11:08 PM |
|
|
Shondoit
Full Member
Hmm, Just Me...
Posts: 227 Reputation: 15
36 / /
Joined: Jul 2006
|
RE: Script Request- Developers please view
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;
}
This post was edited on 08-24-2006 at 12:13 AM by Shondoit.
|
|
08-24-2006 12:12 AM |
|
|
CH33z
New Member
Posts: 5
Joined: Aug 2006
|
O.P. RE: Script Request- Developers please view
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.
|
|
08-24-2006 07:24 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|