ID:264977
 
Code: Auto Muting after filtering
var
list
// Filters
profanity = list("") // Add words that should be filtered here
profanityfix = list("****","*****"," **** ","****"," *** "," ***** "," *** ","***********"," **** "," ****** ","*****","***"," **** ","*****","*****"," **** "," *** ","******","*******","****","*****","***hole","****"," **** ","****") // Add replacements to the filtered words

proc
wordfilter(m as text)
var/p
m = " " + copytext(m,1) + " "
// Profanity
if(profanity.len)
for(var/i=1,i<=profanity.len,i++)
p = findtext(m,profanity[i])
while(p)
m = copytext(m,1,p) + profanityfix[i] + copytext(m,p+length(profanity[i]))
p = findtext(m,profanity[i])
return m



mob/verb
Unmute()
usr.OOCMuted=0
usr.Warning=0

OOC(T as text)
if(WorldMuted){alert("World is muted!"); return}
if(src.OOCMuted){alert("You are OOC Muted!");return}
if(length(T)>349){var/diff=length(T)-349;alert("Your message is too long by [diff] characters"); src<<"[T]";return}//No one likes retyping a long message, give it back to them
if(!T){return}
for(var/mob/M in world)
if(src.Partner){M<<"<b>src:</b>[html_encode(T)]";return}
if(!M.OOCOn){return}
M<<"<b>[src]</font>:</b>[wordfilter(T)]"
if(findtext(T,profanityfix))
if(!src.Warning){usr.Warning+=1; alert("Please refrain from swearing. This is your only warning.");return}
if(src.Warning){world<<"<font color=red>Server Information</font>: [src] has been muted by Brian, The Assistant.";src.OOCMuted=1;src.Warning=0}
else
return


Problem description:
This is supposed to check for any word under the profanityfix var. As it shown here, it'll warn, then mute you no matter what you say(One at a time). I've been at this for a good 2 hours now and i feel i'm getting no where.

I've been away from BYOND for over a year and a half so i'm pretty rusty. Any help is appreciated.

Note: OOCMuted means muted from OOC and Emote as a punishment. Not for toggling.

Edit: removed the swear word list.
You... you didn't have to actually post your profanity list you know.
In response to LordAndrew
LordAndrew wrote:
You... you didn't have to actually post your profanity list you know.
In response to LordAndrew
LordAndrew wrote:
You... you didn't have to actually post your profanity list you know.

lmao sorry. it was for the varable. ill cut that part out of the post.
This forum used to be filled with people stumbling over their own feet to help someone back in 2008, what happened xD Lol
In response to Quiet Scream
Some people got a little bit smarter :D
In response to ExPixel
Not sure if i should consider this an unreliable source or not :P Definitely not fast. Lol
This is what you are doing:

client

verb

check_message()

var

message = "666"

list/combination = list( "123" , "345" )

if( findtext ( message , combination ) ) world << "Success."

else world << "Failure."


Try out this, you'll always get the same results.

Edit: It is a reliable source, but your error is such a young one.
client
proc
getSymbol(length as num)
var/T
for(var/i = 0,i < length,i++)
T += "*"
return T

getFilter(msg as text)
var/list/swears = list("[list of swears]")
for(var/swear in swears)
var
pos = findtext(msg,swear)
len = length(swear)-1
while(pos)
msg = copytext(msg,1,pos+1) + getSymbol(len) + copytext(msg,pos+len+1)
pos = findtext(msg,swear,pos+len)
return msg


This is an edit of another Language Filter. I can't remember where I got the original from, but instead of completely blocking out the word, it posts the first letter and a string of Asterisks behind it. So if you have "Mama" as a swear for some reason (Too many bad "Yo Mama" jokes?), in the string, "Yo mama so fat..." will output "Yo m*** so fat..." See what I did there?