This function permits you to go to any room in your game project, whether created using code or in the resource tree. You supply the unique room ID value (stored in the variable for the room name, or as a variable returned from the function room_add. Note that the room will not change until the end of the event where the function was called, so any code after this has been called will still run if in the same event. The caveat to this is that any code which creates instances that is called after this, will not create the instance and so should be called before changing room. This function will also trigger the Room End event.



Argument Description
index The index of the room to go to.




switch (global.rm)
    case 0: room_goto(rm_level1); break;
    case 1: room_goto(rm_level2); break;
    case 2: room_goto(rm_level3); break;

The above code will check a global variable and change room based on the value that it holds.