Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_menu_act_Step_0

(view raw script w/o annotations or w/e)
1
var act_number = global.act_number
2
if (act_number == 1)
3
    var action_amount = global.action_amount
4
if (act_number == 2)
5
    action_amount = global.action_amount_2
6
if (act_number == 3)
7
    action_amount = global.action_amount_3
8
var enemy_count = global.enemy_count
9
script_execute(gml_Script_scr_controls_battle_act)
10
if instance_exists(obj_text_battle_move_selected_enemy_name_parent)
11
{
12
    for (counter = 0; counter < 2; counter += 1)
13
    {
14
        if (global.act_number == 1 && (!instance_exists(obj_text_battle_move_selected_enemy_name)))
15
            global.act_number = 2
16
        if (global.act_number == 2 && (!instance_exists(obj_text_battle_move_selected_enemy_name_2)))
17
            global.act_number = 1
18
        if (global.act_number == 1 && (!instance_exists(obj_text_battle_move_selected_enemy_name)))
19
            global.act_number = 3
20
        if (global.act_number == 3 && (!instance_exists(obj_text_battle_move_selected_enemy_name_3)))
21
            global.act_number = 1
22
    }
23
}
24
else if (!instance_exists(obj_text_battle_move_selected_enemy_name_parent))
25
{
26
    if (global.act_number_row == 2 && global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_5)))
27
        global.act_number_row = 1
28
    if (global.act_number_row == 1 && global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_4)))
29
    {
30
        global.act_number_row = 2
31
        global.act_number_column = 2
32
    }
33
    if (global.act_number_row == 2 && global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_3)))
34
        global.act_number_row = 1
35
    if (global.act_number_row == 1 && global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_2)))
36
    {
37
        global.act_number_row = 1
38
        global.act_number_column = 1
39
    }
40
    if (global.act_number_row == 2 && global.act_number_column == 1 && (!instance_exists(obj_text_battle_move_selected_action_1)))
41
        global.act_number_row = 1
42
}
43
if key_select
44
{
45
    if instance_exists(obj_text_battle_move_selected_enemy_name_parent)
46
    {
47
        instance_create(0, 0, obj_text_battle_move_selected_check)
48
        if (action_amount >= 5)
49
        {
50
            instance_create(0, 0, obj_text_battle_move_selected_action_1)
51
            instance_create(0, 0, obj_text_battle_move_selected_action_2)
52
            instance_create(0, 0, obj_text_battle_move_selected_action_3)
53
            instance_create(0, 0, obj_text_battle_move_selected_action_4)
54
            instance_create(0, 0, obj_text_battle_move_selected_action_5)
55
        }
56
        else if (action_amount >= 4)
57
        {
58
            instance_create(0, 0, obj_text_battle_move_selected_action_1)
59
            instance_create(0, 0, obj_text_battle_move_selected_action_2)
60
            instance_create(0, 0, obj_text_battle_move_selected_action_3)
61
            instance_create(0, 0, obj_text_battle_move_selected_action_4)
62
        }
63
        else if (action_amount >= 3)
64
        {
65
            instance_create(0, 0, obj_text_battle_move_selected_action_1)
66
            instance_create(0, 0, obj_text_battle_move_selected_action_2)
67
            instance_create(0, 0, obj_text_battle_move_selected_action_3)
68
        }
69
        else if (action_amount >= 2)
70
        {
71
            instance_create(0, 0, obj_text_battle_move_selected_action_1)
72
            instance_create(0, 0, obj_text_battle_move_selected_action_2)
73
        }
74
        else if (action_amount >= 1)
75
            instance_create(0, 0, obj_text_battle_move_selected_action_1)
76
        if (global.act_number_row == 2 && global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_5)))
77
            global.act_number_row = 1
78
        if (global.act_number_row == 1 && global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_4)))
79
        {
80
            global.act_number_row = 2
81
            global.act_number_column = 2
82
        }
83
        if (global.act_number_row == 2 && global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_3)))
84
            global.act_number_row = 1
85
        if (global.act_number_row == 1 && global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_2)))
86
        {
87
            global.act_number_row = 1
88
            global.act_number_column = 2
89
        }
