(VX ACE) AUTO REPLACE A WORD/TERM INSIDE THE GAME?

Posts

Pages: 1
Hello everyone! Is there any way to automatically change all instances of one word/name/term being used within the game automatically?

Like, for example, I wanna change a race name within the game, and it would be quite difficult to manually replace each instance of that race name being mentioned in all texts/events within the game. As I might miss many, and it is also quite a tedious job especially you're already finishing the game. X( :(

So, is there any way I can make VX ace auto-replace every instance of a certain race name being mentioned into the new name I wanna give it? Thank you so much for any response! <3

Also, I am aware that Shaz' script exists:
https://forums.rpgmakerweb.com/index.php?threads/extract-events-to-text-file.17444

While it works great for what I want to do, you will still have to be editing the texts you wanna replace manually. >.< X( Which tbh, is kinda hard when you have like... 544 maps and events already in the game. T_T

Btw, I also wish to specify that what I am looking for is like, I want to literally change the name of a race from my game because it's a very controversial term, so I want every instance of it being mentioned within the game's events/common events and etc. to be replaced with something else... I want to literally make a new name for the race canonically if that makes sense? xD
Marrend
Guardian of the Description Thread
21781
While it probably won't help too much if you already had the term/name placed in over 500 possible events, the thought in my head for future considerations was to attach the term/name to an actor's name. Though, that might be a more appropriate action if the term/name changes mid-game, rather than having one consistent term throughout the entire game.

That aside, I'm not sure about a find-and-replace method for VX Ace Message Boxes? Lemme talk out loud for a bit.

The extraction of text could probably be done through the $game_message.texts function. This can generate an array for each line of text that would appear in the message box when it's called. I think you might be able to do...

i = 0
while i < $game_message.texts.size
  if $game_message.texts[i].include?("term")
    #Method to replace the term?
  end
  i += 1
end

...something like this to isolate which specific lines in the current instance of $game_message that contain the term. However, as the comment above might suggest, I'm still a little lost how how to actually replace the term in question without rewriting the line in question in it's entirety. Even if I did have an idea, the original text with the old term still exists. This method, assuming it would even work, would only modify what is there to fit the new paradigm. My guess is that you probably want was written in the event-command, itself, to be changed. For that...

...yeah, I've got nothin'. Sorry.
Hello Marrend and thanks so much for the response! And yeah, as you said, what I want is to change what is written already on the event-commands. x(( I heard from someone you can open map data files one by one via notepad and do the find+replace, sadly, when I tried so far, it would render the map file blank after saving the edited version via notepad. x( :(

The script you showed is indeed like a great alternative as well! But yah, sadly, it would still be kinda hard to try and implement the new word on ever instances of it being written. :( X(
Marrend
Guardian of the Description Thread
21781
It's a little wacky. A little cooky. However...

class Game_Interpreter
#--------------------------------------------------------------------------
  # * Show Text
  #--------------------------------------------------------------------------
  def command_101
    wait_for_message
    $game_message.face_name = @params[0]
    $game_message.face_index = @params[1]
    $game_message.background = @params[2]
    $game_message.position = @params[3]
    while next_event_code == 401       # Text data
      @index += 1
      $game_message.add(@list[@index].parameters[0])
    end
    i = 0
    while i < $game_message.texts.size
      string = $game_message.texts[i].clone
      string = string.sub("what's") { |s| s="what is" }
      $game_message.texts[i] = var
      i += 1
    end
    case next_event_code
    when 102  # Show Choices
      @index += 1
      setup_choices(@list[@index].parameters)
    when 103  # Input Number
      @index += 1
      setup_num_input(@list[@index].parameters)
    when 104  # Select Item
      @index += 1
      setup_item_choice(@list[@index].parameters)
    end
    wait_for_message
  end
end

...this is a test-code I've been messing with to replace any/all instances of "what's" with "what is". Seems to work, though I'm a little shaky with messing with Game_Interpreter in any way. I would highly advise putting this into a separate code-section, if you use it. I'm not 100% sure what the due process would be if the word needs to have a leading capital letter for being the beginning of a sentence when it's normally all lowercase. Still, this might be something you could work with?
Hi Marrend and thank you so much for sharing your script that also does what I needed! ^_^ :D

KK20 actually already had a script that works just like the way you designed it with replacing a certain word and I'm using it already in my game now! ^_^

https://forum.chaos-project.com/index.php/topic,16055.0.html

But wow, your script would also be an amazing alternative, should I find others who need help with this as well! Thanks so much once again, Marrend! :)
Pages: 1