Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_buy_screen_shop_Step_0

(view raw script w/o annotations or w/e)
1
var main_shop_screen_number = global.main_shop_screen_number
2
var buy_shop_screen_number = global.buy_shop_screen_number
3
script_execute(gml_Script_scr_controls_shop_buy)
4
if key_select
5
{
6
    if (buy_shop_screen_number < 5)
7
    {
8
        if (main_shop_screen_number == 1)
9
        {
10
            if (scr_determine_item_purchasable
scr_determine_item_purchasable

function scr_determine_item_purchasable() //gml_Script_scr_determine_item_purchasable { switch argument[0] { case "Adult Soda": case "Wild Revolver": return false; default: return true; } }
(global.shop_item[buy_shop_screen_number]) == false)
11
            {
12
                audio_play_sound(snd_fail, 1, 0)
13
                return;
14
            }
15
            audio_play_sound(snd_confirm, 1, 0)
16
            instance_create(0, 0, obj_text_buy_confirmation_shop)
17
            instance_create((obj_main_screen_shop.x + 229), (obj_main_screen_shop.y + 59), obj_heart_player_response_shop)
18
            event_user(0)
19
            return;
20
        }
21
        else if (main_shop_screen_number == 3)
22
        {
23
            instance_create(0, 120, obj_talk_screen_shop)
24
            instance_create(0, 0, obj_dialogue_talk_shop)
25
            event_user(1)
26
            event_user(0)
27
            return;
28
        }
29
    }
30
    else if (buy_shop_screen_number == 5)
31
    {
32
        event_user(2)
33
        event_user(0)
34
        return;
35
    }
36
}
37
if (key_revert && key_select == 0)
38
{
39
    event_user(2)
40
    event_user(0)
41
    return;
42
}
43
if (key_select == 0 && key_revert == 0)
44
{
45
    if (key_down && key_up == 0)
46
    {
47
        audio_play_sound(snd_mainmenu_select, 1, 0)
48
        if (buy_shop_screen_number == item_max_count)
49
        {
50
            global.buy_shop_screen_number = 5
51
            buy_shop_screen_number = global.buy_shop_screen_number
52
        }
53
        else if (buy_shop_screen_number == 5)
54
        {
55
            global.buy_shop_screen_number = 1
56
            buy_shop_screen_number = global.buy_shop_screen_number
57
        }
58
        else
59
            global.buy_shop_screen_number += 1
60
    }
61
    if (key_up && key_down == 0)
62
    {
63
        audio_play_sound(snd_mainmenu_select, 1, 0)
64
        if (buy_shop_screen_number == 1)
65
        {
66
            global.buy_shop_screen_number = 5
67
            buy_shop_screen_number = global.buy_shop_screen_number
68
        }
69
        else if (buy_shop_screen_number == 5)
70
        {
71
            global.buy_shop_screen_number = item_max_count
72
            buy_shop_screen_number = global.buy_shop_screen_number
73
        }
74
        else
75
            global.buy_shop_screen_number -= 1
76
    }
77
}
78
buy_shop_screen_number = global.buy_shop_screen_number
79
if (buy_shop_screen_number == 1)
80
{
81
    x = obj_main_screen_shop.x + 19
82
    y = obj_main_screen_shop.y + 19
83
}
84
else if (buy_shop_screen_number == 2)
85
{
86
    x = obj_main_screen_shop.x + 19
87
    y = obj_main_screen_shop.y + 39
88
}
89
else if (buy_shop_screen_number == 3)
90
{
91
    x = obj_main_screen_shop.x + 19
92
    y = obj_main_screen_shop.y + 59
93
}
94
else if (buy_shop_screen_number == 4)
95
{
96
    x = obj_main_screen_shop.x + 19
97
    y = obj_main_screen_shop.y + 79
98
}
99
else if (buy_shop_screen_number == 5)
100
{
101
    x = obj_main_screen_shop.x + 19
102
    y = obj_main_screen_shop.y + 99
103
}