• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

SOLVED Problem with Room Order in GMS 2.3

AF_2004

Member
So I've encountered a pretty major problem, which is really stopping me from being able to work on my game further. I've seen other people post about this issue as well back when the 2.3 update came out, but I haven't come across a solution that works for me. Basically, whenever I add a new room now, it seems like I am unable to change its room order. Even when I do it through the room manager, it doesn't seem to make a difference. Now my problem isn't going from room to room, because I use room_goto(), however it does mess up one of the things I do at the beginning of the game. Basically, I have a display manager object which cycles through all the rooms at the beginning of the game and changes the view of all the rooms until it reaches the final room. The problem is that for some reason, the new room I have added is not being affected. Maybe I'm misunderstanding the problem and that this isn't really an issue with the room order, but that is all I can think of that could be causing this. Is there any way to fix this issue? Here is the code that I use(btw I got this code from pixelated pope's video about aspect ratios I think):
GML:
for (var i = 1; i <= room_last; i++;) {
    if room_exists(i) {
        room_set_view(i, 0, true, 0, 0, ideal_width, ideal_height, 0, 0, ideal_width, ideal_height, 0, 0, 0, 0, -1);
        room_set_view_enabled(i, true);
    }
}
 

Roldy

Member
Think about it.
  • What is the value of room_last?
  • In the context of room indices, what does '1' refer to?
  • How does '1' relate to room_last?

Don't set 'i = 1.' set it to room_first;
Don't 'i++'. Use room_next.

e.g.

GML:
var i = room_first;

while(room_exist(i)) {

    // Do stuff to room 'i'

    i = room_next(i);
}
In the above code 'i' consistently refers to a the room index; which is assigned by order of creation (undocumented) not room order.
In your code 'i' is all mixed up.

room_first
room_next
room_exists
 
Last edited:

AF_2004

Member
Think about it.
  • What is the value of room_last?
  • In the context of room indices, what does '1' refer to?
  • How does '1' relate to room_last?

Don't set 'i = 1.' set it to room_first;
Don't 'i++'. Use room_next.

e.g.

GML:
var i = room_first;

while(room_exist(i)) {

    // Do stuff to room 'i'

    i = room_next(i);
}
In the above code 'i' consistently refers to a the room index; which is assigned by order of creation (undocumented) not room order.
In your code 'i' is all mixed up.

room_first
room_next
room_exists
Wow, I can't believe I never thought of it that way. It was never a problem before 2.3, or even back in 1.4. Thank you so much! :D
 
Top