90
        if (global.act_number_row == 2 && global.act_number_column == 1 && (!instance_exists(obj_text_battle_move_selected_action_1)))
91
            global.act_number_row = 1
92
        with (obj_text_battle_move_selected_enemy_name_parent)
93
            instance_destroy()
94
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
95
    }
96
    else if (global.act_number_row == 1 && global.act_number_column == 1 && instance_exists(obj_text_battle_move_selected_check))
97
    {
98
        instance_create(0, 0, obj_dialogue_battle_action_selected_check)
99
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
100
        with (obj_text_battle_move_selected_action_parent)
101
            instance_destroy()
102
        with (obj_heart_battle_menu_act)
103
            instance_destroy()
104
    }
105
    else if (global.act_number_row == 2 && global.act_number_column == 1 && instance_exists(obj_text_battle_move_selected_action_1))
106
    {
107
        instance_create(0, 0, obj_dialogue_battle_action_selected_action_1)
108
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
109
        with (obj_text_battle_move_selected_action_parent)
110
            instance_destroy()
111
        with (obj_heart_battle_menu_act)
112
            instance_destroy()
113
    }
114
    else if (global.act_number_row == 1 && global.act_number_column == 2 && instance_exists(obj_text_battle_move_selected_action_2))
115
    {
116
        instance_create(0, 0, obj_dialogue_battle_action_selected_action_2)
117
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
118
        with (obj_text_battle_move_selected_action_parent)
119
            instance_destroy()
120
        with (obj_heart_battle_menu_act)
121
            instance_destroy()
122
    }
123
    else if (global.act_number_row == 2 && global.act_number_column == 2 && instance_exists(obj_text_battle_move_selected_action_3))
124
    {
125
        instance_create(0, 0, obj_dialogue_battle_action_selected_action_3)
126
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
127
        with (obj_text_battle_move_selected_action_parent)
128
            instance_destroy()
129
        with (obj_heart_battle_menu_act)
130
            instance_destroy()
131
    }
132
    else if (global.act_number_row == 1 && global.act_number_column == 3 && instance_exists(obj_text_battle_move_selected_action_4))
133
    {
134
        instance_create(0, 0, obj_dialogue_battle_action_selected_action_4)
135
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
136
        with (obj_text_battle_move_selected_action_parent)
137
            instance_destroy()
138
        with (obj_heart_battle_menu_act)
139
            instance_destroy()
140
    }
141
    else if (global.act_number_row == 2 && global.act_number_column == 3 && instance_exists(obj_text_battle_move_selected_action_5))
142
    {
143
        instance_create(0, 0, obj_dialogue_battle_action_selected_action_5)
144
        audio_play_sound(snd_battle_item_weapon_select, 20, false)
145
        with (obj_text_battle_move_selected_action_parent)
146
            instance_destroy()
147
        with (obj_heart_battle_menu_act)
148
            instance_destroy()
149
    }
150
}
151
if (key_revert && key_select == 0)
152
{
153
    if instance_exists(obj_text_battle_move_selected_enemy_name_parent)
154
    {
155
        with (obj_heart_battle_menu)
156
        {
157
            no_loop = false
158
            image_alpha = 1
159
        }
160
        with (obj_text_battle_move_selected_enemy_name_parent)
161
            instance_destroy()
162
        instance_destroy()
163
    }
164
    else if (!instance_exists(obj_text_battle_move_selected_enemy_name_parent))
165
    {
166
        if (global.enemy_dead == false && global.enemy_spared == false)
167
            instance_create(0, 0, obj_text_battle_move_selected_enemy_name)
168
        if (enemy_count >= 2)
169
        {
170
            if (global.enemy_dead_2 == false && global.enemy_spared_2 == false)
171
                instance_create(0, 0, obj_text_battle_move_selected_enemy_name_2)
172
        }
173
        if (enemy_count >= 3)
174
        {
175
            if (global.enemy_dead_3 == false && global.enemy_spared_3 == false)
176
                instance_create(0, 0, obj_text_battle_move_selected_enemy_name_3)
177
        }
178
        with (obj_text_battle_move_selected_action_parent)
179
            instance_destroy()
180
    }
181
}
182
if (key_select == 0 && key_revert == 0)
183
{
184
    if (key_right && key_left == 0 && key_down == 0 && key_up == 0 && instance_exists(obj_text_battle_move_selected_action_1) && (!instance_exists(obj_text_battle_move_selected_enemy_name_parent)))
185
    {
186
        if (global.act_number_row >= 2)
187
            global.act_number_row = 1
188
        else
189
        {
190
            global.act_number_row += 1
191
            if (global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_5)))
192
                global.act_number_column = 2
193
            if (global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_3)))
