Saving and restoring of many flags(variables)

I'm building an singleplayer adventure map, and need a bunch of "Flags"(a few hundred maybe), which are basically variables to indicate, whether the player has visited certian places/killed enemies, etc.
I can think of two ways to do this:
- Scoreboard objectives
- Blocks at specific positions
I would just use the scoreboard, but I want the player to be able to save/load the state of all flags(at once). With blocks, you could just use the /clone
command, but scoreboards would require two commandblocks per flag to save and restore, whereas one /clone
can copy up to 32768 blocks/flags at once.
Scoreboard
Advantages: Easy to set/check, because you can give names like visitedCityXYZ
Disadvantages: Very hard to copy/restore, because every flag would need 1 commandblock for saving and one for loading
Blocks
Advantages: Easy saving/loading with /clone
Disadvantages: Harder to set/check, because you would need to remember/look up the coordinates of every flag. The Chunk containing the blocks may unload, and all /clone
, /setblock
and /testforblock
commands would fail.
Main question: Does anyone know a better way of building a "Flag"-system, which I can save/load, or an easier way to copy scoreboard values from/to the player.
Edit: I totally forgot, I could just put the blocks/containers into my Spawnchunk... I was placing commandblocks there to be always active, but didn't thought about using it for the flags.
Pictures about "Saving and restoring of many flags(variables)"



Auto-GCAS Saves Unconscious F-16 Pilot—Declassified USAF Footage
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Monstera, Karolina Grabowska, Karolina Grabowska, Dmitry Demidov