Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_debug_battle_Step_1

(view raw script w/o annotations or w/e)
1
script_execute(gml_Script_scr_controls_debug_battle)
2
if key_debug
3
{
4
    if (global.debug_toggle == true)
5
        global.debug_toggle = false
6
    else
7
        global.debug_toggle = true
8
}
9
if (global.debug_toggle == true)
10
{
11
    if (key_slow || key_slow_right || (!key_fast_left))
12
    {
13
        key_fast_left = 0
14
        key_fast_ct_left = 0
15
    }
16
    if (key_slow || key_slow_left || (!key_fast_right))
17
    {
18
        key_fast_right = 0
19
        key_fast_ct_right = 0
20
    }
21
    if key_fast_left
22
    {
23
        key_fast_ct_left += 1
24
        if (key_fast_ct_left < key_fast_ct_limit)
25
            key_fast_left = 0
26
        else
27
            key_fast_ct_left = key_fast_ct_limit
28
    }
29
    if key_fast_right
30
    {
31
        key_fast_ct_right += 1
32
        if (key_fast_ct_right < key_fast_ct_limit)
33
            key_fast_right = 0
34
        else
35
            key_fast_ct_right = key_fast_ct_limit
36
    }
37
    if key_reset
38
        game_restart()
39
    if key_fps3
40
        room_speed = 3
41
    else if key_fps30
42
        room_speed = 30
43
    else if key_fps60
44
        room_speed = 60
45
    if (seldepth_main == 0)
46
    {
47
        var key_vert = key_down - key_up
48
        selnum_main += key_vert
49
        if (selnum_main > selmax_main)
50
            selnum_main = selnum_disjoint
51
        if (selnum_main < selnum_disjoint)
52
            selnum_main = selmax_main
53
        if key_select
54
        {
55
            if (selnum_main == 6)
56
                instance_create(0, 0, obj_battle_fade_out_screen)
57
            else if (selnum_main == 7)
58
                game_restart()
59
            else
60
            {
61
                event_user(0)
62
                seldepth_main += 1
63
            }
64
        }
65
    }
66
    else if (seldepth_main == 1)
67
    {
68
        if (selnum_main == 0)
69
        {
70
            key_vert = key_down - key_up
71
            selnumh_world += key_vert
72
            var array_max = array_length_1d(selnuml_world) - 1
73
            if (selnumh_world > array_max)
74
                selnumh_world = 0
75
            if (selnumh_world < 0)
76
                selnumh_world = array_max
77
            var key_hor = sign(key_right - key_left + (key_fast_right - key_fast_left))
78
            selnuml_world[selnumh_world] += key_hor
79
            array_max = (array_length_2d(world_room, selnumh_world)) - 1
80
            if (selnuml_world[selnumh_world] > array_max)
81
                selnuml_world[selnumh_world] = 0
82
            if (selnuml_world[selnumh_world] < 0)
83
                selnuml_world[selnumh_world] = array_max
84
            if key_select
85
            {
86
                if instance_exists(obj_room_special_holder)
87
                {
88
                    with (obj_room_special_holder)
89
                        instance_destroy()
90
                }
91
                instance_create(0, 0, obj_room_special_holder)
92
                with (obj_room_special_holder)
93
                {
94
                    var h = obj_debug_overworld.selnumh_world
95
                    var l = obj_debug_overworld.selnuml_world[h]
96
                    player_x = obj_debug_overworld.world_x[h][l]
97
                    player_y = obj_debug_overworld.world_y[h][l]
98
                    player_direction = "down"
99
                    next_room = obj_debug_overworld.world_room[h][l]
100
                }
101
                with (obj_frisk)
102
                {
103
                    instance_create(__view_get((0 << 0), 0), __view_get((1 << 0), 0), obj_overworld_room_special_fade_out_screen)
104
                    moveable = false
105
                    event = true
106
                }
107
            }
108
            else if key_revert
109
                seldepth_main -= 1
110
        }
111
        else if (selnum_main == 1)
112
        {
113
            key_vert = key_down - key_up
114
            selnumh_enemy += key_vert
115
            array_max = array_length_1d(selnuml_enemy) - 1
116
            if (selnumh_enemy > array_max)
117
                selnumh_enemy = 0
118
            if (selnumh_enemy < 0)
119
                selnumh_enemy = array_max
120
            key_hor = sign(key_right - key_left + (key_fast_right - key_fast_left))
121
            selnuml_enemy[selnumh_enemy] += key_hor
122
            array_max = (array_length_2d(enemy, selnumh_enemy)) - 1
123
            if (selnuml_enemy[selnumh_enemy] > array_max)
124
                selnuml_enemy[selnumh_enemy] = 0
125
            if (selnuml_enemy[selnumh_enemy] < 0)
126
                selnuml_enemy[selnumh_enemy] = array_max
127
            if key_select
128
            {
129
                var selection_enemy = enemy[selnumh_enemy][selnuml_enemy[selnumh_enemy]]
130
                if (selection_enemy == "dalv normal")
131
                {
132
                    global.route = 1
133
                    global.melancholy[1] = false
134
                    global.battle_enemy_name = "dalv"
135
                }
136
                else if (selection_enemy == "dalv melancholy")
137
                {
138
                    global.melancholy[1] = true
139
                    global.battle_enemy_name = "dalv"
140
                }
141
                else if (selection_enemy == "dalv genocide")
142
                {
143
                    global.route = 3
144
                    global.battle_enemy_name = "dalv"
145
                }
146
                else
147
                    global.battle_enemy_name = selection_enemy
148
                switch global.battle_enemy_name
149
                {
150
                    case "froggit intro":
151
                    case "flowey intro":
152
                    case "decibat":
153
                    case "micro froggit":
154
                    case "dalv":
155
                    case "martlet pacifist":
156
                    case "martlet genocide":
157
                    case "shufflers":
158
                    case "el bailador":
159
                    case "dummy training pacifist":
160
                        global.exclamation_mark_type = "nothing"
161
                        global.battling_enemy = false
162
                        global.battling_boss = true
163
                        global.battle_start = true
164
                        break
165
                    default:
166
                        global.exclamation_mark_type = "normal"
167
                        global.battling_enemy = true
168
                        global.battling_boss = false
169
                        global.battle_start = true
170
                }
171
172
            }
173
            else if key_revert
174
                seldepth_main -= 1
175
        }
176
        else if (selnum_main == 2)
177
        {
178
            key_vert = key_down - key_up
179
            selnumh_shop += key_vert
180
            array_max = array_length_1d(selnuml_shop) - 1
181
            if (selnumh_shop > array_max)
182
                selnumh_shop = 0
183
            if (selnumh_shop < 0)
184
                selnumh_shop = array_max
185
            key_hor = sign(key_right - key_left + (key_fast_right - key_fast_left))
186
            selnuml_shop[selnumh_shop] += key_hor
187
            array_max = (array_length_2d(shop, selnumh_shop)) - 1
188
            if (selnuml_shop[selnumh_shop] > array_max)
189
                selnuml_shop[selnumh_shop] = 0
190
            if (selnuml_shop[selnumh_shop] < 0)
191
                selnuml_shop[selnumh_shop] = array_max
192
            if key_select
193
            {
194
                global.shop_name = shop[selnumh_shop][selnuml_shop[selnumh_shop]]
195
                switch global.shop_name
196
                {
197
                    case "Honeydew Resort Normal":
198
                        global.sound_carry_overworld = true
199
                        break
200
                }
201
202
                instance_create(__view_get((0 << 0), 0), __view_get((1 << 0), 0), obj_overworld_shop_fade_out_screen)
203
                with (obj_frisk)
204
                {
205
                    moveable = false
206
                    event = true
207
                }
208
            }
209
            else if key_revert
210
                seldepth_main -= 1
211
        }
212
        else if (selnum_main == 3)
213
        {
214
            key_vert = key_down - key_up
215
            selnumh_item += key_vert
216
            array_max = array_length_1d(selnuml_item) - 1
217
            if (selnumh_item > array_max)
218
                selnumh_item = 0
219
            if (selnumh_item < 0)
220
                selnumh_item = array_max
221
            key_hor = sign(key_right - key_left + (key_fast_right - key_fast_left))
222
            selnuml_item[selnumh_item] += key_hor
223
            array_max = (array_length_2d(item, selnumh_item)) - 1
224
            if (selnuml_item[selnumh_item] > array_max)
225
                selnuml_item[selnumh_item] = 0
226
            if (selnuml_item[selnumh_item] < 0)
227
                selnuml_item[selnumh_item] = array_max
228
            if key_select
229
            {
230
                global.item_hold_take = item[selnumh_item][selnuml_item[selnumh_item]]
231
                script_execute(scr_item_take_check)
232
                if (can_take == true)
233
                    audio_play_sound(snd_shop_purchase, 20, false)
234
                else
235
                    audio_play_sound(snd_hurt, 20, false)
236
            }
237
            else if key_revert
238
                seldepth_main -= 1
239
        }
240
        else if (selnum_main == 4)
241
        {
242
            key_vert = key_down - key_up
243
            selnumh_equip += key_vert
244
            array_max = array_length_1d(selnuml_equip) - 1
245
            if (selnumh_equip > array_max)
246
                selnumh_equip = 0
247
            if (selnumh_equip < 0)
248
                selnumh_equip = array_max
249
            key_hor = sign(key_right - key_left + (key_fast_right - key_fast_left))
250
            selnuml_equip[selnumh_equip] += key_hor
251
            array_max = (array_length_2d(item, (selnumh_equip + equip_disjoint))) - 1
252
            if (selnuml_equip[selnumh_equip] > array_max)
253
                selnuml_equip[selnumh_equip] = 0
254
            if (selnuml_equip[selnumh_equip] < 0)
255
                selnuml_equip[selnumh_equip] = array_max
256
            if key_select
257
            {
258
                if (selnumh_equip == 0)
259
                {
260
                    global.player_weapon = item[(selnumh_equip + equip_disjoint)][selnuml_equip[selnumh_equip]]
261
                    global.player_weapon_attack = script_execute(gml_Script_scr_determine_weapon_attack)
262
                }
263
                else if (selnumh_equip == 1)
264
                {
265
                    global.player_armor = item[(selnumh_equip + equip_disjoint)][selnuml_equip[selnumh_equip]]
266
                    global.player_armor_defense = script_execute(gml_Script_scr_determine_armor_defense)
267
                }
268
                else if (selnumh_equip == 2)
269
                {
270
                    global.player_weapon_modifier = item[(selnumh_equip + equip_disjoint)][selnuml_equip[selnumh_equip]]
271
                    global.player_weapon_modifier_attack = script_execute(gml_Script_scr_determine_weapon_modifier_attack)
272
                }
273
                else if (selnumh_equip == 3)
274
                {
275
                    global.player_armor_modifier = item[(selnumh_equip + equip_disjoint)][selnuml_equip[selnumh_equip]]
276
                    global.player_armor_modifier_defense = script_execute(gml_Script_scr_determine_armor_modifier_defense)
277
                }
278
                audio_play_sound(snd_battle_item_equip, 20, false)
279
            }
280
            else if key_revert
281
                seldepth_main -= 1
282
        }
283
        else if (selnum_main == 5)
284
        {
285
            key_vert = key_down - key_up
286
            selnumh_stat += key_vert
287
            array_max = array_length_1d(selnuml_stat) - 1
288
            if (selnumh_stat > array_max)
289
                selnumh_stat = 0
290
            if (selnumh_stat < 0)
291
                selnumh_stat = array_max
292
            key_hor = sign(key_right - key_left + (key_fast_right - key_fast_left))
293
            selnuml_stat[selnumh_stat] += key_hor
294
            var array_min = stat[selnumh_stat][0]
295
            array_max = stat[selnumh_stat][1]
296
            if (selnuml_stat[selnumh_stat] > array_max)
297
                selnuml_stat[selnumh_stat] = array_min
298
            if (selnuml_stat[selnumh_stat] < array_min)
299
                selnuml_stat[selnumh_stat] = array_max
300
            if key_select
301
            {
302
                h = selnumh_stat
303
                l = selnuml_stat[h]
304
                if (h == 0)
305
                {
306
                    global.player_level = l
307
                    global.max_hp_self = global.player_hp_next[l]
308
                    global.current_hp_self = global.max_hp_self
309
                    global.player_attack = global.player_attack_next[l]
310
                    global.player_defense = global.player_defense_next[l]
311
                    if (global.player_level == 1)
312
                        global.player_exp = 0
313
                    else
314
                        global.player_exp = global.player_exp_next[(l - 1)]
315
                    stat[2][1] = global.max_hp_self
316
                    selnuml_stat[2] = global.current_hp_self
317
                    audio_play_sound(snd_love_increased, 20, false)
318
                }
319
                else if (h == 1)
320
                {
321
                    global.player_gold = l
322
                    audio_play_sound(snd_battle_item_weapon_select, 20, false)
323
                }
324
                else if (h == 2)
325
                {
326
                    global.current_hp_self = l
327
                    audio_play_sound(snd_battle_item_eat, 20, false)
328
                }
329
                else if (h == 3)
330
                {
331
                    global.current_pp_self = l
332
                    audio_play_sound(snd_battle_item_eat, 20, false)
333
                }
334
                else if (h == 4)
335
                {
336
                    global.current_sp_self = l
337
                    audio_play_sound(snd_battle_item_eat, 20, false)
338
                }
339
            }
340
            else if key_revert
341
                seldepth_main -= 1
342
        }
343
    }
344
}