[Suggestion] Bookkeeping game changer for giant projects: switch reordering

Motivation: The CTRL+F introduction in MV for the switch selector was honestly an absolute game changer for me. Before, larger projects weren't really manageable at all for me. Once I got past two hundred switches which happens quickly for me when lots of narrative choices and detail interactions on maps add up, it just became impossible to find old stuff anymore. Cue for a repeated 1-2 minute break just to find a switch that I know exist, but that I just can't recall where I put it.

Now even 600+ switches (and I have that many in one project) are somewhat manageable, but it's still not very fun because it's a bit of an unintentional chaos. The search helps, but doesn't fix the underlying issue: even with the best initial ordering with area A's switches in 1-100, area B in 101-200, ... one area will eventually outgrow its range and it will end up in chaos when I need to overflow into unanticipated ranges. (Also compare the "-----Reserved" range in the initial "Skills" MZ database, any large project will eventually run out of that space and clash with the "-----Enemy" marker. It's just how all large projects eventually go.) So, here is what I think would fix that for switches where it is most needed:


Description of the Feature:
I think the following feature would be another game changer for giant projects: Switch Reordering. The idea is to let me move a switch to a different number, but also all associated event uses will be automatically changed so that the original number/slot is "cleaned" for (re)use. Obviously, this would be similarly helpful to have for at the very least also Variables, Items, Skills, Weapons, and Armors, IMHO in descending order of usefulness. But I am proposing it for switches first since again here, I think it would be the biggest game changer for giant projects.

Mockups:
Here is how I think it should work:

Step 1: Open Switch Selector from anywhere

moveswitch1.png

Step 2: Pick "Move..." in context menu of switch

moveswitch2.png

Step 3: Wait for calculation which collects what will be affected, and what slots are definitely unused

moveswitch3.png

Step 4: Pick new slot which can only be one calculated as unused by all event pages in the entire project

moveswitch4.png

Step 5: Wait for result while all events have their references to this switch swapped out with new number

moveswitch5.png

Step 6: Enjoy! Your switch has now been reordered!

moveswitch6.png

I apologize since this has likely been proposed before. But the mockup hopefully is useful to see how it could work in practice.

Possible issues with this feature:

I imagine implementing it such that really all references in any sort of event instruction are reliably changed might be somewhat challenging. Also, plugin commands that somehow indirectly refer to switches (since I think it's not directly possible as recognized @arg @type right now) would still need to be adapted manually. And I'm not sure a new user would understand the usefulness of it.
I can see the work hours this would require, not an easy thing to implement. Probably easiest to just add a warrning stating:"The feature doesn't work with scripts, are you sure you want to continue?"

And if this was added, I would very much like the same thing to be added for variables too. I always miss calculate how many variables I have to use, and it very fast becomes a mess... (Guess I really need to learn how to plan out my projects in more detail before creating them.)
Probably easiest to just add a warrning stating:"The feature doesn't work with scripts, are you sure you want to continue?"
It's not meant to work with scripts/plugins, that likely not be very feasible since the editor cannot really know how they work or what switches they would access.

It is however meant to work with event pages. And if you meant to suggest that shouldn't be the case, there might be a misunderstanding since that would make this idea pointless: you can already copy+paste now ignoring the event pages, it's two simple clicks. But if your switch is used over five different maps you're never going to touch it, so the point of this feature is to make that feasible and actually adjust all events on all maps.

@ planning out: in my experience it's not possible to plan this ahead for a non-trivial project in a way that works out, and that does make sense: that's like wanting to plan out bug free code in advance, or a power plant to never malfunction. Humankind tried for decades and it just never works out. This is why I am suggesting this feature.

And if this was added, I would very much like the same thing to be added for variables too.
That would definitely be useful for the same reasons. However, I usually end up with around 10x the switches compared to variables, so there the problem just is way worse for me. This is why I suggested it for switches first.
It's not meant to work with scripts/plugins, that likely not be very feasible since the editor cannot really know how they work or what switches they would access.

It is however meant to work with event pages. And if you meant to suggest that shouldn't be the case, there might be a misunderstanding since that would make this idea pointless: you can already copy+paste now ignoring the event pages, it's two simple clicks. But if your switch is used over five different maps you're never going to touch it, so the point of this feature is to make that feasible and actually adjust all events on all maps.

@ planning out: in my experience it's not possible to plan this ahead for a non-trivial project in a way that works out, and that does make sense: that's like wanting to plan out bug free code in advance, or a power plant to never malfunction. Humankind tried for decades and it just never works out. This is why I am suggesting this feature.

That would definitely be useful for the same reasons. However, I usually end up with around 10x the switches compared to variables, so there the problem just is way worse for me. This is why I suggested it for switches first.


I was refering to the "script" option found on the event page, and in the "conditions branch" (also on the event page.) Both lets you add a custom script to said event page. Not to mention that scripts are also accessable in the "damage formula" not sure why one would want to put a switch there, but it is possible, to my knowledge. All would need to be checked and adjusted, if there isn't a warning that says that these will not be affected.

As for planning out part; That was my point, I never succeed with my planning, if I did, i wouldn't need this feature.

As for Switches vs Variables, that is just how it is, diffrent people use diffrent things. That is one part that makes us human. I think we both can agree on this. And since both things works in a very simular manner, I think you can agree that adding one but not the other would be a bit silly.


A tip from one rpg-maker-user to another:
I have found that the <Self>Switch/Variable, added by the Visu-team for MZ, and Yanfly for MV, help me lower the number of switches I needed by a TON, helping me to orginize things a lot easier. Since minor things, like conversation changes based on switches and things like that, can all be stored in a single switch/variable. Since self-switches binds the switch to an event, making it "local" to that event.
This way I don't need to register 100+switches just to check what text is to be shown by diffrent npc's.
The list of: 50+ Sw/Var"Turn in quest to npcX" basically turned into 2-3 <Self>Sw/var "Local-Sidequest"
Granted, I needed a better grasp of my game, what npc's gave what quest and so on, but once you have made an event, and it works, you almost never have to access it again.

By adding a "default" map-controll event (basically just an empty event ment to holding on to variable/switches for a map), I could lower it even more.
Sure I need to use plugin-calls to change/read them, but even so, it made it easier for me to orginse the mess that was my Variable/Switch lists.
Just be a bit careful since they don't seem to work with common-events.
I almost never use self switches ever since I use tons of common events for shared code where they often aren't useful. This is off-topic anyway, since any such approaches merely delay the chaos and don't fix it.

And yes, as I wrote above, script lines would not be altered since that is technically impossible. (You can't reliably determine in advance what game state or switches/variables a script will access or alter, that would kind of require solving the halting problem.) However, it might be a good idea to add a @type switch and @type variable- apparently they already exist in MZ, so at least those script parameters could be easily swapped out too. But other types of unusual accesses from inside a script can't be, that's just how it is.
Seems good. The inability to rearrange the database (and database-like things such as switches and variables) and update references as well is frustrating from time to time.

As for implementation, since you're already thinking of doing the usage calculations for both the source and target switches, it might be worth doing it as an "exchange" instead of a "move". If you're running into this issue in the first place, "blank" switches in convenient spots might be hard to come by.
@Soaprman I can see how you'd prefer an exchange/swap, since doing that with a move would require three separate moves. Edit: and it's indeed the better option, see update in next post of mine below

However, the reason I think an exchange is somewhat worse is because there is no way to tell if a seemingly empty switch slot isn't actually accidentally still used/referenced from somewhere. Of course this is kind of a different problem in a way, and always the game creators fault anyway, but still it can happen on accident and if I move a switch into what I think is an unused spot I'd really like to know in case it isn't actually unused. (Although maybe another context menu function like, "List switch references", could likely replace this. But I don't know how much work the rpg maker devs are willing to put into the UI for that, so a Move function seemed like the easiest way to kind of combine that to make it quicker to implement.)

And for me, the main concern with doing this switch relocation in projects really is safety, not that it's particularly comfortable to use. I don't want to use this function all day, just in the rare occasions that I need it, and then I don't mind if it's a bit tedious - because right now it's so impossible to do that I just never move the slot of switches once I put them in use, so a bit of tedium still seems like a giant improvement to me.

In overall I would use it either way, so this is just my personal opinion on that detail. I'd be up both for a swap/exchange and a move, and would definitely use either variant. But I would probably feel a little safer using the move variant, personally.
there is no way to tell if a seemingly empty switch slot isn't actually accidentally still used/referenced from somewhere

There's already an event search tool built in that can be used for exactly that. I didn't notice it for a long time myself!

And I'm with you on safety being the priority, given that's the reason to update references in the first place. Pretty much any way of doing this is a win.
There's already an event search tool built in that can be used for exactly that. I didn't notice it for a long time myself!
Ah, I forgot it can search for switches specifically. Nice. So that definitely supports a slightly less clumsy exchange/swap function as you propose, I think I agree now that's the more practically useful one. Because if in doubt, one can always do a quick check in the event searcher to check if a switch is free.

Original thread: https://forums.rpgmakerweb.com/threads/suggestion-bookkeeping-game-changer-for-giant-projects-switch-reordering.126678/