Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_84_load_ini

(view raw script w/o annotations or w/e)
1
function 
scr_84_load_ini
scr_84_load_ini

function
scr_84_load_ini()
{ var CH = string(global.chapter); for (i = 0; i < 3; i += 1) FILE[i] = 0; for (i = 0; i < 3; i += 1) { FILE[i] = 0; NAME[i] = stringsetloc(
[EMPTY]
"[EMPTY]", "scr_84_load_ini_slash_scr_84_load_ini_gml_13_0"
);
TIME[i] = 0; PLACE[i] = "------------"; LEVEL[i] = 0; TIME_STRING[i] = "--:--"; INITLANG[i] = 0; } if (ossafe_file_exists("filech" + CH + "_0")) { FILE[0] = 1; NAME[0] = "FILE0"; } if (ossafe_file_exists("filech" + CH + "_1")) { FILE[1] = 1; NAME[1] = "FILE1"; } if (ossafe_file_exists("filech" + CH + "_2")) { FILE[2] = 1; NAME[2] = "FILE2"; } if (ossafe_file_exists("dr.ini")) { ossafe_ini_open("dr.ini"); for (i = 0; i < 3; i += 1) { if (FILE[i] == 1) { var room_id = ini_read_real(
scr_ini_chapter(global.chapter, i), "Room", scr_get_id_by_room_index(room));
var room_index =
scr_get_room_by_id(room_id);
PLACE[i] =
scr_roomname(room_index);
TIME[i] = ini_read_real(
scr_ini_chapter(global.chapter, i), "Time", 0);
NAME[i] = ini_read_string(
scr_ini_chapter(global.chapter, i), "Name", "------");
LEVEL[i] = 1; INITLANG[i] = ini_read_real(
scr_ini_chapter(global.chapter, i), "InitLang", 0);
TIME_SECONDS_TOTAL[i] = floor(TIME[i] / 30); TIME_MINUTES[i] = floor(TIME_SECONDS_TOTAL[i] / 60); TIME_SECONDS[i] = TIME_SECONDS_TOTAL[i] - (TIME_MINUTES[i] * 60); TIME_SECONDS_STRING[i] = string(TIME_SECONDS[i]); if (TIME_SECONDS[i] == 0) TIME_SECONDS_STRING[i] = "00"; if (TIME_SECONDS[i] < 10 && TIME_SECONDS[i] >= 1) TIME_SECONDS_STRING[i] = "0" + string(TIME_SECONDS[i]); TIME_STRING[i] =
scr_timedisp(TIME[i]);
} } ossafe_ini_close(); ossafe_savedata_save(); } }
()
2
{
3
    var CH = string(global.chapter);
4
    for (i = 0; i < 3; i += 1)
5
        FILE[i] = 0;
6
    for (i = 0; i < 3; i += 1)
7
    {
8
        FILE[i] = 0;
9
        NAME[i] = stringsetloc(
[EMPTY]
"[EMPTY]", "scr_84_load_ini_slash_scr_84_load_ini_gml_13_0"
);
10
        TIME[i] = 0;
11
        PLACE[i] = "------------";
12
        LEVEL[i] = 0;
13
        TIME_STRING[i] = "--:--";
14
        INITLANG[i] = 0;
15
    }
16
    if (ossafe_file_exists("filech" + CH + "_0"))
17
    {
18
        FILE[0] = 1;
19
        NAME[0] = "FILE0";
20
    }
21
    if (ossafe_file_exists("filech" + CH + "_1"))
22
    {
23
        FILE[1] = 1;
24
        NAME[1] = "FILE1";
25
    }
26
    if (ossafe_file_exists("filech" + CH + "_2"))
27
    {
28
        FILE[2] = 1;
29
        NAME[2] = "FILE2";
30
    }
31
    if (ossafe_file_exists("dr.ini"))
32
    {
33
        ossafe_ini_open("dr.ini");
34
        for (i = 0; i < 3; i += 1)
35
        {
36
            if (FILE[i] == 1)
37
            {
38
                var room_id = ini_read_real(
scr_ini_chapter
scr_ini_chapter

function
scr_ini_chapter(arg0, arg1)
{ if (arg0 >= 2) return "G_" + string(arg0) + "_" + string(arg1); else return "G" + string(arg1); }
(global.chapter, i), "Room", scr_get_id_by_room_index(room));
39
                var room_index = 
scr_get_room_by_id
scr_get_room_by_id

function scr_get_room_ids() { if (!variable_global_exists("room_id_list")) global.room_id_list = scr_get_room_list(); return global.room_id_list; } function
scr_get_room_by_id(arg0)
{ var room_id = arg0; var rooms = scr_get_room_ids(); if (room_id < 10000) room_id += (global.chapter * 10000); var room_index = 0; for (var i = 0; i < array_length(rooms); i++) { if (rooms[i].room_id == room_id) { room_index = rooms[i].room_index; break; } } if (room_index == 0) show_debug_message("*** ERROR: could not find room with id " + string(room_id)); return room_index; } function scr_get_id_by_room_index(arg0) { var room_index = arg0; var rooms = scr_get_room_ids(); var room_id = room_gms_debug_failsafe; for (var i = 0; i < array_length(rooms); i++) { if (rooms[i].room_index == room_index) { room_id = rooms[i].room_id; break; } } if (room_id == room_gms_debug_failsafe) show_debug_message("*** ERROR: could not find room with index " + string(room_index)); return room_id; } function scr_room(arg0, arg1) constructor { room_index = arg0; room_id = arg1; if (room_index == 141) show_debug_message(string(141) + " " + string(room_id)); } function scr_get_room_list() { var idsarr = [new scr_room(room_krisroom, 50013), new scr_room(room_town_south, 50024), new scr_room(room_dw_castle_town, 50054), new scr_room(PLACE_MENU, 50075), new scr_room(room_dw_castle_tv, 50114), new scr_room(room_dw_garden_intro, 50122), new scr_room(room_dw_garden_floradinnencounter, 50124), new scr_room(room_dw_garden_hospital, 50125), new scr_room(room_dw_garden_enemyrush, 50131), new scr_room(room_dw_garden_diner, 50135), new scr_room(room_dw_garden_aqua, 50138), new scr_room(room_dw_garden_aquahole, 50143), new scr_room(room_dw_garden_aquaplatforming, 50145), new scr_room(room_dw_garden_cliffexit, 50146), new scr_room(room_dw_garden_aquadash, 50152), new scr_room(room_dw_cliff_dash_runner, 50161), new scr_room(room_dw_cliff_seth_miniboss, 50162), new scr_room(room_dw_cliff_shop, 50163), new scr_room(room_dw_cliff_sethaqua_battle, 50169), new scr_room(room_dw_cliff_verticalwind_post, 50170), new scr_room(room_dw_fcastle_cafe, 50181), new scr_room(room_dw_fcastle_foyer, 50182), new scr_room(room_dw_fcastle_post_party_jail, 50183), new scr_room(room_dw_fcastle_left_twodoors, 50187), new scr_room(room_dw_fcastle_dangerous_platforming, 50190), new scr_room(room_dw_fcastle_blueroom, 50191), new scr_room(room_dw_fcastle_onsen, 50193), new scr_room(room_dw_fcastle_second_diner, 50207), new scr_room(room_dw_fcastle_obscured_bullets, 50208), new scr_room(room_dw_fcastle_right_penultimate, 50210), new scr_room(room_dw_fcastle_right_endingscene, 50212), new scr_room(room_dw_fcastle_orange_gauntlet, 50217), new scr_room(room_dw_fcastle_top_staircase_1, 50225), new scr_room(room_dw_fcastle_top_entrance, 50228), new scr_room(room_dw_fcastle_green_checkpoint, 50230), new scr_room(room_dw_fcastle_final_save, 50231), new scr_room(room_dw_fcastle_flowery, 50232), new scr_room(room_dw_fcastle_pinkroom, 50236), new scr_room(room_dw_fcastle_top_ascent, 50248)]; return idsarr; }
(room_id);
40
                PLACE[i] = 
scr_roomname
scr_roomname

function
scr_roomname(arg0)
{ roomname = stringsetloc(
Dark World?
"Dark World?", "scr_roomname_slash_scr_roomname_gml_1_0"
);
if (arg0 == 0) roomname = stringsetloc(
---
"---", "scr_roomname_slash_scr_roomname_gml_2_0"
);
if (arg0 == 13) roomname = stringsetloc(
Kris's Room
"Kris's Room", "scr_roomname_slash_scr_roomname_gml_4_0_b"
);
if (arg0 == 54) roomname = stringsetloc(
My Castle Town
"My Castle Town", "scr_roomname_slash_scr_roomname_gml_6_0"
);
if (arg0 == 112) roomname = stringsetloc(
Castle Town - TV Building
"Castle Town - TV Building", "scr_roomname_slash_scr_roomname_gml_30_0"
);
if (arg0 == 24) roomname = stringsetloc(
Hometown
"Hometown", "scr_roomname_slash_scr_roomname_gml_7_0"
);
if (arg0 == 120) roomname = stringsetloc(
Dark World
"Dark World", "scr_roomname_slash_scr_roomname_gml_8_0"
);
if (arg0 == 122) roomname = stringsetloc(
Garden - Beginning
"Garden - Beginning", "scr_roomname_slash_scr_roomname_gml_9_0"
);
if (arg0 == 129) roomname = stringsetloc(
Garden - Flowery Helped
"Garden - Flowery Helped", "scr_roomname_slash_scr_roomname_gml_10_0_b"
);
if (arg0 == 133) roomname = stringsetloc(
Garden - Ideal Diner
"Garden - Ideal Diner", "scr_roomname_slash_scr_roomname_gml_11_0"
);
if (arg0 == 150) roomname = stringsetloc(
Garden - Way Home
"Garden - Way Home", "scr_roomname_slash_scr_roomname_gml_12_0_b"
);
if (arg0 == 141) roomname = stringsetloc(
Garden - Shrine
"Garden - Shrine", "scr_roomname_slash_scr_roomname_gml_13_0_b"
);
if (arg0 == 144) roomname = stringsetloc(
Cliffs - Beginning
"Cliffs - Beginning", "scr_roomname_slash_scr_roomname_gml_14_0"
);
if (arg0 == 161) roomname = stringsetloc(
Cliffs - Shop
"Cliffs - Shop", "scr_roomname_slash_scr_roomname_gml_15_0_b"
);
if (arg0 == 167) roomname = stringsetloc(
Cliffs - Below Castle
"Cliffs - Below Castle", "scr_roomname_slash_scr_roomname_gml_16_0_b"
);
if (arg0 == 179) roomname = stringsetloc(
Flower Castle - Jail
"Flower Castle - Jail", "scr_roomname_slash_scr_roomname_gml_17_0_b"
);
if (arg0 == 177) roomname = stringsetloc(
Flower Castle - Cafe
"Flower Castle - Cafe", "scr_roomname_slash_scr_roomname_gml_18_0_b"
);
if (arg0 == 202) roomname = stringsetloc(
Flower Castle - Right Diner
"Flower Castle - Right Diner", "scr_roomname_slash_scr_roomname_gml_19_0_b"
);
if (arg0 == 207) roomname = stringsetloc(
Flower Castle - Right End
"Flower Castle - Right End", "scr_roomname_slash_scr_roomname_gml_20_0"
);
if (arg0 == 183) roomname = stringsetloc(
Flower Castle - Left Doors
"Flower Castle - Left Doors", "scr_roomname_slash_scr_roomname_gml_21_0_b"
);
if (arg0 == 187) roomname = stringsetloc(
Flower Castle - Left Stage
"Flower Castle - Left Stage", "scr_roomname_slash_scr_roomname_gml_22_0"
);
if (arg0 == 189) roomname = stringsetloc(
Flower Castle - Left End
"Flower Castle - Left End", "scr_roomname_slash_scr_roomname_gml_23_0_b"
);
if (arg0 == 222) roomname = stringsetloc(
Top of Castle - Beginning
"Top of Castle - Beginning", "scr_roomname_slash_scr_roomname_gml_24_0_b"
);
if (arg0 == 224) roomname = stringsetloc(
Top of Castle - Green's Shop
"Top of Castle - Green's Shop", "scr_roomname_slash_scr_roomname_gml_25_0"
);
if (arg0 == 225) roomname = stringsetloc(
Top of Castle - Castle Top
"Top of Castle - Castle Top", "scr_roomname_slash_scr_roomname_gml_26_0"
);
if (arg0 == 205) roomname = stringsetloc(
Flower Castle - Right View
"Flower Castle - Right View", "scr_roomname_slash_scr_roomname_gml_27_0"
);
if (arg0 == 230) roomname = stringsetloc(
Top of Castle - Boss?
"Top of Castle - Boss?", "scr_roomname_slash_scr_roomname_gml_28_0"
);
return roomname; }
(room_index);
41
                TIME[i] = ini_read_real(
scr_ini_chapter
scr_ini_chapter

function
scr_ini_chapter(arg0, arg1)
{ if (arg0 >= 2) return "G_" + string(arg0) + "_" + string(arg1); else return "G" + string(arg1); }
(global.chapter, i), "Time", 0);
42
                NAME[i] = ini_read_string(
scr_ini_chapter
scr_ini_chapter

function
scr_ini_chapter(arg0, arg1)
{ if (arg0 >= 2) return "G_" + string(arg0) + "_" + string(arg1); else return "G" + string(arg1); }
(global.chapter, i), "Name", "------");
43
                LEVEL[i] = 1;
44
                INITLANG[i] = ini_read_real(
scr_ini_chapter
scr_ini_chapter

function
scr_ini_chapter(arg0, arg1)
{ if (arg0 >= 2) return "G_" + string(arg0) + "_" + string(arg1); else return "G" + string(arg1); }
(global.chapter, i), "InitLang", 0);
45
                TIME_SECONDS_TOTAL[i] = floor(TIME[i] / 30);
46
                TIME_MINUTES[i] = floor(TIME_SECONDS_TOTAL[i] / 60);
47
                TIME_SECONDS[i] = TIME_SECONDS_TOTAL[i] - (TIME_MINUTES[i] * 60);
48
                TIME_SECONDS_STRING[i] = string(TIME_SECONDS[i]);
49
                if (TIME_SECONDS[i] == 0)
50
                    TIME_SECONDS_STRING[i] = "00";
51
                if (TIME_SECONDS[i] < 10 && TIME_SECONDS[i] >= 1)
52
                    TIME_SECONDS_STRING[i] = "0" + string(TIME_SECONDS[i]);
53
                TIME_STRING[i] = 
scr_timedisp
scr_timedisp

function
scr_timedisp(arg0)
{ var minutes = floor(arg0 / 1800); var remmins = minutes % 60; var hours = (minutes - remmins) / 60; var seconds = floor((arg0 / 30) - (minutes * 60)); var hourstring = string(hours) + ":"; var minstring = string(remmins) + ":"; if (remmins < 10) minstring = "0" + minstring; var secstring = string(floor(seconds)); if (seconds < 10) secstring = "0" + secstring; var timedisp = hourstring + minstring + secstring; return timedisp; }
(TIME[i]);
54
            }
55
        }
56
        ossafe_ini_close();
57
        ossafe_savedata_save();
58
    }
59
}