Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Auto replace a word/term inside the game?

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.ph ... 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
 

coyotecraft

🎱 Outlook good
Sponsor

Is that "Aryans"? Lol, the thought crossed my mind but I never said anything because it's just a name.

In VX Ace it's kind of difficult. I could theoretically parse the text with a script, like a word filter, and replace a word with a different word. But that'll probably mess up your text alignment somewhere. Potentially cutting off text in a textbox.
 
Hello coyotecraft and omg yes! Thats it exactly x(( I unknowingly used Aryan for my game because it was supposed to be inspired from the alleged real life aliens "Pleaideans" and their alternate was Aryans x(( It was only late that I knew of its derogatory origins :((

But yah, I am now using Errans as replacement for the word! ^_^ And ohh! If it is actually possible to do that via script to replace certain texts that would indeed be amazing coyotecraft! ^_^ :D Thanks so much for the response! :)
 

coyotecraft

🎱 Outlook good
Sponsor

Aww. Well, I put together this crude script. Paste it above 'Main' in your scripts. Make sure Show Console is checked.
Use the script call look_for("keyword")
It's case sensitive. And it's going to miss any words you might have broken up with an apostrophe to overflow onto the next line. Like "Ay-
ran"
It should go through maps 1 to 999.
I say "should". I've only tested it with a handful of maps.
Under the map it's checking it'll list details about any event containing the word or phrase you're searching for.
It's the map data's file name, not the map name in the editor.
mt7xfnq2pn010v46g.jpg


A "replace word" feature is a simple step away. But it overwrites the map data while playtesting. So you would have to close and reopen the editor to see the change. And I'm not going to include it here because I don't want to be responsible for anyone messing up their project.
(Especially your's Starmage since you're releasing it on Steam)

I actually had a script for XP that let you edit text boxes while playtesting but XP had limited functions so I couldn't make it look nice as a stand-alone script. And never released it.

Code:
def look_for(word)

  print "Searching for: \""+word+"\"\n"

  for w in 1..999

    #Make sure file exists

    if File.file?(sprintf("Data/Map%03d.rvdata2", w))

    temp = load_data(sprintf("Data/Map%03d.rvdata2", w)) 

    print "Checking~ "+sprintf("Data/Map%03d.rvdata2", w)+"\n"

    #check every event

    for x in 1..temp.events.length 

      #If it has the keyword

      if temp.events[x].inspect.include? word #"Ayran"

        #Print details

        for y in 0..temp.events[x].pages.length

          unless temp.events[x].pages[y] == nil

            for z in 0..temp.events[x].pages[y].list.length 

              print "Event:"+x.to_s+" page:"+(y+1).to_s+" list:"+z.to_s+"\n" if temp.events[x].pages[y].list[z].inspect.include? "Ayran"  

            end

          end

        end

      end

    end

    end

  end

  #done

  print "!!Search complete!!"

end

 
 
Wooow! This looks like an amazing alternative to fully change the name within the game coyotecraft! :D Thank you so much for this effort! I am so excited to try out this script tomorrow when I get back home! ^^

Btw, sorry for the noob question, but where do I check the console? xD And once the script runs, it will now auto replace the term I want right? And just re open them after? ^^
 

coyotecraft

🎱 Outlook good
Sponsor

"Show Console" is under "Game" in the top menu bar. Funny story, I haven't worked in VX Ace in a long time since I got a new laptop, so it wasn't already checked. I probably spent an hour the other day scratching my head trying to figure out why I wasn't seeing anything.
m7m87laundbhas56g.jpg


This current script won't replace the word. It'll just show you where the word is at. I'm just wary, it has the potential to mess a lot of things up. I just put it together yesterday and have hardly tested it, you know. It's not just textboxes, it could change event names and references to filenames. I need to add more safety measures and messages. Like maybe a "skip" option. Also this is just the Map Data. It's not going though the common events, items, actor databases.

So it's not that powerful of a tool, yet. But it could potentially be of great service to translators. Like all the [はい・いいえ] [Yes/No] choice options, would be a snap to change with this I think.
 
Ohhh! That's wonderful, coyotecraft! <3 ^_^ I would really love to see you be able to make this tool in its completed state someday! :) It's a really nice way to find the words though! So thanks so much for sharing coyotecraft! :biggrin:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top