ID:1540027
 
ok this is what I'm trying to do.


I know about how to make a word filter

if you do a list but, I don't want to have to update list every-time if I wan't add a new word.



is their a way to make it so I can add words to a ini or txt file and it reads from their and if its in the txt file it filters it.

if so how do I go about this.

EDIT: I found a web ban in dev, by Ss4toby

I was wondering I I can use this and change it a little for world filtering or not.


Well, the Web Ban system could possibly be altered to integrate a filtering system, however that would only be idea if you want to block words through-out all worlds, and would be somewhat overly complicated (because pulling information from the web is somewhat cumbersome and laggy).

Honestly, there isn't a very effective way to censor a chat system without running a risk of CPU being used too much.

I don't entirely understand why you wouldn't want to use a list? The only reason I could think of, was using a list would be problematic when desiring to make alterations to the stored information. However, using params2list() alleviates that problem.

var/list/badWords=list("ass"="***","fuck"="****","shit"="****")

proc
loadWorldInfo()
var/savefile/S=new("WorldInfo.sav")
if("badWords" in S)
S["badWords"]>>badWords

saveWorldInfo()
var/savefile/S=new("WorldInfo.sav")
S["badWords"]<<badWords

mob/verb/Say(t as text)
for(var/word in badWords)
set background=1
var/spot=findtext(t,word)
while(spot)
t=copytext(t,1,spot)+badWords[word]+copytext(t,spot+length(word),length(t)+1)
spot=findtext(t,word)
world<<t

mob/verb/Add_Bad_Word(t as text)
var/list/l = params2list(t)
for(var/word in l)
set background=1
var/censor=""
for(var/n=1 to length(word))
set background=1
censor+="*"
l[word]=censor
badWords|=l

mob/verb/Alter_Bad_Words()
var/tx=""
for(var/word in badWords)
set background=1
tx+="[word]=[badWords[word]];"
var/i=input("Alter the bad words.","Bad Words:",tx) as null|message
if(i==null)
return
badWords=params2list(i)

world/New()
loadWorldInfo()
..()

world/Del()
saveWorldInfo()
..()



As stated above, I'm not too sure there is a more efficient way to create a censoring system. If there is, I hope another BYONDer suggests it, because I am obviously coming up short.
reason I don't want a list and a html file is cause I'm not going to be on the game all the time to add more words like your addword verb does, and I don't want recompile every-time I think of a new word

and this way I can grab a giant list of profanity words etc and tada that's my block list.


I'm not wanting it to change the words, I just want it to detect to see if word is in the message and if it is it wont send the message at all.
You can use an online version then:
use world.Export() to poll a webpage for new words every 5 - 10 minutes and automatically add new words to the list.

You would want to keep a last updated timestamp to avoid extra work if you do that.