#-----------------------------------
# Typing Quirks Extension of Advanced Message Script
# By shinyJiggly/lavendersiren
#-----------------------------------
# -what the hell is a typing quirk:-
# A typing quirk is a signature style of typing.  Using some in your game 
# can add a sense of flavor and personality to your characters. 
# However, it  can be quite easy to go overboard and make their text
# embarrassingly tacky or near-unreadable. Please use responsibly.
#
# With this script, you can apply pre-made or custom made styles to any message, 
# without having to go through the trouble of baking them into the message 
# manually. This allows for easier message editing by allowing the writer to 
# write in a standardized style and then apply the proper quirk automatically.
#
# Terms of use: Can be used in any project, commercial or noncommercial
# as long as lavendersiren is credited. They are not responsible for any trouble 
# you may get into with Viz Media and/or Andrew Hussie if you decide to make a 
# Homestuck related fangame.
#
# How to install:
# Put it somewhere under Advanced Message Script but still above main.
#
# How to use:
# Change the in-game variable associated with it to whichever quirk value you 
# wish to be active. This is set to variable 2 by default.
#
# Example:
#--------------------------------------------
# @>Control Variables: [0015: quirk] = 1
# @>Text: blablablabla
# -------------------------------------------
# With quirk 1 set to replace all lowercase a's with 4's, 
# @now_text.gsub!(/A/) { "4" } <== like that,
#
# the text will look like this in game:
# "bl4bl4bl4"
#
# Important note! \c style color codes do not work well here!!
# with some RegEx magic, you could probably make way more complicated typing 
# quirks than just simple replace, but this is probably good for most of them.
#----------------------------------------------------------------------------

class Window_Message < Window_Selectable  
  
alias  quirky_refresh refresh
def refresh
quirky_refresh
  
if $game_temp.message_text != nil
@now_text = $game_temp.message_text
quirk = $game_variables[2]
#----------Global Macros---------------------
# Use this section for things that you wish to have applied to all message text!
#--------------------------------------------
# Simple swear word filter
# This becomes active upon turning on switch 2, to allow it to be toggled.
if $game_switches[2]==true
  @now_text.gsub!(/[Ff][Uu][Cc][Kk]/) { "f***" } 
  #if you're better at regex, you could probably check caps better than this
  @now_text.gsub!(/[Ss]hit/) { "s***" } 
  @now_text.gsub!(/[Aa]ss/) { "a**" } 
  @now_text.gsub!(/[Bb]itch/) { "b****" } 
  @now_text.gsub!(/[Cc]rap/) { "c**p" } 
end

# Time display macro
# allows for the current date and time to 
# be displayed in a message with the \time command
timee= Time.now.strftime("%m/%d/%Y %I:%M")

@now_text.gsub!(/\\[Tt]ime/) { timee }

#--------------- Conditional quirks--------------
# Change the variable to select which one of these to use in a message!
#-------------------------------------------------
  case quirk
  
    when 1; @now_text.upcase! 
      #changes all message to uppercase only
		when 2; @now_text.gsub!(/[Bb]/) { "8" } 
      #changes the letter bor B into 8
    when 3; @now_text.insert(0, ".~* ") 
      # Adds a .~* at the beginning of a message
    when 4; @now_text.insert(@now_text.length-1, " ->") 
      #adds a -> at the end of a message
      
		else; #if it's not one of those, it's this
  end 
 end
 
 end
end