194
                global.act_number_column = 1
195
        }
196
        audio_play_sound(snd_mainmenu_select, 20, false)
197
    }
198
    if (key_left && key_right == 0 && key_down == 0 && key_up == 0 && instance_exists(obj_text_battle_move_selected_action_1) && (!instance_exists(obj_text_battle_move_selected_enemy_name_parent)))
199
    {
200
        if (global.act_number_row <= 1)
201
        {
202
            global.act_number_row = 2
203
            if (global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_5)))
204
                global.act_number_column = 2
205
            if (global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_3)))
206
                global.act_number_column = 1
207
        }
208
        else
209
            global.act_number_row -= 1
210
        audio_play_sound(snd_mainmenu_select, 20, false)
211
    }
212
    if (key_down && key_right == 0 && key_left == 0 && key_up == 0)
213
    {
214
        if instance_exists(obj_text_battle_move_selected_enemy_name_parent)
215
        {
216
            if (global.act_number >= 3)
217
                global.act_number = 1
218
            else
219
                global.act_number += 1
220
            check_sound = 0
221
            for (counter = 0; counter < 2; counter += 1)
222
            {
223
                if (global.act_number == 1 && (!instance_exists(obj_text_battle_move_selected_enemy_name)))
224
                {
225
                    global.act_number = 2
226
                    check_sound += 1
227
                }
228
                if (global.act_number == 2 && (!instance_exists(obj_text_battle_move_selected_enemy_name_2)))
229
                {
230
                    global.act_number = 3
231
                    check_sound += 1
232
                }
233
                if (global.act_number == 3 && (!instance_exists(obj_text_battle_move_selected_enemy_name_3)))
234
                {
235
                    global.act_number = 1
236
                    check_sound += 1
237
                }
238
            }
239
            if (check_sound < 2)
240
                audio_play_sound(snd_mainmenu_select, 20, false)
241
        }
242
        else if (!instance_exists(obj_text_battle_move_selected_enemy_name_parent))
243
        {
244
            if (global.act_number_column >= 3)
245
                global.act_number_column = 1
246
            else
247
                global.act_number_column += 1
248
            check_sound = 0
249
            counter = 0
250
            if (global.act_number_row == 1)
251
            {
252
                while (counter < 2)
253
                {
254
                    if (global.act_number_column == 1 && (!instance_exists(obj_text_battle_move_selected_check)))
255
                    {
256
                        global.act_number_column = 2
257
                        check_sound += 1
258
                    }
259
                    if (global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_2)))
260
                    {
261
                        global.act_number_column = 3
262
                        check_sound += 1
263
                    }
264
                    if (global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_4)))
265
                    {
266
                        global.act_number_column = 1
267
                        check_sound += 1
268
                    }
269
                    counter += 1
270
                }
271
            }
272
            else if (global.act_number_row == 2)
273
            {
274
                while (counter < 2)
275
                {
276
                    if (global.act_number_column == 1 && (!instance_exists(obj_text_battle_move_selected_action_1)))
277
                    {
278
                        global.act_number_column = 2
279
                        check_sound += 1
280
                    }
281
                    if (global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_3)))
282
                    {
283
                        global.act_number_column = 3
284
                        check_sound += 1
285
                    }
286
                    if (global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_5)))
287
                    {
288
                        global.act_number_column = 1
289
                        check_sound += 1
290
                    }
291
                    counter += 1
292
                }
293
            }
294
            if (check_sound < 2)
