Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_battle_menu_item_Step_0

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