badwordlist usage?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

bryanadams

badwordlist usage?

Postby bryanadams » 05 Jun 2012, 07:44

Hi,

what does it mean ?i, [ ,| \w, etc... could you explain ? there is no documents about badwordlist usage ?
i need details
please help

for exam,
(?i:bigass)
([b|B][\W]*[i|İ][\W]*[g|G][\W]*[a|A][\W]*[s|S][\W]*[s|S][\W]*)

thanks
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: badwordlist usage?

Postby Lapo » 05 Jun 2012, 14:58

It uses regular expressions, a standard "language" for matching any type of strings:
https://en.wikipedia.org/wiki/Regular_expression
Lapo
--
gotoAndPlay()
...addicted to flash games
bryanadams

Re: badwordlist usage?

Postby bryanadams » 05 Jun 2012, 17:33

thanks Lapo,
so i need only 1 word for filter when i add (?i:mother) to wordfilter sfs showing
motherboard like this "****board" or grandmother showing "grand*****" so i want to filter just "mother"
i mean
1. if user write "hi this is my mother" ---> "hi this is my *****" (filtered mother)
2. if user write "hi this is my motherboard" ---> "hi this is my motherboard" (dont filter mother in motherboard)
i need 2. examp


thanks
User avatar
gabrielvpy
Posts: 69
Joined: 23 Jul 2015, 20:18

Re: badwordlist usage?

Postby gabrielvpy » 18 Aug 2017, 15:46

Hi, has this issue been solved? I'm struggling with the same issue.
We made an awesome GPS - MOBA.
Try it out here: Get Fhacktions
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: badwordlist usage?

Postby Lapo » 18 Aug 2017, 15:54

It all depends on the regular expression you use to filter words. The regexp above searches for the exact word but you can use any type of expressions that can include or exclude extra characters, prefixes, etc...

I am not a regexp expert so you may need to experiment a bit or google a regular expression guide.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
gabrielvpy
Posts: 69
Joined: 23 Jul 2015, 20:18

Re: badwordlist usage?

Postby gabrielvpy » 18 Aug 2017, 16:25

Honestly I was just being lazy. All you need to do is to surround the word with \b. God bless google and stackoverflow.
We made an awesome GPS - MOBA.
Try it out here: Get Fhacktions
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: badwordlist usage?

Postby Lapo » 18 Aug 2017, 19:09

gabrielvpy wrote:Honestly I was just being lazy. All you need to do is to surround the word with \b. God bless google and stackoverflow.

:mrgreen:
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
gabrielvpy
Posts: 69
Joined: 23 Jul 2015, 20:18

Re: badwordlist usage?

Postby gabrielvpy » 18 Aug 2017, 21:23

Lapo, I have another question. In our game you have your faction, so we create a room for every faction called "chat_faction_name" in order for faction members to chat with each other. The sole purpose of said room is for it to be their chat room. The issue we are facing now is that you can't create a room using a bad word as it's name. When I say a bad word of course I mean a word listed in the wordsFile.txt file. Wich is fine, you shouldn't name your faction wiht a bad word in the first place. So how can I use the wordsFile.txt within my extension for me to prevent my player to use any bad word listed there as their faction name?
We made an awesome GPS - MOBA.
Try it out here: Get Fhacktions
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: badwordlist usage?

Postby Lapo » 19 Aug 2017, 08:33

You can use something like this in your Extension code:

Code: Select all

IWordFilter wordFilter = currentZone.getWordFilter();

if (wordFilter.isActive() && wordFilter.getFilterMode() == WordsFilterMode.BLACK_LIST)
{
   FilteredMessage filteredName = wordFilter.apply(factionName);

   if (filteredName.getOccurrences() > 0)
      throw new RuntimeException("Faction name contains bad words");
      
   // Faction name is clean... proceed...
}

where currentZone is a reference to the app's zone.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
gabrielvpy
Posts: 69
Joined: 23 Jul 2015, 20:18

Re: badwordlist usage?

Postby gabrielvpy » 21 Aug 2017, 12:23

thanks!
We made an awesome GPS - MOBA.
Try it out here: Get Fhacktions

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 54 guests