Hey, I was wondering if there is a way to block out swearing on my game. I have it so if they swear the message does not send but then sometimes the word might be mistyped and it will send it out with the swear word. I have seen in some games before that when someone says the F word it says (the persons name) says: ****
is there a way to do that? I dont know how to so if someone can help me with it...Thanks
1
2
But i want to add in stars, so if someone says: fuck you. it will say (usr) says: **** you. I dont want them to be totally stopped from swearing just i want it to be...censored i guess
|
You can include a library (or create) that contains a replace function.
One such is Forum account's Text. The value you'd create the replacement from would be by using a function like the following: proc/replicate(amount = 1, char = "*") //pass the length and the replacement value here. |
OK cool, I will try it. but for the length and replacement, i would just add a list of words right? that should be censored or something else? Thanks
|
You will need to make your own function.
For example (ugh, I should have used that replicate function Pirion showed. Oh well): var/list/Curses = list("ass" = "butt","damn") Note that words like "assessment" will become something unusual like "buttssessment" so you will have to think about what you add and how to overcome these issues If you have an alternative for each word, we can cut things down: var/list/Curses = list("ass" = "butt","damn" = "dang") For maybe replace it with different symbols... well, write one or just use Theodis' LanguageFilter for that *shrug* //With LanguageFilter |
Oh yes thank you, Using the guide you had shown me before, I think i can find a way to make an alternative, i will use whole cuss words and fragments, if it is a fragment say like fu, it would show up in a word like..wondferful but using the guide you showed me i can make it so if it is only whole cuss words it will censor.
|
In response to Naruto 5292
|
|
That's from Forum account's Text which Pirion linked to earlier.
|
Yes, I would advise that you either include/check-off that library to your project or make a note of where you got the function if you do copy it.
Just remember credit that library source appropriately; a little recognition uplifts the developers' heart. |
Oh yes, I will be thanking the creator of that file within my game and tell him on byond pager.
|
but im not fully certain can u paste it like here i should put it or something also if you could show me what you meant by putting in Pirion's code for replace
|
I Wanna Do Something Similar To What Naruto Originally Wanted, But I Can't Figure Out How To Define Replace From This Conversation, Can Someone Explain In Detail? msg = replace(msg, profane, rep)
|
I have the code, i used this for a while but then i made a version from another piece of code I had. It's pretty useless because people always find a way to block the code like adding dots int between or space which would be very tedious for you to code in but i can send you the code later today if you want.
|
Language filters tend to be very iffy. If you replace on partial word matches, that works for the F word which doesn't show up in other words except forms of itself, but pretty much any other swear word is part of another innocuous word. And players soon get creative working around the filter. There is no ideal solution.
|
1
2
http://www.byond.com/developer/Theodis/LanguageFilter