Undertale script viewer

← back to main script listing

gml_Object_obj_waterboardpuzzle1_Step_0

(view raw script w/o annotations or w/e)
1
if (won == 0)
2
{
3
    for (i = 0; i < instance_number(obj_waterboard); i += 1)
4
    {
5
        h = 0;
6
        v = 0;
7
        me = instance_find(obj_waterboard, i);
8
        xx = me.x;
9
        yy = me.y;
10
        j = 1;
11
        rx[0] = 1;
12
        lx[0] = 1;
13
        ux[0] = 1;
14
        dx[0] = 1;
15
        doodly = 0;
16
        repeat (3)
17
        {
18
            lx[j] = 0;
19
            dx[j] = 0;
20
            rx[j] = 0;
21
            ux[j] = 0;
22
            l[j] = instance_position(xx - 2 - doodly, yy, obj_waterboard);
23
            r[j] = instance_position(xx + 22 + doodly, yy, obj_waterboard);
24
            u[j] = instance_position(xx, yy - 2 - doodly, obj_waterboard);
25
            d[j] = instance_position(xx, yy + 22 + doodly, obj_waterboard);
26
            if (l[j] != -4 && lx[j - 1] == 1)
27
            {
28
                if (l[j].using == 3)
29
                {
30
                    h += 1;
31
                    lx[j] = 1;
32
                }
33
            }
34
            if (r[j] != -4 && rx[j - 1] == 1)
35
            {
36
                if (r[j].using == 3)
37
                {
38
                    h += 1;
39
                    rx[j] = 1;
40
                }
41
            }
42
            if (u[j] != -4 && ux[j - 1] == 1)
43
            {
44
                if (u[j].using == 3)
45
                {
46
                    v += 1;
47
                    ux[j] = 1;
48
                }
49
            }
50
            if (d[j] != -4 && dx[j - 1] == 1)
51
            {
52
                if (d[j].using == 3)
53
                {
54
                    v += 1;
55
                    dx[j] = 1;
56
                }
57
            }
58
            j += 1;
59
            doodly += 20;
60
        }
61
        if (v >= 3 && me.using == 3)
62
        {
63
            won = 90;
64
            n = 1;
65
            me.using = 5;
66
            repeat (3)
67
            {
68
                if (u[n] != -4 && ux[n - 1] == 1)
69
                    u[n].using = 5;
70
                if (d[n] != -4 && dx[n - 1] == 1)
71
                    d[n].using = 5;
72
                n += 1;
73
            }
74
        }
75
        if (h >= 3 && me.using == 3)
76
        {
77
            won = 90;
78
            n = 1;
79
            me.using = 5;
80
            repeat (3)
81
            {
82
                if (r[n] != -4 && rx[n - 1] == 1)
83
                    r[n].using = 5;
84
                if (l[n] != -4 && lx[n - 1] == 1)
85
                    l[n].using = 5;
86
                n += 1;
87
            }
88
        }
89
    }
90
}
91
if (won == 9999)
92
{
93
    if (won == 2 && global.interact == 0)
94
    {
95
        global.interact = 1;
96
        won = 97;
97
        vol1 = caster_get_volume(global.currentsong);
98
        vol2 = vol1;
99
        caster_pause(global.currentsong);
100
    }
101
    if (won == 97)
102
    {
103
        vol2 -= 0.02;
104
        caster_set_volume(global.currentsong, vol2);
105
        if (vol2 < 0.04)
106
        {
107
            vol2 = 0;
108
            caster_pause(global.currentsong);
109
            won = 98;
110
        }
111
    }
112
    if (won == 98)
113
    {
114
        snd_play(snd_dumbvictory);
115
        global.msg[0] = "* (You hear a small voice.)/";
116
        global.msg[1] = "* Congratulations!/";
117
        global.msg[2] = "* What's wrong with you!/%%";
118
        scr_regulartext
scr_regulartext

global.typer = 5; global.facechoice = 0; global.faceemotion = 0; global.msc = 0; instance_create(0, 0, obj_dialoguer);
();
119
        won = 99;
120
    }
121
    if (won == 99 && instance_exists(OBJ_WRITER) == 0)
122
    {
123
        global.interact = 0;
124
        caster_set_volume(global.currentsong, vol1);
125
        caster_resume(global.currentsong);
126
        won = 100;
127
    }
128
}