How do I Make an Anti-Swear System?

0 favourites
  • 3 posts
From the Asset Store
Create complex dialogues with ease with this tool/template!
  • How do I make an Anti-Swear System (or A.S.S)? An project example can be even the chat room example, I wanna test if any word in the Textbox before the user send it and check if its a swear or not, heres what I did until now:

    My code simplified:

    Ajax Realtime database > (Swear words in .json) >>

    On Ajax(done) > Dictionary reads every single word and creates an single key for each one ---- [Works Totally Fine]


    I need to check in the text box as i said before, i already tried:

    On Function ("AbleTo") >

    System: findCase(lowercase(function.param(0)),dictionary.currentvalue x= 1)

    Dictionary: For each key

    >> (If not found return if a function that ables to send the message) [Don't work]

    Thank you!

  • You need to break the text into words and check each word separately. You can try something like this:

    Boolean swearWordFound
    Text variable s
    Set s to InputBox.text
    // first replacing spaces and other punctuation marks with commas ","
    Set s to replace(s, " ", ",")
    Set s to replace(s, ".", ",")
    Set s to replace(s, "!", ",")
    Set s to replace(s, "?", ",")
    // now checking each word 
    Repeat tokencount(s, ",")
    SwearWordsDictionary key tokenat(s, loopindex, ",") exists 
    .... Set swearWordFound = true
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oohhh It worked totally perfect! Thank you! Thank you so much! You are so intelligent! I think I could never do this! You saved my life <3! (Not literally I was not going to die)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)