Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old May 17th, 2013 (6:29 PM).
rigbycwts's Avatar
rigbycwts rigbycwts is offline
Hmm, hmm.
     
    Join Date: Mar 2013
    Gender: Male
    Nature: Timid
    Posts: 98
    After messing around with Ruby, I managed to create a word filter for Essentials games.

    1. Add the following lines at the end of Settings.
    Code:
    #===============================================================================
    # Here is the array of censored words.
    # Enclose words in quotes.
    #===============================================================================
    CENSORED_WORDS = []
    Note that the words must be enclosed in quotes.
    Type down the words to be censored inside the brackets.

    2. Create a new script section, name it PokemonWordFilter and add the following:
    Code:
    #===============================================================================
    # Word Filter
    # By rigbycwts
    #
    # Note:
    # Starting on Gen 5, the main series games have a built-in word filter.
    # The censor only prevents inputs in which exactly match the keyword. 
    # However, previously, when trying to trade a Pokémon on the GTS, 
    # the keyword only had to be contained in the name. This caused problems with 
    # Pokémon whose names contained the keyword, such as Cohagrigus, 
    # preventing them from being traded without nicknames, 
    # so the filter was eventually removed. 
    #
    # However, the filter still prevents some Pokémon from being traded, 
    # such as Nosepass.
    #
    # Algorithm:
    # 1. Checks input text, creates a copy of it and converts it to uppercase.
    # 2. If input text contains or matches the filtered word, 
    #    it does not process the text, and returns to the text input screen.
    # 3. If input text does not contain or match the filtered word,
    #    the usual processing happens.
    #===============================================================================
    
    # Separate filters for Pokemon names, PC Boxes, Player names and Mail messages
    
    # For Pokemon Names: Aside from the restriction above, a Pokemon can't be nicknamed
    # with the name of another Pokemon. Example: You can't name a Typhlosion "Charizard."
    def CheckPokemonNickname(nickname)
      nicknameCopy=nickname.upcase
      for i in 0...CENSORED_WORDS.length
        # Exact match
        if nicknameCopy=~CENSORED_WORDS[i]
          return true
        end
      end
      # Not a censored word.
      return false
    end
    3. Then find pbEnterText (Line 1482) in PokemonTextEntry, and replace those lines of code with the following:
    Code:
    def pbEnterText(helptext,minlength,maxlength,initialText="")
      ret=""
      if USEKEYBOARDTEXTENTRY
        pbFadeOutIn(99999){
           sscene=PokemonEntryScene.new
           sscreen=PokemonEntry.new(sscene)
           ret=sscreen.pbStartScreen(helptext,minlength,maxlength,initialText)
        }
      else
        pbFadeOutIn(99999){
           sscene=PokemonEntryScene2.new
           sscreen=PokemonEntry.new(sscene)
           ret=sscreen.pbStartScreen(helptext,minlength,maxlength,initialText)
        }
      end
      # Insert word filter here.
      # If maxlength is 10, apply Pokemon nickname filter.
      if (maxlength == 10)
        if CheckPokemonNickname(ret)
          Kernel.pbMessage(_INTL("You can't use an inappropriate name for your Pokemon!"))
          ret=initialText
          pbEnterText(helptext,minlength,maxlength,initialText)
        else
          return ret
        end
      end
      # If maxlength is 7, apply player name filter.
      
      # Filter bypassed.
      else
        return ret
    end
    If there are missing things, please let me know. Not all things like making it unable to nickname a Pokemon the name of another Pokemon (e.g. giving the name "Typhlosion" to a Charizard) are implemented.
    Reply With Quote

    Relevant Advertising!

      #2    
    Old May 20th, 2013 (4:14 AM).
    Nickalooose Nickalooose is offline
    --------------------
       
      Join Date: Mar 2008
      Gender: Female
      Posts: 1,309
      Good idea, but since online battles and trading don't exist... There is no point to it... If someone wants to give their Pokemon a disgusting name, that's up to them... You probably could've made this simpler by edit pbEnterText, and using that CENSOREDWORDS filter within that, but nice script anyway
      Reply With Quote
        #3    
      Old May 20th, 2013 (6:22 PM).
      rigbycwts's Avatar
      rigbycwts rigbycwts is offline
      Hmm, hmm.
         
        Join Date: Mar 2013
        Gender: Male
        Nature: Timid
        Posts: 98
        Quote:
        Originally Posted by Nickalooose View Post
        Good idea, but since online battles and trading don't exist... There is no point to it... If someone wants to give their Pokemon a disgusting name, that's up to them... You probably could've made this simpler by edit pbEnterText, and using that CENSOREDWORDS filter within that, but nice script anyway
        That could come in handy if someone (myself included) wants a GTS for their games. Just in case.
        Reply With Quote
          #4    
        Old May 31st, 2013 (11:30 PM).
        ISNorden's Avatar
        ISNorden ISNorden is offline
        Teddiursa
           
          Join Date: Feb 2013
          Location: Madison, Wisconsin, USA
          Gender: Female
          Nature: Gentle
          Posts: 156
          It's a shame that the banned-names filter can't include some kind of "whitelist/valid exceptions" code; I've seen this technique used on Wikipedia, where the filter of banned username strings is paired with a whitelist of acceptable words that would otherwise be blocked. If the scripting language permits it, then designating the problem species names (Cohagrigus, Probopass, and Nosepass) as exceptions should end the GTS rejections.
          __________________
          ========================

          Ingeborg S. Nordén

          " Coming this fall to Jubilife TV: Lost Beyond Space!"
          Reply With Quote
          Reply

          Quick Reply

          Join the conversation!

          Create an account to post a reply in this thread, participate in other discussions, and more!

          Create a PokéCommunity Account

          Sponsored Links
          Thread Tools

          Posting Rules
          You may not post new threads
          You may not post replies
          You may not post attachments
          You may not edit your posts

          BB code is On
          Smilies are On
          [IMG] code is On
          HTML code is Off

          Forum Jump


          All times are GMT -8. The time now is 4:02 AM.