//starts argumentsvar fstring, caps, offensive, filtered;fstring=argument0//creates list of offensive wordsoffensive = ds_list_create()This is where the offensive words are added.Example: ds_list_add(offensive,"wth")Add as many as you want.To see my list and save some time, click here.Save other people some time and your words there!//save capital positionscaps=ds_list_create()global.caps = capsfor(p=1; p<=string_length(k); p+=1){if string_char_at(fstring,p)=string_letters(string_upper(string_char_at(fstring,p)))ds_list_add(caps,p)}//save symbol positionssymbpos=ds_list_create()global.symbpos = symbpossymb=ds_list_create()global.symb = symbfor(p=1; p<=string_length(fstring); p+=1){if string_char_at(fstring,p)!=string_letters(string_char_at(fstring,p)){ds_list_add(symb,string_char_at(fstring,p))ds_list_add(symbpos,p)}}//replaces symbols with possible letter counterpartsfstring=string_replace_all(fstring,'1','i')fstring=string_replace_all(fstring,'!','i')fstring=string_replace_all(fstring,'3','e')fstring=string_replace_all(fstring,'5','s')fstring=string_replace_all(fstring,'8','b')fstring=string_replace_all(fstring,'0','o')fstring=string_replace_all(fstring,'()','o')fstring=string_replace_all(fstring,'@','a')fstring=string_replace_all(fstring,'$','s')fstring=string_replace_all(fstring,'z','s')//make string lowercasefstring = string_lower(fstring)//stars out bad wordsvar star;star=''for(ds=0; ds<ds_list_size(offensive); ds+=1){star=''//generates string of correct number of starsfor(a=0; a<string_length(ds_list_find_value(offensive,ds)); a+=1)star+='*'fstring = string_replace_all(fstring,ds_list_find_value(offensive,ds),star)}//puts stars the original string with numbers and symbolsfor(l=1; l<=string_length(fstring)+1; l+=1){if string_char_at(fstring,l)='*'{filtered = string_delete(filtered,l,1)filtered = string_insert('*',filtered,l)}}//returns a filtered stringreturn filteredI'm pretty sure that counts as content.Go filter your games!Hey! Add words to the list here!EDIT: God is included because I don't want people going "God Damnit" every where. Which IS offensive to me because I AM a Christian!
STOP THE FLAMES!And Arc, WHY does my filtering fail?
How To Filter A String
Posted by Siert on July 15, 2008, 9:26 p.m.
DT, note also his point on your complaining. And use google instead of asking people for definitions to things like regex
That being said, today Bryan said ^^ :) and now eagly is saying ;) :pIt seems people have begun to use chains of emoconsAlso God Damnit would be caught by your filter because it catches DamnitFor the 4th time, Siert. Use Regex. that's why it fails. You don't use regex.
Since Arc isn't giving you a link for GMregex, I'll supply you
That being said, this is blasting up the wrong place. No matter how strong your censor system is clientside, it will fail. This is because…The censoring can be skipped through direct uploadThe censoring can be disabled through source editTherefore, you'll instead have to make an HTTP method of uploading that requires the interface be through a serverside censor layer. Without such modifications, your security is nullIgnore the server side, if someone really hacks your game so he/she can swear, he/she must be a fucking no-lifer and you can laugh at him/her and ban.