Organizing Switches

So been kinda just throwing switches into the game without really planning on how to group them later.

Well It's time to group them(or at least I feel I should group them NOW before things get messier). So I ask people that might do this more often than I do; how do you organize switches? Or just items in general like skills, monsters, equpiment.

What I have planned to do is split the switches across a couple different groupings of the 1-20 and then further down. So Dungeons 1-2 are on the same grouping, with about 9 switches each(The game I have planned out doesn't call for THAT many switches per dungeon).

Is this a good system or is having blank switches a bad thing for performance?
I'm just using Excel eventually.
It helps keep tracks on everything easily, and allow for more flexibility when you need to make some changes.

Having blank switches shouldn't make much of a difference in performances as far as I know. But if for some reason you need more switches than what you've planned (including the blanks), you'll need to add another group somewhere else.
I'm just using Excel eventually.
It helps keep tracks on everything easily, and allow for more flexibility when you need to make some changes.

Having blanck switches shouldn't make much of a difference in performances as far as I know. But if for some reason you need more switches than what you've planned (including the blanks), you'll need to add another group somewhere else.

Oh yeah I've already tweaked the number up to something far higher than I should need if only to give me room. Kinda did that for all the info holders
I just try to keep related stuff together, and if I think I might need more in that group, I leave some space.

Switches (and variables) that I use a lot, I'll put at the top of the list, so I don't have to go hunting for them every time I want to use them.
I do two things to organize my switches and variables:

1. I make them as needed
2. I get the most use out of every variable and switch that I can

I almost always have a "temp" variable or two that I can use on the fly, and depending on the situation I can use them as an event page condition as well in place of a switch.

TL;DR i have no clue, I'm just as lost as you lol
I do two things to organize my switches and variables:

1. I make them as needed
2. I get the most use out of every variable and switch that I can

I almost always have a "temp" variable or two that I can use on the fly, and depending on the situation I can use them as an event page condition as well in place of a switch.

TL;DR i have no clue, I'm just as lost as you lol

I'm unsure as how to 'get the most out of my switches' but at the same time I'm trying to stay pretty basic to just actually FINISH something. So i've been using switches as basic.... switches. Fullfill X, switch turns on, moves a thing in the dungeon or lets you move forward.

As most switches won't be used again outside of a dungeon, I've just been grouping them by dungeon or town/school.
I generally try to group my variables together, but I usually do this by leaving a lot of space for things.

For instance, in the project I'm working on has a lot of things that require some core system elements, so I've reserved the first 200 or so variables for use in the core system, and then as I go through specific levels, I'll reserve around 20 or 30 variables for each level (depending on the size of the level).

As far as leaving gaps in variables, I do it quite frequently, and have yet to run into any problems in terms of performance, and don't really expect to. So long as you're using under a million or so variables, I don't see any reason why it should affect performance; modern computers have more than enough memory to make the performance impact of having a large number of variables fairly negligible.

I'm also a fan of using Excel to track variables and their usage. I've also expanded my Excel file to include not only variables and switches, but also common events and maps, so that everything is in one place.
I'm unsure as how to 'get the most out of my switches' but at the same time I'm trying to stay pretty basic to just actually FINISH something. So i've been using switches as basic.... switches. Fullfill X, switch turns on, moves a thing in the dungeon or lets you move forward.

As most switches won't be used again outside of a dungeon, I've just been grouping them by dungeon or town/school.

It basically comes down to cycling through switches within a dungeon. E.g. having three switches that you alternate between, then saving their values in an object variable when the player enters a new section of the dungeon, and reloading them if the player backtracks. Rinse and repeat.
It basically comes down to cycling through switches within a dungeon. E.g. having three switches that you alternate between, then saving their values in an object variable when the player enters a new section of the dungeon, and reloading them if the player backtracks. Rinse and repeat.

I would fear I would just mix them up somewhere down the line and be confused later, so I like having personal switches for everything
I would fear I would just mix them up somewhere down the line and be confused later, so I like having personal switches for everything

Fair enough!
Also for people that use excel, anyone want to put up a screen shot of that as an example if you don't mind?
Other than planning ahead, I don't think there's any good method to keep your database organized. Personally, I haven't bothered to even try; when I need to find something specific fast, I use Ctrl+F, and for lists in the game, I have code that sorts them at runtime. Once you've got your game going, it's very difficult to go back and rearrange any lists, switches included, because the game references that switch everywhere by number, so you need to update all those references to it too.
I had considered the possibility of a regex-based find and replace for this, but that has a problem if A) you use any plugins that deal with switch IDs and 😎 you use the "range" option. You can easily replace the *names* of the switches by replacing the array in System.json, but then replacing all the switch event codes in the map and common event json files would be tricky. You could do them individually, but you'd have no way of reliably getting the IDs for ranges.

You could theoretically do it programmatically by storing the original switch name array, then comparing it with the new one to get the indexes of what the original IDs should have been and replacing them that way.
Other than planning ahead, I don't think there's any good method to keep your database organized. Personally, I haven't bothered to even try; when I need to find something specific fast, I use Ctrl+F, and for lists in the game, I have code that sorts them at runtime. Once you've got your game going, it's very difficult to go back and rearrange any lists, switches included, because the game references that switch everywhere by number, so you need to update all those references to it too.

which is why I'm trying to set up a better organization now. Along with writing some notes to myself.

I'd rather not get further in and have to rechange all my switches. I already will probably need to switch some things around like attacks and items as I only have placeholders for those but trying to get a handle on switches now.
which is why I'm trying to set up a better organization now. Along with writing some notes to myself.

I'd rather not get further in and have to rechange all my switches. I already will probably need to switch some things around like attacks and items as I only have placeholders for those but trying to get a handle on switches now.

What you could potentially do is, rather than actually setting switches in places your game needs them, put a comment reminder that a switch needs to go there. Then for testing, just use a temporary switch (or set of switches if you need multiple). Note down the name the switch *will* have in a text file.

Then, when your game is done, or you have enough for a demo or whatever, arrange your switches in whatever order makes logical sense going by the text file you were keeping, open up your map files in a text editor, search for the comment event codes, and replace the comments in those events with actual switches.
What you could potentially do is, rather than actually setting switches in places your game needs them, put a comment reminder that a switch needs to go there. Then for testing, just use a temporary switch (or set of switches if you need multiple). Note down the name the switch *will* have in a text file.

Then, when your game is done, or you have enough for a demo or whatever, arrange your switches in whatever order makes logical sense going by the text file you were keeping, open up your map files in a text editor, search for the comment event codes, and replace the comments in those events with actual switches.

That might work.
Also for people that use excel, anyone want to put up a screen shot of that as an example if you don't mind?

Ask and you shall receive.

1595344798636.png

1595344832626.png
Cool thanks. This gives me ideas

Original thread: https://forums.rpgmakerweb.com/threads/organizing-switches.124255/