- Joined
- Mar 20, 2013
- Messages
- 383
- Reaction score
- 91
- First Language
- English
- Primarily Uses
Hey all, so one of the things I've seen done a lot when scripting is to offer different customization options linked to a particular switch/variable, for example a custom menu script where you can cycle through different backgrounds by changing variable x where "x" is chosen by the script's user. So here's my question: is there a way to set the name of a switch/variable via script so that the name shows up in RPG Maker itself? Going to the previous example, the user chooses variable 10, and then the script would set the name of variable 10 to be "background changer" (or something like that) so when the user is doing event editing they don't have to refer back to the script window. Now, I know the user could just set the names themselves, but if there's a lot of options it would be easier to set via script so just humor me on that point.
I've already done some digging and here's what I've come up with (note this was in RMXP; may be different in VX/Ace). The "Data/System.rxdata" file contains the strings used for switch/variable names. This file gets loaded into the global variable "$data_system". Referencing "$data_system.switches" returns an array of strings of the switches names. So I called the following in game.
def rename(id, name) $data_system.switches[id] = nameendI checked via the debug menu, and sure enough this will change the name of a switch. But it's not permanent obviously. Starting a new game via quit to title will undo it. But if you change it to the following:
def rename(id, name) $data_system.switches[id] = name save_data($data_system, "Data/System.rxdata")endYou can save whatever changes you've made. I even quit the game entirely and started it up again and found the new name had stuck. However, this still doesn't cause RPG Maker itself to recognize the new names and display them in the editor. So any thoughts? Are the switch/variable names that RPG Maker uses saved elsewhere? Like in the project file? Can this even be done?
I've already done some digging and here's what I've come up with (note this was in RMXP; may be different in VX/Ace). The "Data/System.rxdata" file contains the strings used for switch/variable names. This file gets loaded into the global variable "$data_system". Referencing "$data_system.switches" returns an array of strings of the switches names. So I called the following in game.
def rename(id, name) $data_system.switches[id] = nameendI checked via the debug menu, and sure enough this will change the name of a switch. But it's not permanent obviously. Starting a new game via quit to title will undo it. But if you change it to the following:
def rename(id, name) $data_system.switches[id] = name save_data($data_system, "Data/System.rxdata")endYou can save whatever changes you've made. I even quit the game entirely and started it up again and found the new name had stuck. However, this still doesn't cause RPG Maker itself to recognize the new names and display them in the editor. So any thoughts? Are the switch/variable names that RPG Maker uses saved elsewhere? Like in the project file? Can this even be done?
Last edited by a moderator:


