Room goto

Explanation
This function moves the player to the room with the given index. Normally you will use the name of the room as the index (without quotes). Make sure a room with the index actually exists. Note that rooms do not have consecutive indexes. So the next room is not one higher than the previous room. See the examples below on how to deal with that.

Examples
The following example moves the player to the first room when the escape key is pressed: if (keyboard_check_pressed(vk_escape)) {    room_goto(room_first); }

The following example moves the player to the next room

room_goto(room_next(room));

This is equivalent to

room_goto_next;

Remarks
When calling this function, please realize that this change does actually not occur at that precise moment. It only happens after the current action is fully executed. So the rest of the script will still be executed, and the same applies to possible calling scripts.