mob/verb/worldsay(msg as text)
if(usr.muted>= 1)
usr <<"You are muted!"
else
for(var/mob/M in world)
if(M.worldsay == 1)
M<<"\icon[usr]\<[usr] wsays:\>[Safe_Guard(SGS_Filter_txt(msg))]"
all it will do is </<b>
ID:148840
![]() Sep 10 2002, 1:40 pm
|
|
//Filter system 1.2
var/list/Words = new/list var/SGS_filteron = 1 proc/FilterString(msg as text) return msg proc/SGS_Filter_txt(txt) set background = 1 var/stars var/s_amount var/mem var/find_t var/txtLen var/textmem = txt txt = FilterString(txt) if(txt!=textmem) SGS_filteron = 0 if(SGS_filteron == 1) 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 |
I don't see your error in there, but I can help fix some bad program flow and some attendant errors with it:
if(Words.len) This is a bad way to use goto, and it's causing the whole loop to repeat. What you need is a loop within a loop: One to go through each cuss word, and one to check for each occurrance of it. Another problem, and possibly the cause of the null output, is that by setting stars to null, when you add to it nothing is happening. (However, your code doesn't list the Safe_Guard proc, which is probably the real culprit.) Here's how this part of the code should look instead: for(var/cussword in Words) This is sort of a poor-man's language filter, in that it will detect cuss words that are part of other words. Only a select few (like the F word, which appears legitimately in no other English word that I'm aware of) deserve that treatment. A good idea would be to check the characters before and after the word where you found it, to see if you have a whole word. My language filter uses two word lists: One of words to catch anywhere they're found, and one of words to catch only if they're found whole. Lummox JR |
I can only assume that it means your Safe_Guard() proc isn't returning anything. If it doesn't return anything, that means it returns null, so your message turns to null, which means there is no message. If you want us to fix something still, post the Safe_Guard() proc here instead.