mob/verb/Say(msg as text)
if(!msg)
return
if(msg == "fuck")
msg = "****"
world <<"[usr]: [msg]"
else
world <<"[usr]: [msg]"
It works.So when i say fuck it works,BUT when i put another word in it besides fuc*k.It doesn't work.Thanks!
-Non-PC
ID:261449
![]() Apr 2 2002, 2:29 pm
|
|
PLease help me fix this code:
mob/verb/Say(msg as text) It works.So when i say fuck it works,BUT when i put another word in it besides fuc*k.It doesn't work.Thanks! -Non-PC |
Kappa the Imp wrote:
Non-PC wrote: > > mob/verb/Say(msg as text) It works.So when i say fuck it works,BUT when i put another word in it besides fuc*k.It doesn't work.Thanks! No,no,no try putting a word after it. -Non-PC |
Non-PC wrote:
Kappa the Imp wrote: > > > mob/verb/Say(msg as text) It works.So when i say fuck it works,BUT when i put another word in it besides fuc*k.It doesn't work.Thanks! Oh,I see.Sorry,I don't know how to fix that. Good Luck Getting Help! -Kappa the Imp |
//Filter system 1.0
proc/SGS_Filter_txt(txt) var/stars var/s_amount var/mem var/find_t var/txtLen var/Words[] Words = new /list/ Words = list("fuck","shit","jerk","bitch")//you can add words here to filter if(Words.len) memo: for(mem = 1,mem < Words.len + 1,mem++) find_t = findtext(txt,Words[mem]) if(find_t) txtLen = length(Words[mem]) stars = null s_amount = null for(s_amount = 0,s_amount < txtLen,s_amount++) stars += "*" txt = copytext(txt,1,find_t) + stars + copytext(txt,find_t+txtLen,0) if(findtext(txt,Words[mem])) goto memo return txt |
Justin Sun wrote:
//Filter system 1.0 Nope.I don't want to use a proc in my say verb.I want MY code fixed because its the shortest way I think off to code it. -Non-PC |
You could add all the words into one list and check it against that
var/list/wordlist = list("Word1","Word2",Word3") |
I recommend you take a look at the code in my last Dream Tutor column for BYONDscape. Included in there is a very reasonable language filter that should fit your needs.
Lummox JR |
Nadrew wrote:
You could add all the words into one list and check it against that > var/list/wordlist = list("Word1","Word2",Word3") Nope.If you type a text after it(a word)it doesn't work. -Non-PC |
??????????Whats wrong with this code?:
var/list/wordlist = list("Word1","Word2","Word3") Now,everything I say comes out as stars. -Non-PC |
Let me get some sleep and I'll get back to you. (For all of you that don't know I sleep during the day now)
|
Non-PC wrote:
??????????Whats wrong with this code?: var/list/wordlist = list("Word1","Word2","Word3") Now,everything I say comes out as stars. That's because you're replacing the entire string, instead of just the offending part of it. But also, you're using wordlist.Find() wrong. You need to loop through every word in the list, like this: mob/verb/Say(T as text) This works now, but it's a very very poor swear filter. For one thing, it won't recognize whole words, so you could end up with problems like this: Goofball128: I don't mean to h@#$%&!le you, but could you p@#$%&! the salt? Crackpot: You have to say the p@#$%&!word first. Of course the F word is fine to recognize this way, because it doesn't occur naturally in other English words. My recent Dream Tutor column has more on this subject, including working code for a good language filter. Lummox JR |
Worked fine when I tested it.
-Kappa the Imp