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(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
            {
57
                instance_create(0, 0, obj_battle_fade_out_screen);
58
            }
59
            else if (selnum_main == 7)
60
            {
61
                game_restart();
62
            }
63
            else
64
            {
65
                event_user(0);
66
                seldepth_main += 1;
67
            }
68
        }
69
    }
70
    else if (seldepth_main == 1)
71
    {
72
        if (selnum_main == 0)
73
        {
74
            var key_vert = key_down - key_up;
75
            selnumh_world += key_vert;
76
            var array_max = array_length_1d(selnuml_world) - 1;
77
            if (selnumh_world > array_max)
78
                selnumh_world = 0;
79
            if (selnumh_world < 0)
80
                selnumh_world = array_max;
81
            var key_hor = sign((key_right - key_left) + (key_fast_right - key_fast_left));
82
            selnuml_world[selnumh_world] += key_hor;
83
            array_max = array_length_2d(world_room, selnumh_world) - 1;
84
            if (selnuml_world[selnumh_world] > array_max)
85
                selnuml_world[selnumh_world] = 0;
86
            if (selnuml_world[selnumh_world] < 0)
87
                selnuml_world[selnumh_world] = array_max;
88
            if (key_select)
89
            {
90
                if (instance_exists(obj_room_special_holder))
91
                {
92
                    with (obj_room_special_holder)
93
                        instance_destroy();
94
                }
95
                instance_create(0, 0, obj_room_special_holder);
96
                with (obj_room_special_holder)
97
                {
98
                    var h = obj_debug_overworld.selnumh_world;
99
                    var l = obj_debug_overworld.selnuml_world[h];
100
                    player_x = obj_debug_overworld.world_x[h][l];
101
                    player_y = obj_debug_overworld.world_y[h][l];
102
                    player_direction = "down";
103
                    next_room = obj_debug_overworld.world_room[h][l];
104
                }
105
                with (obj_frisk)
106
                {
107
                    instance_create(__view_get(e__VW.XView, 0), __view_get(e__VW.YView, 0), obj_overworld_room_special_fade_out_screen);
108
                    moveable = false;
109
                    event = true;
110
                }
111
            }
112
            else if (key_revert)
113
            {
114
                seldepth_main -= 1;
115
            }
116
        }
117
        else if (selnum_main == 1)
118
        {
119
            var key_vert = key_down - key_up;
120
            selnumh_enemy += key_vert;
121
            var array_max = array_length_1d(selnuml_enemy) - 1;
122
            if (selnumh_enemy > array_max)
123
                selnumh_enemy = 0;
124
            if (selnumh_enemy < 0)
125
                selnumh_enemy = array_max;
126
            var key_hor = sign((key_right - key_left) + (key_fast_right - key_fast_left));
127
            selnuml_enemy[selnumh_enemy] += key_hor;
128
            array_max = array_length_2d(enemy, selnumh_enemy) - 1;
129
            if (selnuml_enemy[selnumh_enemy] > array_max)
130
                selnuml_enemy[selnumh_enemy] = 0;
131
            if (selnuml_enemy[selnumh_enemy] < 0)
132
                selnuml_enemy[selnumh_enemy] = array_max;
133
            if (key_select)
134
            {
135
                var selection_enemy = enemy[selnumh_enemy][selnuml_enemy[selnumh_enemy]];
136
                if (selection_enemy == "dalv normal")
137
                {
138
                    global.route = 1;
139
                    global.melancholy[1] = false;
140
                    global.battle_enemy_name = "dalv";
141
                }
142
                else if (selection_enemy == "dalv melancholy")
143
                {
144
                    global.melancholy[1] = true;
145
                    global.battle_enemy_name = "dalv";
146
                }
147
                else if (selection_enemy == "dalv genocide")
148
                {
149
                    global.route = 3;
150
                    global.battle_enemy_name = "dalv";
151
                }
152
                else
153
                {
154
                    global.battle_enemy_name = selection_enemy;
155
                }
156
                switch (global.battle_enemy_name)
157
                {
158
                    case "froggit intro":
159
                    case "flowey intro":
160
                    case "decibat":
161
                    case "micro froggit":
162
                    case "dalv":
163
                    case "martlet pacifist":
164
                    case "martlet genocide":
165
                    case "shufflers":
166
                    case "el bailador":
167
                    case "dummy training pacifist":
168
                        global.exclamation_mark_type = "nothing";
169
                        global.battling_enemy = false;
170
                        global.battling_boss = true;
171
                        global.battle_start = true;
172
                        break;
173
                    default:
174
                        global.exclamation_mark_type = "normal";
175
                        global.battling_enemy = true;
176
                        global.battling_boss = false;
177
                        global.battle_start = true;
178
                }
179
            }
180
            else if (key_revert)
181
            {
182
                seldepth_main -= 1;
183
            }
184
        }
185
        else if (selnum_main == 2)
186
        {
187
            var key_vert = key_down - key_up;
188
            selnumh_shop += key_vert;
189
            var array_max = array_length_1d(selnuml_shop) - 1;
190
            if (selnumh_shop > array_max)
191
                selnumh_shop = 0;
192
            if (selnumh_shop < 0)
193
                selnumh_shop = array_max;
194
            var key_hor = sign((key_right - key_left) + (key_fast_right - key_fast_left));
195
            selnuml_shop[selnumh_shop] += key_hor;
196
            array_max = array_length_2d(shop, selnumh_shop) - 1;
197
            if (selnuml_shop[selnumh_shop] > array_max)
198
                selnuml_shop[selnumh_shop] = 0;
199
            if (selnuml_shop[selnumh_shop] < 0)
200
                selnuml_shop[selnumh_shop] = array_max;
201
            if (key_select)
202
            {
203
                global.shop_name = shop[selnumh_shop][selnuml_shop[selnumh_shop]];
204
                switch (global.shop_name)
205
                {
206
                    case "Honeydew Resort Normal":
207
                        global.sound_carry_overworld = true;
208
                        break;
209
                }
210
                instance_create(__view_get(e__VW.XView, 0), __view_get(e__VW.YView, 0), obj_overworld_shop_fade_out_screen);
211
                with (obj_frisk)
212
                {
213
                    moveable = false;
214
                    event = true;
215
                }
216
            }
217
            else if (key_revert)
218
            {
219
                seldepth_main -= 1;
220
            }
221
        }
222
        else if (selnum_main == 3)
223
        {
224
            var key_vert = key_down - key_up;
225
            selnumh_item += key_vert;
226
            var array_max = array_length_1d(selnuml_item) - 1;
227
            if (selnumh_item > array_max)
228
                selnumh_item = 0;
229
            if (selnumh_item < 0)
230
                selnumh_item = array_max;
231
            var key_hor = sign((key_right - key_left) + (key_fast_right - key_fast_left));
232
            selnuml_item[selnumh_item] += key_hor;
233
            array_max = array_length_2d(item, selnumh_item) - 1;
234
            if (selnuml_item[selnumh_item] > array_max)
235
                selnuml_item[selnumh_item] = 0;
236
            if (selnuml_item[selnumh_item] < 0)
237
                selnuml_item[selnumh_item] = array_max;
238
            if (key_select)
239
            {
240
                global.item_hold_take = item[selnumh_item][selnuml_item[selnumh_item]];
241
                script_execute(scr_item_take_check);
242
                if (can_take == true)
243
                    audio_play_sound(snd_shop_purchase, 20, false);
244
                else
245
                    audio_play_sound(snd_hurt, 20, false);
246
            }
247
            else if (key_revert)
248
            {
249
                seldepth_main -= 1;
250
            }
251
        }
252
        else if (selnum_main == 4)
253
        {
254
            var key_vert = key_down - key_up;
255
            selnumh_equip += key_vert;
256
            var array_max = array_length_1d(selnuml_equip) - 1;
257
            if (selnumh_equip > array_max)
258
                selnumh_equip = 0;
259
            if (selnumh_equip < 0)
260
                selnumh_equip = array_max;
261
            var key_hor = sign((key_right - key_left) + (key_fast_right - key_fast_left));
262
            selnuml_equip[selnumh_equip] += key_hor;
263
            array_max = array_length_2d(item, selnumh_equip + equip_disjoint) - 1;
264
            if (selnuml_equip[selnumh_equip] > array_max)
265
                selnuml_equip[selnumh_equip] = 0;
266
            if (selnuml_equip[selnumh_equip] < 0)
267
                selnuml_equip[selnumh_equip] = array_max;
268
            if (key_select)
269
            {
270
                if (selnumh_equip == 0)
271
                {
272
                    global.player_weapon = item[selnumh_equip + equip_disjoint][selnuml_equip[selnumh_equip]];
273
                    global.player_weapon_attack = script_execute(scr_determine_weapon_attack);
274
                }
275
                else if (selnumh_equip == 1)
276
                {
277
                    global.player_armor = item[selnumh_equip + equip_disjoint][selnuml_equip[selnumh_equip]];
278
                    global.player_armor_defense = script_execute(scr_determine_armor_defense);
279
                }
280
                else if (selnumh_equip == 2)
281
                {
282
                    global.player_weapon_modifier = item[selnumh_equip + equip_disjoint][selnuml_equip[selnumh_equip]];
283
                    global.player_weapon_modifier_attack = script_execute(scr_determine_weapon_modifier_attack);
284
                }
285
                else if (selnumh_equip == 3)
286
                {
287
                    global.player_armor_modifier = item[selnumh_equip + equip_disjoint][selnuml_equip[selnumh_equip]];
288
                    global.player_armor_modifier_defense = script_execute(scr_determine_armor_modifier_defense);
289
                }
290
                audio_play_sound(snd_battle_item_equip, 20, false);
291
            }
292
            else if (key_revert)
293
            {
294
                seldepth_main -= 1;
295
            }
296
        }
297
        else if (selnum_main == 5)
298
        {
299
            var key_vert = key_down - key_up;
300
            selnumh_stat += key_vert;
301
            var array_max = array_length_1d(selnuml_stat) - 1;
302
            if (selnumh_stat > array_max)
303
                selnumh_stat = 0;
304
            if (selnumh_stat < 0)
305
                selnumh_stat = array_max;
306
            var key_hor = sign((key_right - key_left) + (key_fast_right - key_fast_left));
307
            selnuml_stat[selnumh_stat] += key_hor;
308
            var array_min = stat[selnumh_stat][0];
309
            array_max = stat[selnumh_stat][1];
310
            if (selnuml_stat[selnumh_stat] > array_max)
311
                selnuml_stat[selnumh_stat] = array_min;
312
            if (selnuml_stat[selnumh_stat] < array_min)
313
                selnuml_stat[selnumh_stat] = array_max;
314
            if (key_select)
315
            {
316
                var h = selnumh_stat;
317
                var l = selnuml_stat[h];
318
                if (h == 0)
319
                {
320
                    global.player_level = l;
321
                    global.max_hp_self = global.player_hp_next[l];
322
                    global.current_hp_self = global.max_hp_self;
323
                    global.player_attack = global.player_attack_next[l];
324
                    global.player_defense = global.player_defense_next[l];
325
                    if (global.player_level == 1)
326
                        global.player_exp = 0;
327
                    else
328
                        global.player_exp = global.player_exp_next[l - 1];
329
                    stat[2][1] = global.max_hp_self;
330
                    selnuml_stat[2] = global.current_hp_self;
331
                    audio_play_sound(snd_love_increased, 20, false);
332
                }
333
                else if (h == 1)
334
                {
335
                    global.player_gold = l;
336
                    audio_play_sound(snd_battle_item_weapon_select, 20, false);
337
                }
338
                else if (h == 2)
339
                {
340
                    global.current_hp_self = l;
341
                    audio_play_sound(snd_battle_item_eat, 20, false);
342
                }
343
                else if (h == 3)
344
                {
345
                    global.current_pp_self = l;
346
                    audio_play_sound(snd_battle_item_eat, 20, false);
347
                }
348
                else if (h == 4)
349
                {
350
                    global.current_sp_self = l;
351
                    audio_play_sound(snd_battle_item_eat, 20, false);
352
                }
353
            }
354
            else if (key_revert)
355
            {
356
                seldepth_main -= 1;
357
            }
358
        }
359
    }
360
}
361
362
enum e__VW
363
{
364
    XView,
365
    YView,
366
    WView,
367
    HView,
368
    Angle,
369
    HBorder,
370
    VBorder,
371
    HSpeed,
372
    VSpeed,
373
    Object,
374
    Visible,
375
    XPort,
376
    YPort,
377
    WPort,
378
    HPort,
379
    Camera,
380
    SurfaceID
381
}