The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX Ace => VXA Scripts Database => Topic started by: SoulPour777 on February 10, 2014, 03:24:10 PM

Title: Soul Engine Ace - Actor Banned Names
Post by: SoulPour777 on February 10, 2014, 03:24:10 PM
Soul Engine Ace - Actor Banned Names
Version: 2.0
Author: Soulpour777
Date: February 10, 2014

Version History



Description


This script allows you to create a list of Banned Names or Words that allows you to create different effects when a banned word is being entered by the player.

Features


Instructions

Script Calls:
 
is_actor_banned?(actor_id)
^ check if the actor’s name is banned. e.g. is_actor_banned?(1)
if you wish to print it out on the console, do a script call: p is_actor_banned?(1)
 
banned_word?(actor_id, banned_names)
^ use this script call to check if the actor’s name is the specific word.
eg: banned_word?(1, 'Eric')
if you wish to print it out on the console, do a script call: p banned_word?(1, 'Eric')
 
Script Calls Added in Version 2:
 
$game_system.add_ban_name(name) - Adds a name into the current banned names list.


Script


Code: [Select]
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# SEA - Banned Names
# By: Soulpour777
# Version 2.0
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Version 1 - Only allows in script names.
# Version 2 - Allows in game and in script names
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Description: This script allows you to create a list of Banned Names or Words
# that allows you to create different effects when a banned word is being
# entered by the player.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Examples:
# 1. Scene Name
# Say for example you are to let the player rename your character and the name
# being entered is banned, you can have this script check that so you can then
# have the player re-enter another name that is not inside the banned names
# list.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is under Actors / Characters Related Script.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Script Calls:
#
# Adding A Name:
# $game_system.add_ban_name(name)
# E.g. $game_system.add_ban_name("Eric")
#
# Check if Actor's name is banned:
# is_actor_banned?(actor_id)
# ^ check if the actor's name is banned. e.g. is_actor_banned?(1)
# if you wish to print it out on the console, do a script call: p is_actor_banned?(1)
#
# Check if Actor's Name is Banned with Specific Name
# banned_word?(actor_id, banned_names)
# ^ use this script call to check if the actor's name is the specific word.
# eg: banned_word?(1, 'Eric')
# if you wish to print it out on the console, do a script call: p banned_word?(1, 'Eric')
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

module BannedNames
  BannedNamesList = ["Eric", "Joan"]
end

class Game_System
 
    attr_accessor :curr_banned_names
   
    alias gamesystem_init initialize
    def initialize
      gamesystem_init
      assign_names
    end   
   
    def add_ban_name(name)
      @curr_banned_names.push(name)
    end
   
    def assign_names
      @curr_banned_names = BannedNames::BannedNamesList
    end

end

class Game_Interpreter
  def is_actor_banned?(actor_id)
    for banned_names in $game_system.curr_banned_names
      if banned_names.upcase == $game_actors[actor_id].name.upcase
        $game_switches[BannedNames::SwitchForBannedNames] = true
        return true
      else
        return false
      end
    end
  end
 
  def banned_word?(actor_id, banned_names)
    if banned_names.upcase == $game_actors[actor_id].name.upcase
      $game_switches[BannedNames::SwitchForBannedNames] = true
      return true
    end
    return false
  end
 
end



Credit




Support


For any questions, suggestions or comments about this script, please don't hesitate to comment below or PM me here at RMRK. Please be informed that this script is included on Soul Engine Ace, Soulpour777 (me)'s small project, and some of these works as one.

Known Compatibility Issues

- None at the moment


Author's Notes


Sometimes there are names you can't stand...so you ban them.

Terms of Use


All Soul Engine Ace scripts are bound under my terms of use. if any terms of use in RMRK is not located on my terms of use, do remember to add those terms.
Title: Re: Soul Engine Ace - Actor Banned Names
Post by: Zylos on February 10, 2014, 03:30:32 PM
Haha. Strangely enough, I can see this script being useful. The grown-up players tend to be more childish at times than actual children are.
Title: Re: Soul Engine Ace - Actor Banned Names
Post by: SoulPour777 on February 10, 2014, 03:36:28 PM
Haha. Strangely enough, I can see this script being useful. The grown-up players tend to be more childish at times than actual children are.

Thanks! I just am somehow bothered how people name their actors, so to give justice... well xD
Title: Re: Soul Engine Ace - Actor Banned Names
Post by: Acolyte on February 10, 2014, 11:50:58 PM
I don't really agree with censoring players this way, but I'm sure other people will find it useful.
Title: Re: Soul Engine Ace - Actor Banned Names
Post by: Rave on March 02, 2014, 06:45:01 PM
I could replicate most of this using regular events, however there's one option that I wouldn't be able to do with events, would be of use to me and isn't in the script. More like two options actually, but second is kinda addition.

First one is that to check if name of actor CONTAINS banned word (both for specific word and for any banned word)
E.g. contains_banned_word?(1, 'Eric') would return true for both Eric and Not Eric.

Now, for the addition thing: It would be cool if you add optional parameter to ignore letter case, so I (or anyone else) won't need to include every possible case of e.g. shit (Shit, shit, SHIT, sHit, shiT, etc.) or any other bad word.
Title: Re: Soul Engine Ace - Actor Banned Names
Post by: amerk on March 07, 2014, 04:04:28 PM
I don't really agree with censoring players this way, but I'm sure other people will find it useful.

Agreed. And unless there is an instance of catching every spelling and creative acronym, it'll just make players get more creative.

Now, for the addition thing: It would be cool if you add optional parameter to ignore letter case, so I (or anyone else) won't need to include every possible case of e.g. shit (Shit, shit, SHIT, sHit, shiT, etc.) or any other bad word.

Not to mention the creative spellings of the same word:

$hit, S.H.I.T., shhhit...
Title: Re: Soul Engine Ace - Actor Banned Names
Post by: pacdiggity on March 08, 2014, 03:30:00 PM
Now, for the addition thing: It would be cool if you add optional parameter to ignore letter case, so I (or anyone else) won't need to include every possible case of e.g. shit (Shit, shit, SHIT, sHit, shiT, etc.) or any other bad word.

Looking at the code, it looks like this is already implemented.
Code: [Select]
    if banned_names.upcase == $game_actors[actor_id].name.upcase
This line implies case insensitivity; it checks if the inputted name converted to entirely uppercase is the same as any of the banned names converted to uppercase.
If it's operating with case sensitivity then there's something funky going on.

Not to mention the creative spellings of the same word:

$hit, S.H.I.T., shhhit...

Yeah, the best way to check for that kind of stuff I can think of is through relatively complex regular expressions, which just scare the hell out of people who are unfamiliar with them. Unless you want to come up with something like
Code: [Select]
/([s$])+([ _.,])*h+([ _.,])*[i1!]+([ _.,])*[t4]+([ _.,])*/i
for each word you want to ban, it's just not gonna happen. The particularly grouse players will always find a loophole, anyway. If you don't want to have your players walking around with uncouth names, you're going to have to either use a script like this to do as much as you can to prevent it, or just not allow players the freedom of naming characters.