How do I choose the starting room?

Discussion in 'Programming' started by yuna3849, Jan 12, 2017.

Tags:
  1. yuna3849

    yuna3849 Guest

    I made several rooms.
    How can I change starting room(default room)?
     
  2. Jabbers

    Jabbers Member

    Joined:
    Jun 21, 2016
    Posts:
    210
    The starting room is traditionally whatever room is at the top of your room resource list in the GameMaker window. You can also use functions like room_goto to change what room is played first, if you want it to be dynamic for whatever reason.
     
    TheSly, Walky, EvanSki and 2 others like this.
  3. Jason C.

    Jason C. Member

    Joined:
    Mar 12, 2018
    Posts:
    17
    This is a most unhelpful answer. I see no place in GMS2 where I can VIEW or CHANGE a room index value nor anywhere in any of the settings choices where to set which room is my startup room in the GMS2 editor. In UNITY of course you tell the program which Scene to start with. The problem comes from renaming rooms or moving rooms around into Groups, etc.., how to tell which is the "default" or "startup" room, how to change it? Right now it appears to be 100% guess work, which sucks.
     
  4. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    580
    How?

    There isnt one.

    Thats neat. This is Game Maker Studio V2


    Its not really, its the room in your room list thats at the top because resources are ID indexed, so what ever is at the top is room_0
     
  5. Walky

    Walky Member

    Joined:
    Oct 13, 2018
    Posts:
    90
    It's as @Jabbers said. If you want a room to be the starting room, just drag it to the top of the list.
     
    EvanSki likes this.
  6. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,902
    Regardless of groups and whatnot, the very first room in the resource tree is room 0 -- not to be confused with Room0 (or room0 or any variation thereof). Even if it's in a group, if that group is at the top of the resource tree and that room is at the top of the rooms in that group, then it's room 0. Room IDs are assigned at compile time, hence the reason you use room constants (the names of the rooms).

    Note: The above statements only apply to Studio. In GM Legacy, IDs are assigned upon creation and importation.

    The room_goto() bit was kinda wrong, though. I mean, I get what he was saying, but the way he said it was wrong. At the very beginning of the game when it first loads up, the first room is ALWAYS room 0. But you can use room_goto() of course to specify the starting room for continues and game overs, rather than taking the buggy lackluster game_restart() way. But other than that, room_goto() does nothing for specifying where the first room is. lol
     
    EvanSki likes this.
  7. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    975
    *squints at posting dates for the first two posts and the outburst following them*
     
    EvanSki and rIKmAN like this.
  8. NoFontNL

    NoFontNL Member

    Joined:
    Feb 10, 2018
    Posts:
    293
    Just because I wanted to show my response. Jabbers is right. For Jason C. Jabbers didn't say anything about VIEWING or CHANGING room index values.
    You could always make a room at the top of the room resource list, for example 'rm_initialize' and put 'room_goto(desiredRoom)' in the creation code.
     
  9. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    580
     
  10. Jabbers

    Jabbers Member

    Joined:
    Jun 21, 2016
    Posts:
    210
    Lmao, I login to see this random topic blowing up two years after I posted in it.

    The first room in the room list is still the first room played in GMS2.

    [​IMG]


    In the above image, the following behaviour can be expected:

    room_goto(game_room); will take the player to the room named game_room.

    room_goto_next(); will take the player to game_room if it is called while in the room main_menu, or it will produce an error if called while in game_room (because there are no more rooms to move into as we have reached the end of our room list).

    The index of the rooms is 0 for main_menu and 1 for game_room. The engine variable room will return 0 if you are in main_menu and 1 if you are in game_room, but understand it corresponds to the order the rooms are in the list, so if you put game_room first, then game_room adopts index 0 (because it is as the start of the room list, and 0 is the first item for the computer-- not 1).

    If you can help it, just refer to rooms by their name.
     
    EvanSki likes this.
  11. Lukan

    Lukan Gay Wizard Freak

    Joined:
    Jun 20, 2016
    Posts:
    393

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice