1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 Save room

Discussion in 'Programming' started by Raff, Aug 15, 2019.

  1. Raff

    Raff Member

    Joined:
    Feb 28, 2018
    Posts:
    47
    Hello everybody !!!

    Can someone tell me how to save the room name in json and load it please ? I am using GMWolf 's tutorial "Advanced saving system in game maker studio 2 " but i don't know how to add and extract this information to de saved map. Or a different way to do it using json. Thankyou !!!.
     
    GMWolf likes this.
  2. NoFontNL

    NoFontNL Member

    Joined:
    Feb 10, 2018
    Posts:
    303
    Saving information
    To add the room's name to a map, you use ds_map_add(map, key, value)
    Example: ds_map_add(saveMap, "room_name", room_get_name(room))
    saveMap is the map ID of your map, "room_name" is the key (the label corresponding to the value)

    Extracting information
    Then you use json_decode to convert the json back to a map and you can use ds_map_find_value(map, key) to find the stuff in the map, using the key.
    'map' is the decoded json instance and key is the 'label' you've set with ds_map_add
     
    GMWolf likes this.
  3. Raff

    Raff Member

    Joined:
    Feb 28, 2018
    Posts:
    47
    Thank you very much.
     

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