Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_kris_pianopuppet_Draw_0

(view raw script w/o annotations or w/e)
1
var xx = 10;
2
var yy = 8;
3
var space = 15;
4
draw_text(xx, yy + (space * 0), "W: Toggle Recording");
5
draw_text(xx, yy + (space * 1), "M: Toggle Sound: " + string(playsound));
6
draw_text(xx, yy + (space * 2), "Left Hand: Z X C V B N");
7
draw_text(xx, yy + (space * 3), "Right Hand: T Y U I O P");
8
if (keyboard_check_pressed(ord("M")))
9
    playsound = 1 - playsound;
10
if (keyboard_check_pressed(ord("Q")))
11
{
12
    var right_playback = "0R0R0R0R0R0R0R0R0R0R0R0R0R0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0R0R0R0R0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0R0R0R0R0R0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0U0U0U0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0L0L0L0L0L0W0W0W0W0W0W0W0W0W0W0W0W03030303030W0W0W0W0W0W0W020202020W0W0W0W0W0W0W0W0W0W020202020W0W0W0W0W0W0202020W0W0202020W0W0W0W0W0W0W0W0W0W0W0W0303030W0W0W0W0W0W0W0W0W0W0W0W0W0303030L0L0L0W0W0W0W0W0W0W0W0W0U0U0W0W0W0W0W0W0W0W0W0U0U0W0W0W0W0W0W0W0R0R0R0W0W0W0W0W0W0W0W0W0W0W0W0W0W";
13
    var left_playback = "010101010101010101010101010W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W010101010W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W010101010W0W0W0W0W010101010W0W0W0W0W0W020202020W0W0W0W0W0W0W0W0W0W0W0W0W030303030W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0L0L0L0L0L0W0W0W0W0W0W0W0W0W0U0U0U0W0W0W0W0W0W0W0W0R0R0R0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0L0L0L0L0L0W0W0W0W0W0W0W0W0W030303030W0W0W0W0W0W02020202020W0W0W0W0W0W0W01010101010W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W0W";
14
    lpianorecordcon = 2;
15
    lpianorecordcount = 0;
16
    lpianorecordstring = left_playback;
17
    lpianorecordsave = false;
18
    rpianorecordcon = 2;
19
    rpianorecordcount = 0;
20
    rpianorecordstring = right_playback;
21
    rpianorecordsave = false;
22
}
23
lk1 = keyboard_check(ord("Z"));
24
lk2 = keyboard_check(ord("X"));
25
lk3 = keyboard_check(ord("C"));
26
lk4 = keyboard_check(ord("V"));
27
lk5 = keyboard_check(ord("B"));
28
lk6 = keyboard_check(ord("N"));
29
press_l = 0;
30
press_r = 0;
31
press_u = 0;
32
press_d = 0;
33
press_1 = 0;
34
press_2 = 0;
35
press_3 = 0;
36
press_1 = lk1;
37
press_2 = lk2;
38
press_3 = lk3;
39
press_l = lk4;
40
press_u = lk5;
41
press_r = lk6;
42
if (lpianorecordcon == 1)
43
{
44
    lpianorecordstring += "0";
45
    var no_input = true;
46
    if (press_1)
47
    {
48
        lpianorecordstring += "1";
49
        no_input = false;
50
    }
51
    if (press_2)
52
    {
53
        lpianorecordstring += "2";
54
        no_input = false;
55
    }
56
    if (press_3)
57
    {
58
        lpianorecordstring += "3";
59
        no_input = false;
60
    }
61
    if (press_l)
62
    {
63
        lpianorecordstring += "L";
64
        no_input = false;
65
    }
66
    if (press_u)
67
    {
68
        lpianorecordstring += "U";
69
        no_input = false;
70
    }
71
    if (press_r)
72
    {
73
        lpianorecordstring += "R";
74
        no_input = false;
75
    }
76
    if (no_input == true)
77
        lpianorecordstring += "W";
78
    lpianorecordcount++;
79
}
80
if (lpianorecordcon == 2)
81
{
82
    press_l = 0;
83
    press_r = 0;
84
    press_u = 0;
85
    press_d = 0;
86
    press_1 = 0;
87
    press_2 = 0;
88
    press_3 = 0;
89
    if (lpianorecordcount < string_length(lpianorecordstring))
90
    {
91
        var _end = 0;
92
        while (_end == 0)
93
        {
94
            var _input = string_char_at(lpianorecordstring, lpianorecordcount);
95
            lpianorecordcount++;
96
            if (_input == "L")
97
                press_l = 1;
98
            if (_input == "R")
99
                press_r = 1;
100
            if (_input == "U")
101
                press_u = 1;
102
            if (_input == "D")
103
                press_d = 1;
104
            if (_input == "1")
105
                press_1 = 1;
106
            if (_input == "2")
107
                press_2 = 1;
108
            if (_input == "3")
109
                press_3 = 1;
110
            if (_input == "0")
111
                _end = 1;
112
            if (lpianorecordcount >= string_length(lpianorecordstring))
113
                _end = 1;
114
        }
115
    }
116
    else
117
    {
118
        if (lpianorecordsave == true && show_question("Do you want to save the left piano recording?"))
119
        {
120
            _string_save = get_string("Input string file name:", "default");
121
            ini_open("pianoplayback.ini");
122
            ini_write_string("piano Playback Info", _string_save, lpianorecordstring);
123
            ini_close();
124
        }
125
        else
126
        {
127
        }
128
        lpianorecordstring = "";
129
        lpianorecordcon = 0;
130
        lpianorecordcount = 0;
131
    }
132
}
133
var lkeydown = 0;
134
if (press_1 || press_2 || press_3 || press_u || press_l || press_r)
135
    lkeydown = 1;
