ID:175281
May 13 2003, 3:45 pm
|
|
I want to make something that stops naughty language. but finttext thing doesn't work, any ideas?
|
In response to Foomer
|
|
I use that in my game...but its a pain in the but because you have to put in all different kinds of capitilization. Say fafa was a curse, you'd have to put fafa, Fafa, fAfa..ect....well I do at least...does anybody know a better way to do it?
|
In response to SSChicken
|
|
findtext() isn't case sensitive, findText() is.
|
In response to Nadrew
|
|
findtext doesn't work for some reason, I try it, It either doesn't plain work or your only able to say the certain word.
|
In response to Buzzyboy
|
|
You have to actually make your own proc to replace the proc, findtext() just returns 1 if the word is found, and 0 if it's not.
|
In response to Nadrew
|
|
Nadrew wrote:
findtext() just returns 1 if the word is found Since when? |
In response to Nadrew
|
|
Ahh, that clears up a lot. Thank you.
|
In response to Nadrew
|
|
Tsk tsk... http://www.byond.com/docs/ref/info.html#/proc/findtext
Notice the line where it says, "Returns: The position of T2 in T1; 0 if not found." |
In response to OneFishDown
|
|
If used in a conditional, but if used as a variable it returns where a word starts and ends.
|
In response to Buzzyboy
|
|
It has always worked just fine for me, except on that one recent occasion where I was inputting the arguments backwards :P
Try something like this: <code>var/list/cusswords = list("fafa") proc/LanguageGuard(message) for(var/word in cusswords) if(findtext(message, word)) return 1 return 0</code> That will return 1 if a cussword is found, and 0 if the message is clean. From there, the simplest thing to do is not show the message if it contains dirty language. Like this: <code>mob/verb/say(message as text) if(LanguageGuard(message)) usr << "[usr]: [message]" return world << "[usr]: [message]"</code> Its like a silent mute, if cuss words are found in it, it only shows the message to the player as if they said it. If the message is clean, it shows it to everyone. People usually don't try to find ways around it because they aren't aware that their message isn't being heard. |
In response to Foomer
|
|
Foomer wrote:
<code>mob/verb/say(message as text) > if(LanguageGuard(message)) > usr << "[usr]: [message]" > world << "[usr]: [message]"</code> That will always output something to the world, you forgot to put return in the if(). |
In response to Nadrew
|
|
Well that's what you get for responding before I have a chance to finish editing my message. :P
|
In response to Foomer
|
|
You're just too slow for me.
|
In response to Nadrew
|
|
I'm telling you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Findtext doesn't work!!!!
|
In response to Hanns
|
|
Works fine for me, are you sure you're using it right?
|
In response to Nadrew
|
|
If used in an if then the condition may evaluate to true, but the return value is the same.
|
The best solution is always to have a moderator or half a dozen hanging around. Works for Chatters.