Undertale script viewer

← back to main script listing

gml_Object_obj_shop5_body_Draw_0

(view raw script w/o annotations or w/e)
1
if (nowemote != global.faceemotion)
2
    event_user(0);
3
nowemote = global.faceemotion;
4
siner += 1;
5
draw_sprite(spr_5_coffeeline, floor(siner / 8), 178, floor(62 + (sin(siner / 4) * 1.5)));
6
draw_sprite(spr_5_tembody, 0, 99 + bodyx, 1 + bodyy);
7
if (global.faceemotion == 0)
8
{
9
    draw_sprite(spr_5_tembrows, 0, floor(138 + offx[0]), floor(32 + offy[0] + (facey / 2)));
10
    draw_sprite(spr_5_eyes1, 0, floor(139 + offx[1] + facex), floor(40 + offy[1] + facey));
11
    draw_sprite(spr_5_mouth1, 0, floor(141 + offx[2] + facex), floor(48 + offy[2] + facey));
12
    facetimer += 1;
13
    if (facetimer > 90 && facetimer < 110)
14
        facex += (sin(facetimer / 10) * 0.8);
15
    if (facetimer > 130 && facetimer < 150)
16
        facex += (sin(facetimer / 10) * 0.8);
17
    if (facetimer > 190 && facetimer < 230)
18
    {
19
        facex *= 0.9;
20
        if (facex <= 0.5)
21
            facex = 0;
22
    }
23
    if (facetimer > 290 && facetimer < 310)
24
        facey += (sin(facetimer / 10) * 0.8);
25
    if (facetimer > 326 && facetimer < 345)
26
        facey += (sin(facetimer / 10) * 1.5);
27
    if (facetimer > 390 && facetimer < 430)
28
    {
29
        facey *= 0.9;
30
        if (facey <= 0.5)
31
            facex = 0;
32
    }
33
    if (facetimer == 460)
34
        facetimer = 0;
35
}
36
if (global.faceemotion == 1)
37
{
38
    rr = random(0.8) - random(0.8);
39
    rr2 = random(0.8) - random(0.8);
40
    draw_sprite(spr_5_tembrows, 0, floor(138 + offx[0]), floor((32 + offy[0] + (facey / 2)) - sin(facetimer / 2)));
41
    draw_sprite(spr_5_eyes2, 0, floor(135 + offx[1] + facex + rr), floor(38 + offy[1] + facey + rr2));
42
    draw_sprite(spr_5_mouth1, 0, floor(141 + offx[2] + facex), floor(48 + offy[2] + facey));
43
    facetimer += 1;
44
}
45
if (global.faceemotion == 2)
46
{
47
    draw_sprite(spr_5_tembrows, 0, floor(138 + offx[0]), floor(32 + offy[0] + (facey / 2)));
48
    draw_sprite(spr_5_eyes3, 0, floor(139 + offx[1] + facex), floor(40 + offy[1] + facey));
49
    draw_sprite(spr_5_mouth2, floor(siner / 3), floor(141 + offx[2] + facex), floor(48 + offy[2] + facey));
50
    draw_sprite_ext(spr_5_sweat, 0, 133, 39 + (sin(siner / 4) * 1.5), 1, 1, 0, c_white, 1 + sin(siner / 4));
51
    if (facetimer > 45 && facetimer < 55)
52
        facex += (sin(facetimer / 5) * 0.8);
53
    if (facetimer > 65 && facetimer < 75)
54
        facex += (sin(facetimer / 5) * 0.8);
55
    if (facetimer > 95 && facetimer < 115)
56
    {
57
        facex *= 0.9;
58
        if (facex <= 0.5)
59
            facex = 0;
60
    }
61
    if (facetimer == 140)
62
        facetimer = 0;
63
    facetimer += 1;
64
}
65
if (global.faceemotion == 3)
66
{
67
    facex = 2;
68
    facey = -2;
69
    draw_sprite(spr_5_eyes4, 0, floor(137 + offx[1] + facex), floor(32 + offy[1] + facey));
70
    draw_sprite(spr_5_mouth3, floor(siner / 3), floor(146 + offx[2] + facex), floor(42 + offy[2] + facey));
71
    facetimer += 1;
72
}
73
if (global.faceemotion == 4)
74
{
75
    facey = sin(facetimer / 5) * 1.5;
76
    draw_sprite(spr_5_eyes5, 0, floor(137 + offx[1] + facex), floor(32 + offy[1] + facey));
77
    draw_sprite(spr_5_mouth3, floor(siner / 3), floor(144 + offx[2] + facex + (cos(siner / 1.5) * 1.5)), floor(43 + offy[2] + facey));
78
    draw_sprite_ext(spr_5_sweat, 0, 133, 39 + (sin(siner / 4) * 1.5), 1, 1, 0, c_white, 1 + sin(siner / 4));
79
    facetimer += 1;
80
}
81
if (global.faceemotion == 5)
82
{
83
    rr = random(1) - random(1);
84
    rr2 = random(1) - random(1);
85
    bodyx = rr;
86
    bodyy = rr2;
87
    facey = sin(facetimer / 3) * 2;
88
    draw_sprite(spr_5_eyes6, 0, floor(137 + offx[1] + facex), floor(31 + offy[1] + facey));
89
    draw_sprite(spr_5_mouth3, floor(siner / 3), floor(144 + offx[2] + facex + (cos(siner) * 2)), floor(43 + offy[2] + facey));
90
    draw_sprite_ext(spr_5_sweat, 0, 133, 39 + (sin(siner / 2) * 2), 1, 1, 0, c_white, 1 + sin(siner / 2));
91
    facetimer += 1;
92
}
93
if (global.faceemotion == 6)
94
{
95
    draw_sprite(spr_5_sellface, floor(siner / 2), floor(139 + offx[1] + facex), floor(25 + offy[1] + facey));
96
    facetimer += 1;
97
}
98
if (global.faceemotion == 7)
99
{
100
    draw_sprite(spr_5_sellface_x, floor(siner / 2), floor(139 + offx[1] + facex), floor(25 + offy[1] + facey));
101
    facetimer += 1;
102
}
103
draw_sprite(spr_5_tembox, 0, 80 + boxx, 68);
104
if (sellmenu == 1)
105
{
106
    draw_set_color(c_white);
107
    scr_setfont
scr_setfont

var newfont = argument0; if (global.language == "ja") { if (newfont == fnt_main) newfont = fnt_ja_main; if (newfont == fnt_maintext) newfont = fnt_ja_maintext; if (newfont == fnt_plain) newfont = fnt_ja_plain; } draw_set_font(newfont);
(fnt_maintext);
108
    value[0] = 100;
109
    value[1] = 5;
110
    value[2] = 666;
111
    value[3] = 10;
112
    value[4] = 100;
113
    value[5] = 5;
114
    value[6] = 12;
115
    value[7] = 0;
116
    value[8] = 0;
117
    value[9] = 0;
118
    value[10] = 0;
119
    for (i = 0; i < 8; i += 1)
120
    {
121
        s_value[i] = "    " + string(value[i]);
122
        if (value[i] >= 10 && value[i] < 100)
123
            s_value[i] = "  " + string(value[i]);
124
        if (value[i] >= 100 && value[i] < 1000)
125
            s_value[i] = string(value[i]);
126
    }
127
    odd = -1;
128
    if (sellpos == 0 || sellpos == 2 || sellpos == 4 || sellpos == 6)
129
    {
130
        odd = 0;
131
        draw_sprite(spr_heartsmall, 0, 15, 135 + ((sellpos / 2) * 20));
132
    }
133
    if (sellpos == 1 || sellpos == 3 || sellpos == 5 || sellpos == 7)
134
    {
135
        odd = 1;
136
        draw_sprite(spr_heartsmall, 0, 155, 135 + (((sellpos - 1) / 2) * 20));
137
    }
138
    if (sellpos == 8)
139
        draw_sprite(spr_heartsmall, 0, 15, 215);
140
    if (keyboard_check_pressed(vk_right) && odd == 0)
141
    {
142
        if (value[sellpos + 1] != 0)
143
            sellpos += 1;
144
    }
145
    if (keyboard_check_pressed(vk_left) && odd == 1)
146
        sellpos -= 1;
147
    if (keyboard_check_pressed(vk_down))
148
    {
149
        d_fail = 0;
150
        if (value[sellpos + 2] == 0)
151
            d_fail = 1;
152
        if (d_fail == 1 && value[sellpos + 1] != 0)
153
            d_fail = 2;
154
        if (sellpos == 6 || sellpos == 7 || sellpos == 8)
155
            d_fail = 1;
156
        if (d_fail == 1)
157
            sellpos = 8;
158
        else if (d_fail == 2)
159
            sellpos += 1;
160
        else
161
            sellpos += 2;
162
    }
163
    if (keyboard_check_pressed(vk_up))
164
    {
165
        if (sellpos != 0 && sellpos != 1)
166
        {
167
            if (sellpos == 8)
168
            {
169
                this_i = -1;
170
                i = 7;
171
                while (this_i == -1)
172
                {
173
                    if (value[i] != 0)
174
                        this_i = i;
175
                    i -= 1;
176
                    if (i == -1)
177
                        this_i = 8;
178
                }
179
                sellpos = this_i;
180
            }
181
            else
182
            {
183
                sellpos -= 2;
184
            }
185
        }
186
    }
187
    draw_set_color(c_white);
188
    for (i = 0; i < 4; i += 1)
189
    {
190
        if (value[i * 2] != 0)
191
            draw_text(30, 130 + (i * 20), s_value[i * 2] + "G - Ninechara");
192
        if (value[(i * 2) + 1] != 0)
193
            draw_text(170, 130 + (i * 20), s_value[(i * 2) + 1] + "G - Ninechara");
194
    }
195
    draw_text(30, 210, 
Exit
scr_gettext
scr_gettext

var text_id = argument[0]; var text = ds_map_find_value(global.text_data_en, text_id); if (is_undefined(text)) text = ""; if (global.language == "ja") { var loc_text = ds_map_find_value(global.text_data_ja, text_id); if (!is_undefined(loc_text)) text = loc_text; } for (var i = 1; i <= (string_length(text) - 3); i++) { if (string_copy(text, i, 2) == "\[" && string_char_at(text, i + 3) == "]") { var sel = string_char_at(text, i + 2); var replace; if (sel == "C") replace = global.charname; else if (sel == "G") replace = string(global.gold); else if (sel == "I") replace = global.itemname[global.menucoord[1]]; else if (sel == "1" && argument_count > 1) replace = argument[1]; else if (sel == "2" && argument_count > 2) replace = argument[2]; else if (sel == "3" && argument_count > 3) replace = argument[3]; else if (sel == "4" && argument_count > 4) replace = argument[4]; else if (sel == "5" && argument_count > 5) replace = argument[5]; else if (sel == "6" && argument_count > 6) replace = argument[6]; else if (sel == "7" && argument_count > 7) replace = argument[7]; else if (sel == "8" && argument_count > 8) replace = argument[8]; else if (sel == "9" && argument_count > 9) replace = argument[9]; else replace = ""; var before = string_copy(text, 1, i - 1); var after = string_copy(text, i + 4, string_length(text)); text = before + replace + after; i += (string_length(replace) - 1); } } return text;
("shop_exit_submenu")
);
196
    draw_set_color(c_yellow);
197
    draw_text(200, 210, "(9999 G)");
198
    if (control_check_pressed(0))
199
    {
200
        buffer = 3;
201
        if (sellpos == 8)
202
        {
203
            sellmenu = 0;
204
        }
205
        else
206
        {
207
            sellmenu = 2;
208
            sellpos2 = 0;
209
        }
210
    }
211
}
212
if (sellmenu == 2)
213
{
214
    buffer -= 1;
215
    draw_set_color(c_white);
216
    scr_setfont
scr_setfont

var newfont = argument0; if (global.language == "ja") { if (newfont == fnt_main) newfont = fnt_ja_main; if (newfont == fnt_maintext) newfont = fnt_ja_maintext; if (newfont == fnt_plain) newfont = fnt_ja_plain; } draw_set_font(newfont);
(fnt_maintext);
217
    draw_text(55, 150, "Really sell Ninechara for " + string(value[sellpos]) + "G?");
218
    draw_text(80, 180, "Yes");
219
    draw_text(190, 180, "No");
220
    draw_sprite(spr_heartsmall, 0, 65 + (sellpos2 * 110), 185);
221
    draw_set_color(c_yellow);
222
    draw_text(200, 210, "(9999 G)");
223
    if (keyboard_check_pressed(vk_left) || keyboard_check_pressed(vk_right))
224
    {
225
        if (sellpos2 == 0)
226
            sellpos2 = 1;
227
        else
228
            sellpos2 = 0;
229
    }
230
    if (control_check_pressed(0) && buffer <= 0)
231
    {
232
        if (sellpos2 == 1)
233
        {
234
            sellmenu = 1;
235
        }
236
        else
237
        {
238
        }
239
    }
240
}
241
if (global.flag[276 temmie_college_paid] == 1)
242
    draw_sprite(spr_temhat, 0, 99 + bodyx + 37, 1 + bodyy);