Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_lightp_Step_0

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

function scr_interact() //gml_Script_scr_interact { if (distance_to_object(obj_pl) < 20 && obj_pl.state == gml_Script_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_lightp)
15
            {
16
                if (i == 2)
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_lightp)
28
            {
29
                if (i == 3 || i == 1)
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_lightp)
41
            {
42
                if (i == 4 || i == 2)
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_lightp)
54
            {
55
                if (i == 3 || i == 5)
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_lightp)
67
            {
68
                if (i == 4)
69
                {
70
                    if (turn == true)
71
                        turn = false
72
                    else if (turn == false)
73
                        turn = true
74
                }
75
            }
76
        }
77
    }
78
}
79
if (turn == true)
80
    image_index = 0
81
if (turn == false)
82
    image_index = 1
83
if (turn == true && waiter == 0)
84
{
85
    obj_puzzle2.puzzlecount += 1
86
    waiter = 1
87
}
88
if (turn == false && waiter == 1)
89
{
90
    obj_puzzle2.puzzlecount -= 1
91
    waiter = 0
92
}