The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

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.


Reply
 
Thread Tools
  #1    
Old May 17th, 2013, 06:29 PM
rigbycwts's Avatar
rigbycwts
Hmm, hmm.
 
Join Date: Mar 2013
Gender: Male
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 Cofagrigus, 
# 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
  #2    
Old May 20th, 2013, 04:14 AM
Nickalooose
--------------------
 
Join Date: Mar 2008
Gender: Female
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, 06:22 PM
rigbycwts's Avatar
rigbycwts
Hmm, hmm.
 
Join Date: Mar 2013
Gender: Male
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
Teddiursa
 
Join Date: Feb 2013
Location: Madison, Wisconsin, USA
Gender: Female
Nature: Gentle
Send a message via Yahoo to ISNorden
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 (Cofagrigus, 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

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
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 04:46 AM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.