1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 Problem saving time based score

Discussion in 'Programming' started by ascoider, May 31, 2018.

  1. ascoider

    ascoider Member

    Joined:
    Mar 7, 2018
    Posts:
    2
    Hello everyone,

    I am trying to save a time score like this "0:00:00".
    I already used ini files and functions ini_write_string and ini_read_string (you can enter and save your name the first time you play and it works fine. Now i'm using the same code but doesn´t work.

    1st object: SCORE_LOAD (game start event)
    if file_exists("chrono_save.ini")
    {
    ini_open("chrono_save.ini");
    global.chrono = ini_read_string("scores","chrono",0);
    ini_close();
    }
    else
    global.chrono = "0:00:0";

    2nd object: FREEZES TIME (step event)
    if time = 1
    global.chrono = string(minutes) + ":" + string(seconds) + ":" + string(decimals);

    3rd object: SAVES TIME (create event, if new record is detected)
    ini_open("chrono_save.ini");
    ini_write_string("scores","chrono",global.chrono);
    global.chrono = ini_read_string("scores","chrono",0);
    ini_close();


    4th object: SHOWS LAST TIME

    this one works fine, it shows the last record made


    So, when I close the game and open again, the time is not saved.
    please some help, thanks.
     
  2. nicoltoons

    nicoltoons Member

    Joined:
    Nov 4, 2016
    Posts:
    124
    Try using a persistent object in the game to call the Save ini file(save tiime) in the step event.
     

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