ID:147305
 
proc
wordfilter(m as text)
var/p
m = " " + copytext(m,1) + " "
// Goodity
if(goodity.len)
for(var/i=1,i<=goodity.len,i++)
p = findtext(m,goodity[i])
while(p)
usr.fs+=1
// Profanity
if(profanity.len)
for(var/i=1,i<=profanity.len,i++)
p = findtext(m,profanity[i])
while(p)
usr.fs-=1
return m


What happens is, when you say a word in the good list, your 'fs' goes up, and it goes down when you say a word from the bad list. When I do this, heres the runtime I get:

Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.
proc name: wordfilter (/proc/wordfilter)
usr: FireEmblem (/mob)
src: null
call stack:
wordfilter(" Hi Friend Goodity ")
FireEmblem (/mob): Ask Question()

Anybody think they can help me with this? Thanks!
Don't put usr in procs.
In response to Garthor
Gah! I'm getting sick of you saying that! With src its a syntax, and in most cases, usr works just fine!
In response to FireEmblem
Exactly: MOST cases. And in the cases it DOESN'T work fine, it's near-impossible to track down, and when you do, you'll have to remove usr ANYWAY.

And I refuse to help anyone who is still making the glaring error of using usr in procs.
If p isn't null, the while(p) loop will never stop, because it isn't changing p in any way. Try while(findtext(m,goodity[i])) in it's place.
In response to FireEmblem
usr works just fine!

usr is plain bad and should be avoided whenever possible since it makes the proc/verb call stack dependant and will lead to hard to track errors that probably won't crop up until you try to play the game multiplayer. You shouldn't be telling people it's ok to use usr and people should be told that using usr is bad so hopefully they'll make an effort to do things in a more proper way.
In response to Hazman
That...didn't work.