Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_heart_sell_screen_shop_Step_0

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
var main_shop_screen_number = global.main_shop_screen_number
4
var sell_shop_screen_number = global.sell_shop_screen_number
5
var inventory_max = 0
6
var i = 1
7
while (i <= 8)
8
{
9
    if (global.item_slot[i] == "Nothing")
10
        break
11
    else
12
    {
13
        inventory_max = i
14
        i++
15
        continue
16
    }
17
}
18
script_execute(gml_Script_scr_controls_shop_sell)
19
if key_select
20
{
21
    if (sell_shop_screen_number < 9)
22
    {
23
        if (global.item_slot[sell_shop_screen_number] == "H. Acid")
24
            audio_play_sound(snd_fail, 1, 0)
25
        else
26
        {
27
            audio_play_sound(snd_confirm, 1, 0)
28
            instance_create(0, 0, obj_text_sell_confirmation_shop)
29
            instance_create((obj_talk_screen_shop.x + 229), (obj_talk_screen_shop.y + 59), obj_heart_player_response_sell_shop)
30
            instance_destroy(obj_text_item_sell_shop)
31
            instance_destroy()
32
            return;
33
        }
34
    }
35
    else if (sell_shop_screen_number == 9)
36
    {
37
        event_user(2)
38
        return;
39
    }
40
}
41
if (key_revert && key_select == 0)
42
{
43
    event_user(2)
44
    return;
45
}
46
if (inventory_max == 0)
47
    global.sell_shop_screen_number = 9
48
if (key_select == 0 && key_revert == 0 && inventory_max != 0)
49
{
50
    if (key_down && key_up == 0)
51
    {
52
        audio_play_sound(snd_mainmenu_select, 1, 0)
53
        if (sell_shop_screen_number == 4 || sell_shop_screen_number == inventory_max)
54
        {
55
            global.sell_shop_screen_number = 9
56
            sell_shop_screen_number = global.sell_shop_screen_number
57
        }
58
        else if (sell_shop_screen_number == 9)
59
        {
60
            global.sell_shop_screen_number = 1
61
            sell_shop_screen_number = global.sell_shop_screen_number
62
        }
63
        else if (sell_shop_screen_number < inventory_max)
64
            global.sell_shop_screen_number += 1
65
    }
66
    if (key_up && key_down == 0)
67
    {
68
        audio_play_sound(snd_mainmenu_select, 1, 0)
69
        if (sell_shop_screen_number == 1 || sell_shop_screen_number == 5)
70
        {
71
            global.sell_shop_screen_number = 9
72
            sell_shop_screen_number = global.sell_shop_screen_number
73
        }
74
        else if (sell_shop_screen_number == 9)
75
        {
76
            global.sell_shop_screen_number = 4
77
            if (inventory_max < 4)
78
                global.sell_shop_screen_number = inventory_max
79
            sell_shop_screen_number = global.sell_shop_screen_number
80
        }
81
        else
82
            global.sell_shop_screen_number -= 1
83
    }
84
    if (key_right || key_left)
85
    {
86
        audio_play_sound(snd_mainmenu_select, 1, 0)
87
        if (sell_shop_screen_number <= 4)
88
        {
89
            if (global.item_slot[(sell_shop_screen_number + 4)] != "Nothing")
90
                global.sell_shop_screen_number += 4
91
            sell_shop_screen_number = global.sell_shop_screen_number
92
        }
93
        else if (sell_shop_screen_number < 9)
94
        {
95
            global.sell_shop_screen_number -= 4
96
            sell_shop_screen_number = global.sell_shop_screen_number
97
        }
98
    }
99
}
100
sell_shop_screen_number = global.sell_shop_screen_number
101
if (sell_shop_screen_number == 1)
102
{
103
    x = obj_talk_screen_shop.x + 19
104
    y = obj_talk_screen_shop.y + 19
105
}
106
else if (sell_shop_screen_number == 2)
107
{
108
    x = obj_talk_screen_shop.x + 19
109
    y = obj_talk_screen_shop.y + 39
110
}
111
else if (sell_shop_screen_number == 3)
112
{
113
    x = obj_talk_screen_shop.x + 19
114
    y = obj_talk_screen_shop.y + 59
115
}
116
else if (sell_shop_screen_number == 4)
117
{
118
    x = obj_talk_screen_shop.x + 19
119
    y = obj_talk_screen_shop.y + 79
120
}
121
else if (sell_shop_screen_number == 5)
122
{
123
    x = obj_talk_screen_shop.x + 179
124
    y = obj_talk_screen_shop.y + 19
125
}
126
else if (sell_shop_screen_number == 6)
127
{
128
    x = obj_talk_screen_shop.x + 179
129
    y = obj_talk_screen_shop.y + 39
130
}
131
else if (sell_shop_screen_number == 7)
132
{
133
    x = obj_talk_screen_shop.x + 179
134
    y = obj_talk_screen_shop.y + 59
135
}
136
else if (sell_shop_screen_number == 8)
137
{
138
    x = obj_talk_screen_shop.x + 179
139
    y = obj_talk_screen_shop.y + 79
140
}
141
else if (sell_shop_screen_number == 9)
142
{
143
    x = obj_talk_screen_shop.x + 19
144
    y = obj_talk_screen_shop.y + 99
145
}