Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_savegame

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

function scr_savegame() //gml_Script_scr_savegame { if file_exists("Save.sav") file_delete("Save.sav") ini_open("Save.sav") var SavedRoom = room_get_name(room) ini_write_string("Save1", "room", SavedRoom) ini_write_real("Save1", "pX", obj_pl.x) ini_write_real("Save1", "pY", obj_pl.y) ini_write_real("Save1", "dir", obj_pl.direction) SavedRoom = room ini_write_real("Save1", "HP", global.current_hp_self) ini_write_real("Save1", "MAXHP", global.max_hp_self) ini_write_real("Save1", "PP", global.current_pp_self) ini_write_real("Save1", "MAXPP", global.max_pp_self) ini_write_real("Save1", "SP", global.current_sp_self) ini_write_real("Save1", "MAXSP", global.max_sp_self) ini_write_real("Save1", "RP", global.current_rp_self) ini_write_real("Save1", "MAXRP", global.max_rp_self) ini_write_real("Save1", "AT - Primary", global.player_attack) ini_write_real("Save1", "AT - Secondary", global.player_weapon_modifier_attack) ini_write_real("Save1", "DFP", global.player_defense) ini_write_real("Save1", "DFS", global.player_armor_modifier_defense) ini_write_real("Save1", "LV", global.player_level) ini_write_real("Save1", "EXP", global.player_exp) ini_write_real("Save1", "Gold", global.player_gold) ini_write_string("Save1", "Armor", global.player_armor) ini_write_string("Save1", "Weapon", global.player_weapon) ini_write_string("Save1", "Ammo", global.player_weapon_modifier) ini_write_string("Save1", "Accessory", global.player_armor_modifier) ini_write_string("Save1", "rmName", global.saveroom) ini_write_string("Save1", "playerSprite", global.player_sprites) ini_write_real("Save1", "playerCanRun", global.player_can_run) if (global.party_member == noone) ini_write_string("Save1", "Follower", "noone") else ini_write_string("Save1", "Follower", object_get_name(global.party_member)) ini_write_real("Save1", "Satchel", global.player_has_satchel) ini_write_real("Save1", "FTravel", global.player_can_travel) scr_determine_playtime() ini_write_real("Playtime", "Seconds", global.elapsed_seconds) var ds_list_encounters = ds_list_write(global.encounter_list) ini_write_string("Encounters", "0", ds_list_encounters) var ds_list_steal = ds_list_write(global.steal_list) ini_write_string("Steal", "0", ds_list_steal) var ds_list_fasttravel = ds_list_write(global.fast_travel_list) ini_write_string("FastTravel", "0", ds_list_fasttravel) var inv1 = global.item_slot[1] ini_write_string("Items", "00", global.item_slot[1]) ini_write_string("Items", "01", global.item_slot[2]) ini_write_string("Items", "02", global.item_slot[3]) ini_write_string("Items", "03", global.item_slot[4]) ini_write_string("Items", "04", global.item_slot[5]) ini_write_string("Items", "05", global.item_slot[6]) ini_write_string("Items", "06", global.item_slot[7]) ini_write_string("Items", "07", global.item_slot[8]) var ds_list_string = ds_list_write(global.box_slot_list) ini_write_string("DBox", "0", ds_list_string) ini_write_real("Misc", "01", global.tinypuzzle) for (var i = 0; i < array_length_1d(global.ruins_flag); i++) ini_write_real("RuinsFlags", string(i), global.ruins_flag[i]) for (i = 0; i < array_length_1d(global.flag); i++) ini_write_real("Flags", string(i), global.flag[i]) for (i = 0; i < array_length_1d(global.snowdin_flag); i++) ini_write_real("SnowdinFlags", string(i), global.snowdin_flag[i]) for (i = 0; i < array_length_1d(global.dunes_flag); i++) ini_write_real("DunesFlags", string(i), global.dunes_flag[i]) for (i = 0; i < array_length_1d(global.dunes_flag_ext); i++) ini_write_real("DunesFlagsExt", string(i), global.dunes_flag_ext[i]) for (i = 0; i < array_length_1d(global.sworks_flag); i++) ini_write_real("SworksFlags", string(i), global.sworks_flag[i]) ini_write_string("SworksFlags", "code", global.factory_code) ds_list_string = ds_list_write(global.factory_code_2) ini_write_string("SworksFlags", "code2", ds_list_string) ini_write_string("SworksFlags", "code3", global.factory_code_3) ini_write_real("SworksFlags", "RbCount", global.sworks_robot_count) for (i = 0; i < global.sworks_robot_count; i++) { ini_write_real("RbSprite", string(i), global.sworks_robot_sprite[i]) ini_write_real("RbX", string(i), global.sworks_robot_x[i]) ini_write_real("RbY", string(i), global.sworks_robot_y[i]) ini_write_real("RbD", string(i), global.sworks_robot_depth[i]) ini_write_real("RbS", string(i), global.sworks_robot_scale[i]) ini_write_real("RbA", string(i), global.sworks_robot_angle[i]) } ini_write_string("SworksFlags", "sworks_id", ds_grid_write(global.sworks_id_grid)) for (i = 0; i < array_length_1d(global.item_stock); i++) ini_write_real("ItemStock", string(i), global.item_stock[i]) for (i = 0; i < array_length_1d(global.hotland_flag); i++) ini_write_real("HotlandFlags", string(i), global.hotland_flag[i]) for (i = 0; i < array_length_1d(global.flowey_flag); i++) ini_write_real("FloweyFlags", string(i), global.flowey_flag[i]) ini_write_real("FloweyFlags", "savenumber", global.flowey_save_number) ini_write_real("FloweyFlags", "savecount", global.save_count) for (i = 0; i < array_length_1d(global.extra_flag); i++) ini_write_real("ExtraFlags", string(i), global.extra_flag[i]) for (i = 0; i < array_length_1d(global.mail_flag); i++) ini_write_real("MailFlags", string(i), global.mail_flag[i]) ds_list_string = ds_list_write(global.mail_list) ini_write_string("Mail", "0", ds_list_string) ds_list_string = ds_list_write(global.mail_unclaimed_list) ...
() //gml_Script_scr_savegame
2
{
3
    if file_exists("Save.sav")
4
        file_delete("Save.sav")
5
    ini_open("Save.sav")
6
    var SavedRoom = room_get_name(room)
7
    ini_write_string("Save1", "room", SavedRoom)
8
    ini_write_real("Save1", "pX", obj_pl.x)
9
    ini_write_real("Save1", "pY", obj_pl.y)
10
    ini_write_real("Save1", "dir", obj_pl.direction)
11
    SavedRoom = room
12
    ini_write_real("Save1", "HP", global.current_hp_self)
13
    ini_write_real("Save1", "MAXHP", global.max_hp_self)
14
    ini_write_real("Save1", "PP", global.current_pp_self)
15
    ini_write_real("Save1", "MAXPP", global.max_pp_self)
16
    ini_write_real("Save1", "SP", global.current_sp_self)
17
    ini_write_real("Save1", "MAXSP", global.max_sp_self)
18
    ini_write_real("Save1", "RP", global.current_rp_self)
19
    ini_write_real("Save1", "MAXRP", global.max_rp_self)
20
    ini_write_real("Save1", "AT - Primary", global.player_attack)
21
    ini_write_real("Save1", "AT - Secondary", global.player_weapon_modifier_attack)
22
    ini_write_real("Save1", "DFP", global.player_defense)
23
    ini_write_real("Save1", "DFS", global.player_armor_modifier_defense)
24
    ini_write_real("Save1", "LV", global.player_level)
25
    ini_write_real("Save1", "EXP", global.player_exp)
26
    ini_write_real("Save1", "Gold", global.player_gold)
27
    ini_write_string("Save1", "Armor", global.player_armor)
28
    ini_write_string("Save1", "Weapon", global.player_weapon)
29
    ini_write_string("Save1", "Ammo", global.player_weapon_modifier)
30
    ini_write_string("Save1", "Accessory", global.player_armor_modifier)
31
    ini_write_string("Save1", "rmName", global.saveroom)
32
    ini_write_string("Save1", "playerSprite", global.player_sprites)
33
    ini_write_real("Save1", "playerCanRun", global.player_can_run)
34
    if (global.party_member == noone)
35
        ini_write_string("Save1", "Follower", "noone")
36
    else
37
        ini_write_string("Save1", "Follower", object_get_name(global.party_member))
38
    ini_write_real("Save1", "Satchel", global.player_has_satchel)
39
    ini_write_real("Save1", "FTravel", global.player_can_travel)
40
    scr_determine_playtime
scr_determine_playtime

function scr_determine_playtime() //gml_Script_scr_determine_playtime { var time_new = date_current_datetime() var time_difference = floor(date_second_span(global.saved_datetime, time_new)) global.elapsed_seconds += time_difference global.saved_datetime = time_new }
()
41
    ini_write_real("Playtime", "Seconds", global.elapsed_seconds)
42
    var ds_list_encounters = ds_list_write(global.encounter_list)
43
    ini_write_string("Encounters", "0", ds_list_encounters)
44
    var ds_list_steal = ds_list_write(global.steal_list)
45
    ini_write_string("Steal", "0", ds_list_steal)
46
    var ds_list_fasttravel = ds_list_write(global.fast_travel_list)
47
    ini_write_string("FastTravel", "0", ds_list_fasttravel)
48
    var inv1 = global.item_slot[1]
49
    ini_write_string("Items", "00", global.item_slot[1])
50
    ini_write_string("Items", "01", global.item_slot[2])
51
    ini_write_string("Items", "02", global.item_slot[3])
52
    ini_write_string("Items", "03", global.item_slot[4])
53
    ini_write_string("Items", "04", global.item_slot[5])
54
    ini_write_string("Items", "05", global.item_slot[6])
55
    ini_write_string("Items", "06", global.item_slot[7])
56
    ini_write_string("Items", "07", global.item_slot[8])
57
    var ds_list_string = ds_list_write(global.box_slot_list)
58
    ini_write_string("DBox", "0", ds_list_string)
59
    ini_write_real("Misc", "01", global.tinypuzzle)
60
    for (var i = 0; i < array_length_1d(global.ruins_flag); i++)
61
        ini_write_real("RuinsFlags", string(i), global.ruins_flag[i])
62
    for (i = 0; i < array_length_1d(global.flag); i++)
63
        ini_write_real("Flags", string(i), global.flag[i])
64
    for (i = 0; i < array_length_1d(global.snowdin_flag); i++)
65
        ini_write_real("SnowdinFlags", string(i), global.snowdin_flag[i])
66
    for (i = 0; i < array_length_1d(global.dunes_flag); i++)
67
        ini_write_real("DunesFlags", string(i), global.dunes_flag[i])
68
    for (i = 0; i < array_length_1d(global.dunes_flag_ext); i++)
69
        ini_write_real("DunesFlagsExt", string(i), global.dunes_flag_ext[i])
70
    for (i = 0; i < array_length_1d(global.sworks_flag); i++)
71
        ini_write_real("SworksFlags", string(i), global.sworks_flag[i])
72
    ini_write_string("SworksFlags", "code", global.factory_code)
73
    ds_list_string = ds_list_write(global.factory_code_2)
74
    ini_write_string("SworksFlags", "code2", ds_list_string)
75
    ini_write_string("SworksFlags", "code3", global.factory_code_3)
76
    ini_write_real("SworksFlags", "RbCount", global.sworks_robot_count)
77
    for (i = 0; i < global.sworks_robot_count; i++)
78
    {
79
        ini_write_real("RbSprite", string(i), global.sworks_robot_sprite[i])
80
        ini_write_real("RbX", string(i), global.sworks_robot_x[i])
81
        ini_write_real("RbY", string(i), global.sworks_robot_y[i])
82
        ini_write_real("RbD", string(i), global.sworks_robot_depth[i])
83
        ini_write_real("RbS", string(i), global.sworks_robot_scale[i])
84
        ini_write_real("RbA", string(i), global.sworks_robot_angle[i])
85
    }
86
    ini_write_string("SworksFlags", "sworks_id", ds_grid_write(global.sworks_id_grid))
87
    for (i = 0; i < array_length_1d(global.item_stock); i++)
88
        ini_write_real("ItemStock", string(i), global.item_stock[i])
89
    for (i = 0; i < array_length_1d(global.hotland_flag); i++)
90
        ini_write_real("HotlandFlags", string(i), global.hotland_flag[i])
91
    for (i = 0; i < array_length_1d(global.flowey_flag); i++)
92
        ini_write_real("FloweyFlags", string(i), global.flowey_flag[i])
93
    ini_write_real("FloweyFlags", "savenumber", global.flowey_save_number)
94
    ini_write_real("FloweyFlags", "savecount", global.save_count)
95
    for (i = 0; i < array_length_1d(global.extra_flag); i++)
96
        ini_write_real("ExtraFlags", string(i), global.extra_flag[i])
97
    for (i = 0; i < array_length_1d(global.mail_flag); i++)
98
        ini_write_real("MailFlags", string(i), global.mail_flag[i])
99
    ds_list_string = ds_list_write(global.mail_list)
100
    ini_write_string("Mail", "0", ds_list_string)
101
    ds_list_string = ds_list_write(global.mail_unclaimed_list)
102
    ini_write_string("MailUnclaimed", "0", ds_list_string)
103
    ds_list_string = ds_list_write(global.mail_list_read)
104
    ini_write_string("Mail", "3", ds_list_string)
105
    ini_write_real("Mail", "1", global.mail_count)
106
    ini_write_real("Mail", "2", global.mail_pinned)
107
    for (i = 0; i <= 5; i++)
108
        ini_write_real("Misc", string(i + 2), global.sideNpc[i])
109
    var ds_map_string = ds_map_write(global.npc_map)
110
    ini_write_string("NPCs", "0", ds_map_string)
111
    var ds_talk_map_string = ds_map_write(global.talk_map)
112
    ini_write_string("Talks", "0", ds_talk_map_string)
113
    ini_write_real("Misc2", "00", global.interaction_count_wardrobe)
114
    ini_write_real("Misc2", "01", global.interaction_count_broom)
115
    ini_write_real("Misc2", "02", global.interaction_count_mini_fridge)
116
    ini_write_real("Misc2", "03", global.interaction_count_painting)
117
    ini_write_real("Misc2", "04", global.interaction_count_dalvsroom_chest)
118
    ini_write_real("Misc2", "05", global.interaction_count_flower_pot)
119
    ini_write_real("Misc2", "06", global.interaction_count_doorway_dalvshouse)
120
    ini_write_real("Misc2", "07", global.interaction_count_dalvroomhall_door)
121
    ini_write_real("Misc2", "08", global.dalv_house_enter_count)
122
    ini_write_real("Misc2", "09", global.interaction_count_books)
123
    ini_write_real("Route", "00", global.route)
124
    for (i = 1; i < array_length_1d(global.geno_complete); i++)
125
        ini_write_real("GenoComplete", i, global.geno_complete[i])
126
    for (i = 1; i < array_length_1d(global.kill_number); i++)
127
    {
128
        ini_write_real("Kills", i, global.kill_number[i])
129
        for (var j = 0; j < array_length_2d(global.kill_area, i); j++)
130
            ini_write_real("Kill Area", (string(i) + string(j)), global.kill_area[i][j])
131
    }
132
    ini_write_real("Save1", "FUN", global.fun_value)
133
    global.fun_swig_name = "Swig"
134
    for (i = 0; i < array_length(global.fun_event); i++)
135
        ini_write_real("Fun Events", string(i), global.fun_event[i])
136
    ini_write_string("Save1", "Menu", sprite_get_name(global.menu_sprite))
137
    if variable_global_exists("gold_amount_total")
138
        ini_write_real("Save1", "gldtrack", global.gold_amount_total)
139
    if variable_global_exists("gold_spent")
140
        ini_write_real("Save1", "gldspnttrack", global.gold_spent)
141
    if variable_global_exists("hit_tracker")
142
        ini_write_real("Save1", "httrack", global.hit_tracker)
143
    ini_close()
144
}