Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] [Hard-coded] Swear Filter!


Carim123
 Share

Recommended Posts

Next tutorial, a (HARD-CODED.) Swear Filter!

To add words, add it in the SwearWords = "HERE" declaration, and MAKE SURE THERE ARE NO SPACES.
The filter works case-insensitively, so there is no need to do "test,TEST,Test,tEst,teSt" etc.

Firstly, everything is server-side, so in modDatabase (Or any module you like…) add;

```
Public Function CheckForSwears(Index As Long, Msg As String)
'  Carim's Swear Filter. GIVE CREDIT.
Dim SplitStr() As String
Dim SwearWords As String
Dim i As Integer

    '  There are NO spaces between each swear.
    SwearWords = "ass,test,etc,female dog"
    SplitStr = split(SwearWords, ",")

    For i = 0 To UBound(SplitStr)
        If InStr(1, LCase(Msg$), SplitStr(i), 1) Then
              Msg = Replace$((Msg), (SplitStr(i)), LCase(String(Len(SplitStr(i)), "*")), , , 1)
        End If
    Next i
End Function
```

Now, in Sub HandleSayMsg, Sub HandleEmoteMsg, Sub HandleBroadcastMsg, wherever you have something you want to check, add
```
    Call CheckForSwears(Index, Msg)
```
Above "Call AddLog***".

And, after adding the Call in the three appropiate cases, in my case, save and compile, test it with all your channels, and it should block out the word, and any word containing said word.
Unfortunately, it makes Assessment turn into ***essment, and Assassin into ******in, but I haven't figured that out yet. xD

CREDIT OBSIDIAN.
Link to comment
Share on other sites

So you're re-posting a tutorial made for Mirage in 2003 which was then revived by someone in Elysium in 2005 which was then revived by someone in Eclipse in 2007 which is now being revived by you in 2011… and you want credit for removing a line?

lolwat.
Link to comment
Share on other sites

@Robin:

> So you're re-posting a tutorial made for Mirage in 2003 which was then revived by someone in Elysium in 2005 which was then revived by someone in Eclipse in 2007 which is now being revived by you in 2011… and you want credit for removing a line?
>
> lolwat.

Not really. A friend dared me to add it as a joke, but it kinda backfired here, so I may as well remove it. ^_^
Wanted to see how I could play along.

Was expecting to see the result of various newbies, but like I said; backfired. v_v
Link to comment
Share on other sites

@Robin:

> So you're re-posting a tutorial made for Mirage in 2003 which was then revived by someone in Elysium in 2005 which was then revived by someone in Eclipse in 2007 which is now being revived by you in 2011… and you want credit for removing a line?
>
> lolwat.

… Quadruple fail! Lol.
Link to comment
Share on other sites

  • 2 months later...
Easy, just make it a rule where attempting to use a loophole with the swear filter results in warnings/mutes.

Works for forums and most ORPGs, don't see why it can't work here.

Or, you could make some form of AI to add anything that's linked to the words.

ie ****er, and the server automatically adds ******. Not difficult, but I'm not sharing. =D
Of course, there's a flaw with that too, but there'll always be a flaw in something so variable.
Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...