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
Here's a stupid, experimental way of quickly replacing words as they're being drawn. I'd say use this as a last resort.
module ReplaceBadWord
OLD_WORD = /bad/i # keep the forward-slashes and i
NEW_WORD = 'good' # keep this word lower-cased
def self.for(text)
text.gsub!(OLD_WORD) { |t| t.downcase! ? NEW_WORD.capitalize : NEW_WORD }
end
end
class Window_Base
#--------------------------------------------------------------------------
# * Draw Text
# args : Same as Bitmap#draw_text.
#--------------------------------------------------------------------------
alias draw_text_after_replacing_word draw_text
def draw_text(*args)
if args.first.is_a?(Rect)
ReplaceBadWord.for(args[1])
elsif args[4].is_a?(String)
ReplaceBadWord.for(args[4])
end
draw_text_after_replacing_word(*args)
end
#--------------------------------------------------------------------------
# * Draw Text with Control Characters
#--------------------------------------------------------------------------
alias draw_text_ex_after_replacing_word draw_text_ex
def draw_text_ex(x, y, text)
ReplaceBadWord.for(text)
draw_text_ex_after_replacing_word(x, y, text)
end
end
class Game_Message
#--------------------------------------------------------------------------
# * Add Text
#--------------------------------------------------------------------------
alias add_text_after_replacing_word add
def add(text)
ReplaceBadWord.for(text)
add_text_after_replacing_word(text)
end
end
Hello KK20 and OMG!!! <3 I tried and it works wonders! :O ^_^ Though the texts within the editor still remains the old. But what's important is that in-game, it shows all instances of the old word changed to the new one! :D
Thank you so much once again, KK20! This is an extremely helpful script when needing to replace certain words but is hard because they're already all over the game! XD :D
Btw! I encountered a minor problem KK20, but there seems to be some sort of issue with the word wrapping of some of the text when I put your new script, like the spaces of some text boxes became strangely placed in-game. x(
I am using KilloZapit's Word Wrapping script:
https://www.rpgmakercentral.com/topic/6964-word-wrapping-message-boxes/
As well as Yanfly's Ace Message system:
https://yanflychannel.wordpress.com/rmvxa/core-scripts/ace-message-system/
I wonder if it was an incompatibility issue or load order issue? I have put your script above main but at the lowest part...
So the positions respectively were:
Ace Message
KilloZapit's word wrapper
Your new script
Thanks so much for the help, KK20! ^_^
Ohhh! My bad, it wasn't actually the issue because of your new script, KK20! ^^ It was another script that caused that (which I didn't need anymore), and the issue with text spaces disappeared right after. :)
Hello! I encountered an error when I tried using one of the skill types. :( X(
(https://i.imgur.com/9heJmT7.png)
When its one of my party's turn, this error popped up when I entered on one of their ability types. :( X(
Could probably just do a
return unless text.is_a?(String)
immediately above the offending line.
Awesome fix once again, KK20! ^_^ :) Didn't encounter the error anymore! <3 Thank you so much!! :D