295
                audio_play_sound(snd_mainmenu_select, 20, false)
296
        }
297
    }
298
    if (key_up && key_right == 0 && key_left == 0 && key_down == 0)
299
    {
300
        if instance_exists(obj_text_battle_move_selected_enemy_name_parent)
301
        {
302
            if (global.act_number <= 1)
303
                global.act_number = 3
304
            else
305
                global.act_number -= 1
306
            check_sound = 0
307
            for (counter = 0; counter < 2; counter += 1)
308
            {
309
                if (global.act_number == 3 && (!instance_exists(obj_text_battle_move_selected_enemy_name_3)))
310
                {
311
                    global.act_number = 2
312
                    check_sound += 1
313
                }
314
                if (global.act_number == 2 && (!instance_exists(obj_text_battle_move_selected_enemy_name_2)))
315
                {
316
                    global.act_number = 1
317
                    check_sound += 1
318
                }
319
                if (global.act_number == 1 && (!instance_exists(obj_text_battle_move_selected_enemy_name)))
320
                {
321
                    global.act_number = 3
322
                    check_sound += 1
323
                }
324
            }
325
            if (check_sound < 2)
326
                audio_play_sound(snd_mainmenu_select, 20, false)
327
        }
328
        else if (!instance_exists(obj_text_battle_move_selected_enemy_name_parent))
329
        {
330
            if (global.act_number_column <= 1)
331
                global.act_number_column = 3
332
            else
333
                global.act_number_column -= 1
334
            check_sound = 0
335
            counter = 0
336
            if (global.act_number_row == 1)
337
            {
338
                while (counter < 2)
339
                {
340
                    if (global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_4)))
341
                    {
342
                        global.act_number_column = 2
343
                        check_sound += 1
344
                    }
345
                    if (global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_2)))
346
                    {
347
                        global.act_number_column = 1
348
                        check_sound += 1
349
                    }
350
                    if (global.act_number_column == 1 && (!instance_exists(obj_text_battle_move_selected_check)))
351
                    {
352
                        global.act_number_column = 3
353
                        check_sound += 1
354
                    }
355
                    counter += 1
356
                }
357
            }
358
            else if (global.act_number_row == 2)
359
            {
360
                while (counter < 2)
361
                {
362
                    if (global.act_number_column == 3 && (!instance_exists(obj_text_battle_move_selected_action_5)))
363
                    {
364
                        global.act_number_column = 2
365
                        check_sound += 1
366
                    }
367
                    if (global.act_number_column == 2 && (!instance_exists(obj_text_battle_move_selected_action_3)))
368
                    {
369
                        global.act_number_column = 1
370
                        check_sound += 1
371
                    }
372
                    if (global.act_number_column == 1 && (!instance_exists(obj_text_battle_move_selected_action_1)))
373
                    {
374
                        global.act_number_column = 3
375
                        check_sound += 1
376
                    }
377
                    counter += 1
378
                }
379
            }
380
            if (check_sound < 2)
381
                audio_play_sound(snd_mainmenu_select, 20, false)
382
        }
383
    }
384
}
385
if instance_exists(obj_text_battle_move_selected_enemy_name_parent)
386
{
387
    x = obj_dialogue_box_battle.x + 44
388
    if (global.act_number == 1)
389
        y = obj_dialogue_box_battle.y + 36
390
    else if (global.act_number == 2)
391
        y = obj_dialogue_box_battle.y + 68
392
    else if (global.act_number == 3)
393
        y = obj_dialogue_box_battle.y + 100
394
}
395
else if (!instance_exists(obj_text_battle_move_selected_enemy_name_parent))
396
{
397
    if (global.act_number_row == 1)
398
        x = obj_dialogue_box_battle.x + 44
399
    else if (global.act_number_row == 2)
400
        x = obj_dialogue_box_battle.x + 300
401
    if (global.act_number_column == 1)
402
        y = obj_dialogue_box_battle.y + 36
403
    else if (global.act_number_column == 2)
404
        y = obj_dialogue_box_battle.y + 68
405
    else if (global.act_number_column == 3)
406
        y = obj_dialogue_box_battle.y + 100
407
}