Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_lightp2_Step_0

(view raw script w/o annotations or w/e)
1
if (global.flag[6 Second Dark Ruins light puzzle completion] == true)
2
    exit;
3
if (keyboard_multicheck_pressed(0))
4
{
5
    if (scr_interact
scr_interact

function scr_interact() { if (distance_to_object(obj_pl) < 20 && obj_pl.state == scr_normal_state) { var pl_dir = obj_pl.direction; var pl_x = 0; var pl_y = 0; var check_distance_x = 0; var check_distance_y = 0; switch (pl_dir) { case 0: pl_x = obj_pl.bbox_right; pl_y = obj_pl.bbox_top + 1; check_distance_x = 20; break; case 180: pl_x = obj_pl.bbox_left; pl_y = obj_pl.bbox_top + 1; check_distance_x = -20; break; case 90: pl_x = obj_pl.x; pl_y = obj_pl.bbox_top; check_distance_y = -20; break; case 270: pl_x = obj_pl.x; pl_y = obj_pl.bbox_bottom; check_distance_y = 20; break; } if (collision_line_first(pl_x, pl_y, pl_x + check_distance_x, pl_y + check_distance_y, id, false, false)) return true; } }
() == true)
6
    {
7
        audio_play_sound(snd_switch, 1, 0);
8
        if (turn == true)
9
            turn = false;
10
        else if (turn == false)
11
            turn = true;
12
        if (i == 1)
13
        {
14
            with (obj_lightp2)
15
            {
16
                if (i == 2 || i == 6)
17
                {
18
                    if (turn == true)
19
                        turn = false;
20
                    else if (turn == false)
21
                        turn = true;
22
                }
23
            }
24
        }
25
        if (i == 2)
26
        {
27
            with (obj_lightp2)
28
            {
29
                if (i == 3 || i == 1 || i == 7)
30
                {
31
                    if (turn == true)
32
                        turn = false;
33
                    else if (turn == false)
34
                        turn = true;
35
                }
36
            }
37
        }
38
        if (i == 3)
39
        {
40
            with (obj_lightp2)
41
            {
42
                if (i == 4 || i == 2 || i == 8)
43
                {
44
                    if (turn == true)
45
                        turn = false;
46
                    else if (turn == false)
47
                        turn = true;
48
                }
49
            }
50
        }
51
        if (i == 4)
52
        {
53
            with (obj_lightp2)
54
            {
55
                if (i == 3 || i == 5 || i == 9)
56
                {
57
                    if (turn == true)
58
                        turn = false;
59
                    else if (turn == false)
60
                        turn = true;
61
                }
62
            }
63
        }
64
        if (i == 5)
65
        {
66
            with (obj_lightp2)
67
            {
68
                if (i == 4 || i == 10)
69
                {
70
                    if (turn == true)
71
                        turn = false;
72
                    else if (turn == false)
73
                        turn = true;
74
                }
75
            }
76
        }
77
        if (i == 6)
78
        {
79
            with (obj_lightp2)
80
            {
81
                if (i == 1 || i == 7)
82
                {
83
                    if (turn == true)
84
                        turn = false;
85
                    else if (turn == false)
86
                        turn = true;
87
                }
88
            }
89
        }
90
        if (i == 7)
91
        {
92
            with (obj_lightp2)
93
            {
94
                if (i == 6 || i == 8 || i == 2)
95
                {
96
                    if (turn == true)
97
                        turn = false;
98
                    else if (turn == false)
99
                        turn = true;
100
                }
101
            }
102
        }
103
        if (i == 8)
104
        {
105
            with (obj_lightp2)
106
            {
107
                if (i == 7 || i == 9 || i == 3)
108
                {
109
                    if (turn == true)
110
                        turn = false;
111
                    else if (turn == false)
112
                        turn = true;
113
                }
114
            }
115
        }
116
        if (i == 9)
117
        {
118
            with (obj_lightp2)
119
            {
120
                if (i == 8 || i == 10 || i == 4)
121
                {
122
                    if (turn == true)
123
                        turn = false;
124
                    else if (turn == false)
125
                        turn = true;
126
                }
127
            }
128
        }
129
        if (i == 10)
130
        {
131
            with (obj_lightp2)
132
            {
133
                if (i == 9 || i == 5)
134
                {
135
                    if (turn == true)
136
                        turn = false;
137
                    else if (turn == false)
138
                        turn = true;
139
                }
140
            }
141
        }
142
    }
143
}
144
if (turn == true)
145
    image_index = 0;
146
if (turn == false)
147
    image_index = 1;
148
if (turn == true && waiter == 0)
149
{
150
    obj_puzzle3bridgeroom.puzzlecount += 1;
151
    waiter = 1;
152
}
153
if (turn == false && waiter == 1)
154
{
155
    obj_puzzle3bridgeroom.puzzlecount -= 1;
156
    waiter = 0;
157
}