With this function you can change (or set) the persistence of any room in your game except the current one. A room with persistence flagged as true it will maintain the state of all instances within that room if the player leaves and then returns, whereas if persistence is flagged as false it will be reset to the initial state every time. You should note that a persistent room uses considerably more memory than a normal room and it is not recommended to have too many of them in your game.NOTE: This function will NOT work to switch off persistence if the room has already been visited! A persistent room, once visited, is held in memory and to switch off persistence you should go to that room and set the room_persistent variable to false and then exit the room again.
|index||The index of the room to set the persistence of.|
|val||Whether the room shall be persistent (true) or not (false).|
global.myroom = room_add();
This will create a new room and store its index in the variable "global.myroom". It will then set its width to 640 pixels, its height to 480 pixels, its caption to 'Game Room' and its persistence to 'true'.