136
if (press_1)
137
    baselindex = 5;
138
if (press_2)
139
    baselindex = 4;
140
if (press_3)
141
    baselindex = 3;
142
if (press_l)
143
    baselindex = 2;
144
if (press_u)
145
    baselindex = 1;
146
if (press_r)
147
    baselindex = 0;
148
if (playsound)
149
{
150
    if (press_1)
151
    {
152
        lowpitch = 1;
153
        lowplay = 1;
154
    }
155
    if (press_2)
156
    {
157
        lowpitch = 1.1;
158
        lowplay = 2;
159
    }
160
    if (press_3)
161
    {
162
        lowpitch = 1.2;
163
        lowplay = 3;
164
    }
165
    if (press_l)
166
    {
167
        lowpitch = 1.3;
168
        lowplay = 4;
169
    }
170
    if (press_u)
171
    {
172
        lowpitch = 1.4;
173
        lowplay = 5;
174
    }
175
    if (press_r)
176
    {
177
        lowpitch = 1.5;
178
        lowplay = 6;
179
    }
180
    if (!press_1 && !press_2 && !press_3 && !press_l && !press_u && !press_r)
181
        lowplay = 0;
182
    if (lowplay != lowplaylast)
183
    {
184
        if (lowplay)
185
            snd_play_pitch(snd_organ_do, lowpitch);
186
        lowplaylast = lowplay;
187
    }
188
}
189
rk1 = keyboard_check(ord("P"));
190
rk2 = keyboard_check(ord("O"));
191
rk3 = keyboard_check(ord("I"));
192
rk4 = keyboard_check(ord("U"));
193
rk5 = keyboard_check(ord("Y"));
194
rk6 = keyboard_check(ord("T"));
195
press_l = 0;
196
press_r = 0;
197
press_u = 0;
198
press_d = 0;
199
press_1 = 0;
200
press_2 = 0;
201
press_3 = 0;
202
press_1 = rk1;
203
press_2 = rk2;
204
press_3 = rk3;
205
press_l = rk4;
206
press_u = rk5;
207
press_r = rk6;
208
if (rpianorecordcon == 1)
209
{
210
    rpianorecordstring += "0";
211
    var no_input = true;
212
    if (press_1)
213
    {
214
        rpianorecordstring += "1";
215
        no_input = false;
216
    }
217
    if (press_2)
218
    {
219
        rpianorecordstring += "2";
220
        no_input = false;
221
    }
222
    if (press_3)
223
    {
224
        rpianorecordstring += "3";
225
        no_input = false;
226
    }
227
    if (press_l)
228
    {
229
        rpianorecordstring += "L";
230
        no_input = false;
231
    }
232
    if (press_u)
233
    {
234
        rpianorecordstring += "U";
235
        no_input = false;
236
    }
237
    if (press_r)
238
    {
239
        rpianorecordstring += "R";
240
        no_input = false;
241
    }
242
    if (no_input == true)
243
        rpianorecordstring += "W";
244
    rpianorecordcount++;
245
}
246
if (rpianorecordcon == 2)
247
{
248
    press_l = 0;
249
    press_r = 0;
250
    press_u = 0;
251
    press_d = 0;
252
    press_1 = 0;
253
    press_2 = 0;
254
    press_3 = 0;
255
    if (rpianorecordcount < string_length(rpianorecordstring))
256
    {
257
        var _end = 0;
258
        while (_end == 0)
259
        {
260
            var _input = string_char_at(rpianorecordstring, rpianorecordcount);
261
            rpianorecordcount++;
262
            if (_input == "L")
263
                press_l = 1;
264
            if (_input == "R")
265
                press_r = 1;
266
            if (_input == "U")
267
                press_u = 1;
268
            if (_input == "D")
269
                press_d = 1;
270
            if (_input == "1")
271
                press_1 = 1;
272
            if (_input == "2")
273
                press_2 = 1;
274
            if (_input == "3")
275
                press_3 = 1;
276
            if (_input == "0")
277
                _end = 1;
278
            if (rpianorecordcount >= string_length(rpianorecordstring))
279
                _end = 1;
280
        }
281
    }
282
    else
283
    {
284
        if (rpianorecordsave == true && show_question("Do you want to save the right piano recording?"))
285
        {
286
            _string_save = get_string("Input string file name:", "default");
287
            ini_open("pianoplayback.ini");
288
            ini_write_string("piano Playback Info", _string_save, rpianorecordstring);
289
            ini_close();
290
        }
291
        else
292
        {
293
        }
294
        rpianorecordstring = "";
295
        rpianorecordcon = 0;
296
        rpianorecordcount = 0;
297
    }
298
}
299
var rkeydown = 0;
300
if (press_1 || press_2 || press_3 || press_u || press_l || press_r)
301
    rkeydown = 1;
