Grabbing and altering a message, how do i do it?

● ARCHIVED · READ-ONLY
Started by Todeswalzer 6 posts View original ↗
  1. I'm relatively new to scripting only managed to make one script so far for myself and it's one thats been overdone... but hey, it works... anyway thats getting off topic what i was wondering is...

    say you have created an event within the game engine using "SHOW TEXT" is there anyway to make a script to grab that message check it and gsub words?

    example if you had a message like  "I need a dump" already made but you had an option of a profanity filter, how would i grab that message and replace *dump* with a different word and then output it without having to make another instance of the message?  does that make sense?
  2. Check how the default scripts do it... :)
  3. In Window_Base, there's the method convert_escape_characters:

      def convert_escape_characters(text)    result = text.to_s.clone    result.gsub!(/\\/)            { "\e" }    result.gsub!(/\e\e/)          { "\\" }    result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }    result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }    result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }    result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }    result.gsub!(/\eG/i)          { Vocab::currency_unit }    result  end 
    You could add a censor by aliasing this method and adding other gsubs.
    Here's how I would do it (disclaimer: the following code has words that some people don't like. If you're a person that doesn't like certain words, don't open the spoiler tag)

    Spoiler
    class Window_Base alias :uncensored_convert_escape_characters :convert_escape_characters unless $@ def convert_escape_characters result = uncensored_convert_escape_characters result.gsub!(/Frick/)          { "flip" } result.gsub!(/hell/)          { "heck" } result.gsub!(/damn/)          { "darn" } result.gsub!(//)          { "poop" } result endendThis website is actually changing the word that begins with an f and rhymes with duck to the work 'Frick', which I find strange, especially as this seems to also cover code, potentially breaking things.
  4. I think i'm gonna have to put this on the back burner for now, maybe it was a bit too much of an ambitious project for me since i don't know a huge amount about scripting and staring at the source scripts for 6+ hours is just giving me a headache.

    Just to clarify, i managed to get it to swap the text, i just wanted it done under certain conditions and i can't for the life of me get my head around it.
  5. You could always request someone else make this script, if you flesh out a bit exactly what it is you want.
  6. well this is the thing, i kinda want to be able to write scripts myself and I wanted something similar to Final Fantasy x with the Al Bhed primers, like you'd get a message and it'd be all jargon but as you found the primers it would translate the messages one letter at a time.  I figured that would be an easy enough thing to accomplish but my knowledge of scripting is very limited and no matter how much i stae at the scripts i just get an epic brain fart...