Hi, I've got a question specific to some of the more basic Javascript functionality that RPGM uses.
I've been using Map/Hashtable objects to store information about the game. Particularly things that the players have unlocked. I store them into $gameVariables objects like everything else, so for instance I make sure that at the start of the game it initializes a set of discoverable things in the game as $gameVariables.setValue(xx, new Map()); or I'll use the drag and drop code to set it to a new Map(), then I'll populate it. Checking the console, everything works out; the keys and value pairs show up in the exact order I put them in. The maps function exactly as intended, just like other Array variables that I use for various other things. But after a few months of using this system without a hitch, I started running into problems when saving the game and then reloading it, which is something I sparsely do because debugging RPGs as a whole takes a long time.
I tested a few different cases with other variables where it would store and load Arrays, for instance, perfectly fine. But the Map objects I store--the ones that work perfectly fine if I keep the game running--are reset to empty Objects. Like the Map could contain several key-value pairs and its type is a Map object but once I reload, it's turned into an Object type object with nothing in it instead. Maps are probably the most exotic data type I use for this project, but they're not exactly sophisticated. Is there something I'm doing wrong here, or are Maps just forbidden from RPGM and they owe me like two months of labor?
I've been using Map/Hashtable objects to store information about the game. Particularly things that the players have unlocked. I store them into $gameVariables objects like everything else, so for instance I make sure that at the start of the game it initializes a set of discoverable things in the game as $gameVariables.setValue(xx, new Map()); or I'll use the drag and drop code to set it to a new Map(), then I'll populate it. Checking the console, everything works out; the keys and value pairs show up in the exact order I put them in. The maps function exactly as intended, just like other Array variables that I use for various other things. But after a few months of using this system without a hitch, I started running into problems when saving the game and then reloading it, which is something I sparsely do because debugging RPGs as a whole takes a long time.
I tested a few different cases with other variables where it would store and load Arrays, for instance, perfectly fine. But the Map objects I store--the ones that work perfectly fine if I keep the game running--are reset to empty Objects. Like the Map could contain several key-value pairs and its type is a Map object but once I reload, it's turned into an Object type object with nothing in it instead. Maps are probably the most exotic data type I use for this project, but they're not exactly sophisticated. Is there something I'm doing wrong here, or are Maps just forbidden from RPGM and they owe me like two months of labor?