302
if (press_1)
303
    baserindex = 5;
304
if (press_2)
305
    baserindex = 4;
306
if (press_3)
307
    baserindex = 3;
308
if (press_l)
309
    baserindex = 2;
310
if (press_u)
311
    baserindex = 1;
312
if (press_r)
313
    baserindex = 0;
314
if (playsound)
315
{
316
    if (press_1)
317
    {
318
        hipitch = 1.5;
319
        hiplay = 1;
320
    }
321
    if (press_2)
322
    {
323
        hipitch = 1.4;
324
        hiplay = 2;
325
    }
326
    if (press_3)
327
    {
328
        hipitch = 1.3;
329
        hiplay = 3;
330
    }
331
    if (press_l)
332
    {
333
        hipitch = 1.2;
334
        hiplay = 4;
335
    }
336
    if (press_u)
337
    {
338
        hipitch = 1.1;
339
        hiplay = 5;
340
    }
341
    if (press_r)
342
    {
343
        hipitch = 1;
344
        hiplay = 6;
345
    }
346
    if (!press_1 && !press_2 && !press_3 && !press_l && !press_u && !press_r)
347
        hiplay = 0;
348
    if (hiplay != hiplaylast)
349
    {
350
        if (hiplay)
351
            snd_play_pitch(snd_organ_re, hipitch);
352
        hiplaylast = hiplay;
353
    }
354
    if (lpianorecordcon == 1)
355
        draw_text_outline(20, 20, "RECORDING", 1310841);
356
    if (lpianorecordcon == 2)
357
        draw_text_outline(20, 20, "PLAYBACK", 3869451);
358
}
359
draw_sprite_ext(spr_kris_pianopuppet_larm, baselindex + (lkeydown * 6), x - 2, y, 2, 2, 0, image_blend, image_alpha);
360
draw_sprite_ext(spr_kris_pianopuppet_rarm, baserindex + (rkeydown * 6), x - 2, y, 2, 2, 0, image_blend, image_alpha);
361
draw_sprite_ext(spr_kris_pianopuppet_body, 0, x, y, 2, 2, 0, image_blend, image_alpha);