cannot access all spawns through Game.spawns



  • for (var spawn in Game.spawns) {

    this is only finding the spawn in my original room, and missing spawns in my other rooms, anyone else had this issue?

    I can still access my second Spawn, through Game.spawns.Spawn2, but accessing using the foreach loop and Game.spawns[spawn] isnt finding the second spawn.



  • Also if you have an simulation room opened in another tab, accessing spawns by name does not work correctly, because you have two spawns with the name 'Spawn1'



  • Just to be clear: the game and the simulator are two different environments. The game itself runs scripts on the server 'forever' while the simulator runs in the browser where its game state is refreshed when after rejoining the game (forcing you to restart everything from scratch).



  • Ok, but then this looks like the console output from 'sim' room and world is mixed

    I have
    var room = Game.rooms["sim"]
    room.memory.aaa= 'bbb'

    Then I open world room and sim room in different tabs and get in both consoles:
    typerror: cannot get property of udefined



  • Might be the code, even though they run different memory they still keep running the same code. Same code that makes an error -> seemingly same error in both game modes.