Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_battle_save

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

function scr_battle_save() //gml_Script_scr_battle_save { if file_exists("tempsave.sav") file_delete("tempsave.sav") ini_open("tempsave.sav") 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", "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", "Ammo", global.player_weapon_modifier) ini_write_string("Save1", "Weapon", global.player_weapon) 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", "ffight", global.fighting_flowey) if instance_exists(obj_radio) ini_write_real("Save1", "owms", obj_radio.bgm) 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]) if (global.battle_enemy_name == "flowey") { ini_write_real("Special", "0", global.flowey_battle_1_phase) var list_string = ds_list_write(global.flowey_attack_list) ini_write_string("Special", "1", list_string) list_string = ds_list_write(global.flowey_stolen_attack_list) ini_write_string("Special", "2", list_string) list_string = ds_list_write(global.flowey_room_list) ini_write_string("Special", "3", list_string) ini_write_real("Special", "4", global.flowey_attack_number) } else if (global.battle_enemy_name == "flowey2") { for (var i = 0; i < array_length(obj_flowey_battle_final.petal_alive); i++) ini_write_real("petal", string(i), obj_flowey_battle_final.petal_alive[i]) ini_write_real("petal", "count", obj_flowey_battle_final.petal_count) } ini_close() }
() //gml_Script_scr_battle_save
2
{
3
    if file_exists("tempsave.sav")
4
        file_delete("tempsave.sav")
5
    ini_open("tempsave.sav")
6
    ini_write_real("Save1", "HP", global.current_hp_self)
7
    ini_write_real("Save1", "MAXHP", global.max_hp_self)
8
    ini_write_real("Save1", "PP", global.current_pp_self)
9
    ini_write_real("Save1", "MAXPP", global.max_pp_self)
10
    ini_write_real("Save1", "SP", global.current_sp_self)
11
    ini_write_real("Save1", "MAXSP", global.max_sp_self)
12
    ini_write_real("Save1", "AT - Primary", global.player_attack)
13
    ini_write_real("Save1", "AT - Secondary", global.player_weapon_modifier_attack)
14
    ini_write_real("Save1", "DFP", global.player_defense)
15
    ini_write_real("Save1", "DFS", global.player_armor_modifier_defense)
16
    ini_write_real("Save1", "LV", global.player_level)
17
    ini_write_real("Save1", "EXP", global.player_exp)
18
    ini_write_real("Save1", "Gold", global.player_gold)
19
    ini_write_string("Save1", "Armor", global.player_armor)
20
    ini_write_string("Save1", "Ammo", global.player_weapon_modifier)
21
    ini_write_string("Save1", "Weapon", global.player_weapon)
22
    ini_write_string("Save1", "Accessory", global.player_armor_modifier)
23
    ini_write_string("Save1", "rmName", global.saveroom)
24
    ini_write_string("Save1", "playerSprite", global.player_sprites)
25
    ini_write_real("Save1", "ffight", global.fighting_flowey)
26
    if instance_exists(obj_radio)
27
        ini_write_real("Save1", "owms", obj_radio.bgm)
28
    var inv1 = global.item_slot[1]
29
    ini_write_string("Items", "00", global.item_slot[1])
30
    ini_write_string("Items", "01", global.item_slot[2])
31
    ini_write_string("Items", "02", global.item_slot[3])
32
    ini_write_string("Items", "03", global.item_slot[4])
33
    ini_write_string("Items", "04", global.item_slot[5])
34
    ini_write_string("Items", "05", global.item_slot[6])
35
    ini_write_string("Items", "06", global.item_slot[7])
36
    ini_write_string("Items", "07", global.item_slot[8])
37
    if (global.battle_enemy_name == "flowey")
38
    {
39
        ini_write_real("Special", "0", global.flowey_battle_1_phase)
40
        var list_string = ds_list_write(global.flowey_attack_list)
41
        ini_write_string("Special", "1", list_string)
42
        list_string = ds_list_write(global.flowey_stolen_attack_list)
43
        ini_write_string("Special", "2", list_string)
44
        list_string = ds_list_write(global.flowey_room_list)
45
        ini_write_string("Special", "3", list_string)
46
        ini_write_real("Special", "4", global.flowey_attack_number)
47
    }
48
    else if (global.battle_enemy_name == "flowey2")
49
    {
50
        for (var i = 0; i < array_length(obj_flowey_battle_final.petal_alive); i++)
51
            ini_write_real("petal", string(i), obj_flowey_battle_final.petal_alive[i])
52
        ini_write_real("petal", "count", obj_flowey_battle_final.petal_count)
53
    }
54
    ini_close()
55
}