Deltarune (Chapter 1) 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()
{ for (i = 0; i < 3; i += 1) FILE[i] = 0; for (i = 0; i < 3; i += 1) { FILE[i] = 0; NAME[i] =
[EMPTY]
scr_84_get_lang_string("DEVICE_MENU_slash_Create_0_gml_97_0")
;
TIME[i] = 0; PLACE[i] = "------------"; LEVEL[i] = 0; TIME_STRING[i] = "--:--"; INITLANG[i] = 0; } if (ossafe_file_exists("filech1_0")) { FILE[0] = 1; NAME[0] =
FILE0
scr_84_get_lang_string("DEVICE_MENU_slash_Create_0_gml_107_0")
;
} if (ossafe_file_exists("filech1_1")) { FILE[1] = 1; NAME[1] =
FILE1
scr_84_get_lang_string("DEVICE_MENU_slash_Create_0_gml_112_0")
;
} if (ossafe_file_exists("filech1_2")) { FILE[2] = 1; NAME[2] =
FILE2
scr_84_get_lang_string("DEVICE_MENU_slash_Create_0_gml_117_0")
;
} 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));
if (room_id < 10000) { var valid_room_index =
scr_get_valid_room(global.chapter, room_id);
room_id = scr_get_id_by_room_index(valid_room_index); } var room_index =
scr_get_room_by_id(room_id);
PLACE[i] =
scr_roomname(room_index);
TIME[i] = ini_read_real("G" + string(i), "Time", 0); NAME[i] = ini_read_string("G" + string(i), "Name", "------"); LEVEL[i] = 1; INITLANG[i] = ini_read_real("G" + string(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
    for (i = 0; i < 3; i += 1)
4
        FILE[i] = 0;
5
    for (i = 0; i < 3; i += 1)
6
    {
7
        FILE[i] = 0;
8
        NAME[i] = 
[EMPTY]
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("DEVICE_MENU_slash_Create_0_gml_97_0")
;
9
        TIME[i] = 0;
10
        PLACE[i] = "------------";
11
        LEVEL[i] = 0;
12
        TIME_STRING[i] = "--:--";
13
        INITLANG[i] = 0;
14
    }
15
    if (ossafe_file_exists("filech1_0"))
16
    {
17
        FILE[0] = 1;
18
        NAME[0] = 
FILE0
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("DEVICE_MENU_slash_Create_0_gml_107_0")
;
19
    }
20
    if (ossafe_file_exists("filech1_1"))
21
    {
22
        FILE[1] = 1;
23
        NAME[1] = 
FILE1
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("DEVICE_MENU_slash_Create_0_gml_112_0")
;
24
    }
25
    if (ossafe_file_exists("filech1_2"))
26
    {
27
        FILE[2] = 1;
28
        NAME[2] = 
FILE2
scr_84_get_lang_string
scr_84_get_lang_string

function
scr_84_get_lang_string(arg0)
{ return ds_map_find_value(global.lang_map, arg0); }
("DEVICE_MENU_slash_Create_0_gml_117_0")
;
29
    }
30
    if (ossafe_file_exists("dr.ini"))
31
    {
32
        ossafe_ini_open("dr.ini");
33
        for (i = 0; i < 3; i += 1)
34
        {
35
            if (FILE[i] == 1)
36
            {
37
                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));
38
                if (room_id < 10000)
39
                {
40
                    var valid_room_index = 
scr_get_valid_room
scr_get_valid_room

function
scr_get_valid_room(arg0, arg1, arg2 = 0)
{ var chapter = arg0; var room_id = arg1; var plot = arg2; var current_room = new scr_valid_room(
scr_get_room_by_id(room_id), plot);
var valid_rooms; if (chapter == 1) valid_rooms = [new scr_valid_room(2, 0), new scr_valid_room(35, 11), new scr_valid_room(40, 11), new scr_valid_room(45, 16), new scr_valid_room(49, 33), new scr_valid_room(59, 42), new scr_valid_room(68, 55), new scr_valid_room(71, 55), new scr_valid_room(73, 60), new scr_valid_room(82, 75), new scr_valid_room(90, 75), new scr_valid_room(96, 120), new scr_valid_room(97, 130), new scr_valid_room(107, 156), new scr_valid_room(114, 165), new scr_valid_room(123, 165), new scr_valid_room(126, 175), new scr_valid_room(111, 156), new scr_valid_room(56, 0)]; var is_valid = false; for (var i = 0; i < array_length_1d(valid_rooms); i++) { if (scr_get_id_by_room_index(current_room.room_index) == scr_get_id_by_room_index(valid_rooms[i].room_index)) { is_valid = true; break; } } if (!is_valid) { current_room.room_index++; for (var i = 0; i < array_length_1d(valid_rooms); i++) { if (scr_get_id_by_room_index(current_room.room_index) == scr_get_id_by_room_index(valid_rooms[i].room_index)) { is_valid = true; break; } } } if (!is_valid) current_room.room_index--; return current_room.room_index; } function scr_valid_room(arg0, arg1) constructor { room_index = arg0; plot = arg1; } function scr_add_valid_room(arg0, arg1, arg2) constructor { }
(global.chapter, room_id);
41
                    room_id = scr_get_id_by_room_index(valid_room_index);
42
                }
43
                var room_index = 
scr_get_room_by_id
scr_get_room_by_id

function
scr_get_room_by_id(arg0)
{ var room_id = arg0; var rooms = scr_get_room_list(); if (room_id < 10000) { room_index = room_id; var room_offset = room_index; if (room_index < 281) room_offset = 281 + room_index; room_id = room_offset; room_id += (global.chapter * 10000); } var room_index = 0; for (var i = 0; i < array_length_1d(rooms); i++) { if (rooms[i].room_id == room_id) { room_index = rooms[i].room_index; break; } } return room_index; } function scr_get_id_by_room_index(arg0) { var room_index = arg0; var rooms = scr_get_room_list(); var room_id = ROOM_INITIALIZE; for (var i = 0; i < array_length_1d(rooms); i++) { if (rooms[i].room_index == room_index) { room_id = rooms[i].room_id; break; } } return room_id; } function scr_room(arg0, arg1) constructor { room_index = arg0; room_id = arg1; } function scr_get_room_list() { var idsarr = [new scr_room(room_krisroom, 10283), new scr_room(room_krishallway, 10284), new scr_room(room_torroom, 10285), new scr_room(room_torhouse, 10286), new scr_room(room_torbathroom, 10287), new scr_room(room_town_krisyard, 10288), new scr_room(room_town_northwest, 10289), new scr_room(room_town_north, 10290), new scr_room(room_beach, 10291), new scr_room(room_town_mid, 10292), new scr_room(room_town_apartments, 10293), new scr_room(room_town_south, 10294), new scr_room(room_town_school, 10295), new scr_room(room_town_church, 10296), new scr_room(room_graveyard, 10297), new scr_room(room_town_shelter, 10298), new scr_room(room_hospital_lobby, 10299), new scr_room(room_hospital_hallway, 10300), new scr_room(room_hospital_rudy, 10301), new scr_room(room_hospital_room2, 10302), new scr_room(room_diner, 10303), new scr_room(room_townhall, 10304), new scr_room(room_flowershop_1f, 10305), new scr_room(room_flowershop_2f, 10306), new scr_room(room_library, 10307), new scr_room(room_alphysalley, 10308), new scr_room(room_torielclass, 10309), new scr_room(room_schoollobby, 10310), new scr_room(room_alphysclass, 10311), new scr_room(room_schooldoor, 10312), new scr_room(room_insidecloset, 10313), new scr_room(room_school_unusedroom, 10314), new scr_room(room_dark1, 10315), new scr_room(room_dark1a, 10316), new scr_room(room_dark2, 10317), new scr_room(room_dark3, 10318), new scr_room(room_dark3a, 10319), new scr_room(room_dark_wobbles, 10320), new scr_room(room_dark_eyepuzzle, 10321), new scr_room(room_dark7, 10322), new scr_room(room_dark_chase1, 10323), new scr_room(room_dark_chase2, 10324), new scr_room(room_castle_outskirts, 10325), new scr_room(room_castle_town, 10326), new scr_room(room_castle_front, 10327), new scr_room(room_castle_tutorial, 10328), new scr_room(room_castle_darkdoor, 10329), new scr_room(room_field_start, 10330), new scr_room(room_field_forest, 10331), new scr_room(room_field1, 10332), new scr_room(room_field2, 10333), new scr_room(room_field2A, 10334), new scr_room(room_field_topchef, 10335), new scr_room(room_field_puzzle1, 10336), new scr_room(room_field_maze, 10337), new scr_room(room_field_puzzle2, 10338), new scr_room(room_field_getsusie, 10339), new scr_room(room_field_shop1, 10340), new scr_room(room_field_puzzletutorial, 10341), new scr_room(room_field3, 10342), new scr_room(room_field_boxpuzzle, 10343), new scr_room(room_field4, 10344), new scr_room(room_field_secret1, 10345), new scr_room(room_field_checkers4, 10346), new scr_room(room_field_checkers2, 10347), new scr_room(room_field_checkers6, 10348), new scr_room(room_field_checkers3, 10349), new scr_room(room_field_checkers1, 10350), new scr_room(room_field_checkers5, 10351), new scr_room(room_field_checkers7, 10352), new scr_room(room_field_checkersboss, 10353), new scr_room(room_forest_savepoint1, 10354), new scr_room(room_forest_area0, 10355), new scr_room(room_forest_area1, 10356), new scr_room(room_forest_area2, 10357), new scr_room(room_forest_area2A, 10358), new scr_room(room_forest_puzzle1, 10359), new scr_room(room_forest_beforeclover, 10360), new scr_room(room_forest_area3A, 10361), new scr_room(room_forest_area3, 10362), new scr_room(room_forest_savepoint2, 10363), new scr_room(room_forest_smith, 10364), new scr_room(room_forest_area4, 10365), new scr_room(room_forest_dancers1, 10366), new scr_room(room_forest_secret1, 10367), new scr_room(room_forest_thrashmaker, 10368), new scr_room(room_forest_starwalker, 10369), new scr_room(room_forest_area5, 10370), new scr_room(room_forest_savepoint_relax, 10371), new scr_room(room_forest_maze1, 10372), new scr_room(room_forest_maze_deadend, 10373), new scr_room(room_forest_maze_susie, 10374), new scr_room(room_forest_maze2, 10375), new scr_room(room_forest_maze_deadend2, 10376), new scr_room(room_forest_savepoint3, 10377), new scr_room(room_forest_fightsusie, 10378), new scr_room(room_forest_afterthrash2, 10379), new scr_room(room_forest_afterthrash3, 10380), new scr_room(room_forest_afterthrash4, 10381), new scr_room(room_forest_castleview, 10382), new scr_room(room_forest_chase1, 10383), new scr_room(room_forest_chase2, 10384), new scr_room(room_forest_castlefront, 10385), new scr_room(room_cc_prison_cells, 10386), new scr_room(room_cc_prisonlancer, 10387), new scr_room(room_cc_prison_to_elevator, 10388), new scr_room(room_cc_prison2, 10389), new scr_room(room_cc_prisonelevator, 10390), new scr_room(room_cc_elevator, 10391), new scr_room(room_cc_prison_prejoker, 10392), new scr_room(room_cc_joker, 10393), new scr_room(room_cc_entrance, 10394), new scr_room(room_cc_1f, 10395), new scr_room(room_cc_rudinn, 10396), new scr_room(room_cc_2f, 10397), new scr_room(room_cc_rurus1, 10398), new scr_room(room_cc_3f, 10399), new scr_room(room_cc_hathy, 10400), new scr_room(room_cc_4f, 10401), new scr_room(room_cc_rurus2, 10402), new scr_room(room_cc_clover, 10403), new scr_room(room_cc_5f, 10404), new scr_room(room_cc_lancer, 10405), new scr_room(room_cc_6f, 10406), new scr_room(room_cc_throneroom, 10407), new scr_room(room_cc_preroof, 10408), new scr_room(room_cc_kingbattle, 10409), new scr_room(room_cc_prefountain, 10410), new scr_room(room_cc_fountain, 10411), new scr_room(room_empty, 10422), new scr_room(room_man, 10423)]; return idsarr; }
(room_id);
44
                PLACE[i] = 
scr_roomname
scr_roomname

function
scr_roomname(arg0)
{ roomname = " "; if (arg0 == 0) roomname = "---"; if (arg0 == 2) roomname =
Kris's Room
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_3_0")
;
if (arg0 == 35) roomname =
??????
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_4_0")
;
if (arg0 == 40) roomname =
Eye Puzzle
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_5_0")
;
if (arg0 == 45) roomname =
Castle Town
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_6_0")
;
if (arg0 == 49) roomname =
Field - Great Door
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_7_0")
;
if (arg0 == 59) roomname =
Field - Seam's Shop
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_8_0")
;
if (arg0 == 68) roomname =
Field - Great Board
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_9_0")
;
if (arg0 == 71) roomname =
Field - Great Board 2
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_10_0")
;
if (arg0 == 73) roomname =
Forest - Entrance
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_11_0")
;
if (arg0 == 82) roomname =
Forest - Bake Sale
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_12_0")
;
if (arg0 == 90) roomname =
Forest - Before Maze
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_13_0")
;
if (arg0 == 96) roomname =
Forest - After Maze
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_14_0")
;
if (arg0 == 97) roomname =
Forest - Thrashing Room
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_15_0")
;
if (arg0 == 107) roomname =
Card Castle - Prison
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_16_0")
;
if (arg0 == 114) roomname =
Card Castle - 1F
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_17_0")
;
if (arg0 == 123) roomname =
Card Castle - 5F
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_18_0")
;
if (arg0 == 126) roomname =
Card Castle - Throne
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_19_0")
;
if (arg0 == 111) roomname =
Card Castle - ???
scr_84_get_lang_string("scr_roomname_slash_scr_roomname_gml_20_0")
;
if (arg0 == 56) { if (global.lang == "en") roomname = "Field - Maze of Death"; if (global.lang == "ja") roomname = "平原 - 死の迷路"; } return roomname; }
(room_index);
45
                TIME[i] = ini_read_real("G" + string(i), "Time", 0);
46
                NAME[i] = ini_read_string("G" + string(i), "Name", "------");
47
                LEVEL[i] = 1;
48
                INITLANG[i] = ini_read_real("G" + string(i), "InitLang", 0);
49
                TIME_SECONDS_TOTAL[i] = floor(TIME[i] / 30);
50
                TIME_MINUTES[i] = floor(TIME_SECONDS_TOTAL[i] / 60);
51
                TIME_SECONDS[i] = TIME_SECONDS_TOTAL[i] - (TIME_MINUTES[i] * 60);
52
                TIME_SECONDS_STRING[i] = string(TIME_SECONDS[i]);
53
                if (TIME_SECONDS[i] == 0)
54
                    TIME_SECONDS_STRING[i] = "00";
55
                if (TIME_SECONDS[i] < 10 && TIME_SECONDS[i] >= 1)
56
                    TIME_SECONDS_STRING[i] = "0" + string(TIME_SECONDS[i]);
57
                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]);
58
            }
59
        }
60
        ossafe_ini_close();
61
        ossafe_savedata_save();
62
    }
63
}