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

Better (IMO) Word Filter


balliztik1
 Share

Recommended Posts

I didn't like how Eclipse's word filter just changed the word to asterisks, so I changed it a bit to allow replacement words, like on the forums.

(All edits are server-side.)

Find _modTypes_. Paste this in there somewhere.
```
Type Wordfilterblah
    Word As String
    replacement As String
End Type

Public Wordfilter() As Wordfilterblah
```
Now find this:
```
Public Spritesize As Byte
```
And paste this under it:
```
Public MAX_WORDS As Integer
```
In _ModGeneral_ find these lines:

```
    MAX_SCRIPTSPELLS = GetVar(App.Path & "\Data.ini", "MAX", "MAX_SCRIPTSPELLS")
    Paperdoll = GetVar(App.Path & "\Data.ini", "CONFIG", "PaperDoll")
    Spritesize = GetVar(App.Path & "\Data.ini", "CONFIG", "SpriteSize")
```
Under them, paste this:
```
    MAX_WORDS = GetVar(App.Path & "\wordfilter.ini", "wordfilter", "maxwords")
```
Slightly below that, find this:
```
    On Error GoTo 0
```
Under it, add this:
```
    ReDim Wordfilter(1 To MAX_WORDS) As Wordfilterblah
```
Now, in _modGameLogic_ change _Public Sub LoadWordFilter_ and _Public Function SwearCheck_ to these:

```
'ASGARD
Public Sub LoadWordFilter()
    Dim I
    If FileExist("wordfilter.ini") Then
        WordList = Val(GetVar(App.Path & "\wordfilter.ini", "WORDFILTER", "maxwords"))
        If WordList >= 1 Then
            For I = 1 To WordList
                Wordfilter(I).Word = LCase(GetVar(App.Path & "\wordfilter.ini", CStr(I), "word"))
                Wordfilter(I).replacement = GetVar(App.Path & "\wordfilter.ini", CStr(I), "replacement")
            Next I
        End If
    Else
        Call MsgBox("Wordfilter.INI could not be found. Please make sure it exists.")
        WordList = 0
    End If

   On Error GoTo 0
   Exit Sub
End Sub

Public Function SwearCheck(TextToSay As String) As String
    Dim I As Integer
    SwearCheck = TextToSay
    If WordList <= 0 Then Exit Function
    For I = 1 To WordList
        SwearCheck = Replace$(SwearCheck, Wordfilter(I).Word, Wordfilter(I).replacement, 1, -1, vbTextCompare)
    Next I
End Function
```
That should be everything. Now, you just have to set up the new wordfilter.ini. Here's an example:

```
[WORDFILTER]
maxwords = 5
[1]
word = Gray-fox
replacement = The Foxxxy
[2]
word = screw
replacement = hammer
[3]
word = cough
replacement = hacks up a hairball and throws it at the nearest person
[4]
word = aim
replacement = monkey in a cardboard box
[5]
word = unnown
replacement = unnownzorzorzorzorzorzor

```
This would create something like the forum filters. Just change _maxwords_, and add more numbers until you have all you need.
Link to comment
Share on other sites

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...