Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_ruins_04_controller_Step_0

(view raw script w/o annotations or w/e)
1
var actor_toriel = obj_toriel_npc
2
switch scene
3
{
4
    case 0:
5
        cutscene_wait(0.25)
6
        break
7
    case 1:
8
        scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
9
        with (msg)
10
        {
11
            talker[0] = actor_toriel
12
            message[0] = "* In this room, you will#  need to trigger several#  switches."
13
            message[1] = "* Do not worry, I have#  labelled the ones that#  you need to flip."
14
            prt[0] = 343
15
            prt[1] = 343
16
        }
17
        if (!global.dialogue_open)
18
        {
19
            scene++
20
            scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
21
        }
22
        break
23
    case 2:
24
        cutscene_npc_walk(actor_toriel, 470, 140, (3 + obj_pl.is_sprinting * 2), "x", "left", "nothing")
25
        break
26
    case 3:
27
        if actor_toriel.interact
28
        {
29
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
30
            with (msg)
31
            {
32
                talker[0] = actor_toriel
33
                message[0] = "* Oh, do you need some#  help?"
34
                message[1] = "* Please flip the switch#  on the north wall."
35
                prt[0] = 340
36
                prt[1] = 343
37
            }
38
        }
39
        with (obj_switch2)
40
        {
41
            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; } }
() && keyboard_multicheck_pressed(0))
42
            {
43
                audio_play_sound(snd_switch, 1, 0)
44
                image_index = 1
45
                other.scene += 1
46
                instance_destroy(obj_inviswall)
47
            }
48
        }
49
        break
50
    case 4:
51
        cutscene_dialogue()
52
        with (msg)
53
        {
54
            talker[0] = actor_toriel
55
            message[0] = "* Splendid! I am proud#  of you my child. "
56
            prt[0] = 343
57
        }
58
        actor_toriel.npc_direction = "up"
59
        break
60
    case 5:
61
        cutscene_npc_walk(actor_toriel, 688, 140, (3 + obj_pl.is_sprinting * 2), "x", "left")
62
        actor_toriel.walk_speed_x = 3 + obj_pl.is_sprinting * 2
63
        break
64
    case 6:
65
        if actor_toriel.interact
66
        {
67
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
68
            with (msg)
69
            {
70
                talker[0] = actor_toriel
71
                message[0] = "* Go on, I believe in#  you!"
72
                message[1] = "* Only one more switch#  remains."
73
                prt[0] = 343
74
                prt[1] = 343
75
            }
76
        }
77
        with (obj_switch3)
78
        {
79
            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; } }
() && keyboard_multicheck_pressed(0))
80
            {
81
                audio_play_sound(snd_switch, 1, 0)
82
                image_index = 1
83
                other.scene += 1
84
                global.cutscene = true
85
            }
86
        }
87
        with (obj_switch4)
88
        {
89
            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; } }
() && keyboard_multicheck_pressed(0))
90
            {
91
                scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
92
                with (msg)
93
                {
94
                    talker[0] = actor_toriel
95
                    message[0] = "* Oh no, my child! That#  is the wrong switch."
96
                    message[1] = "* I have labelled the one#  you need to flip."
97
                    prt[0] = 340
98
                    prt[1] = 343
99
                }
100
            }
101
        }
102
        with (obj_switch2)
103
        {
104
            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; } }
() && keyboard_multicheck_pressed(0))
105
            {
106
                scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
107
                with (msg)
108
                {
109
                    talker[0] = actor_toriel
110
                    message[0] = "* That switch has already#  been flipped."
111
                    message[1] = "* Why don't you come back#  across the bridge?"
112
                    prt[0] = 340
113
                    prt[1] = 343
114
                }
115
            }
116
        }
117
        break
118
    case 7:
119
        cutscene_npc_direction(actor_toriel, "up")
120
        break
121
    case 8:
122
        cutscene_wait(1)
123
        break
124
    case 9:
125
        cutscene_dialogue()
126
        with (msg)
127
        {
128
            talker[0] = actor_toriel
129
            message[0] = "* ...It should have opened#  by now..."
130
            message[1] = "* I am sure I labelled the#  correct lever..."
131
            message[2] = "* Ah, do not worry, little#  one! Try flipping the#  other switch."
132
            prt[0] = 340
133
            prt[1] = 340
134
            prt[2] = 343
135
        }
136
        break
137
    case 10:
138
        scr_cutscene_end
scr_cutscene_end

function scr_cutscene_end() //gml_Script_scr_cutscene_end { global.cutscene = false obj_pl.alarm[0] = 1 }
()
139
        cutscene_npc_direction(actor_toriel, "left")
140
        break
141
    case 11:
142
        if actor_toriel.interact
143
        {
144
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
145
            with (msg)
146
            {
147
                talker[0] = actor_toriel
148
                message[0] = "* I am unsure as to why#  this switch is not#  working..."
149
                message[1] = "* Please, try flipping#  the other switch."
150
                prt[0] = 340
151
                prt[1] = 343
152
            }
153
        }
154
        with (obj_switch4)
155
        {
156
            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; } }
() && keyboard_multicheck_pressed(0))
157
            {
158
                audio_play_sound(snd_switch, 1, 0)
159
                image_index = 1
160
                other.scene += 1
161
                global.cutscene = true
162
            }
163
        }
164
        with (obj_switch3)
165
        {
166
            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; } }
() && keyboard_multicheck_pressed(0))
167
            {
168
                scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
169
                with (msg)
170
                {
171
                    talker[0] = actor_toriel
172
                    message[0] = "* I must have labelled the#  wrong switch."
173
                    message[1] = "* I apologize if I have#  confused you, my child."
174
                    message[2] = "* Please flip the switch#  that is not labelled."
175
                    prt[0] = 340
176
                    prt[1] = 340
177
                    prt[2] = 343
178
                }
179
            }
180
        }
181
        with (obj_switch2)
182
        {
183
            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; } }
() && keyboard_multicheck_pressed(0))
184
            {
185
                scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
186
                with (msg)
187
                {
188
                    talker[0] = actor_toriel
189
                    message[0] = "* Um..."
190
                    message[1] = "* That is not what I#  meant."
191
                    message[2] = "* You need to flip the#  switch you have not#  flipped yet."
192
                    prt[0] = 340
193
                    prt[1] = 340
194
                    prt[2] = 343
195
                }
196
            }
197
        }
198
        break
199
    case 12:
200
        cutscene_npc_direction(actor_toriel, "up")
201
        break
202
    case 13:
203
        instance_create(obj_pl.x, obj_pl.y, obj_playerfall)
204
        instance_destroy(obj_pl)
205
        cutscene_advance()
206
        break
207
    case 14:
208
        cutscene_audio_fade(obj_radio.current_song, 0, 500, 1, false)
209
        break
210
    case 15:
211
        cutscene_dialogue()
212
        with (msg)
213
        {
214
            skippable = false
215
            message[0] = "* !..."
216
            prt[0] = 341
217
        }
218
        if cutscene_wait(1)
219
            instance_destroy(msg)
220
        break
221
    case 16:
222
        cutscene_npc_walk(actor_toriel, 638, 80, 4, "x", "up")
223
        break
224
    case 17:
225
        cutscene_wait(2)
226
        break
227
    case 18:
228
        global.item_slot[1] = "Nothing"
229
        if (!instance_exists(obj_transition2))
230
        {
231
            trn = instance_create(x, y, obj_transition2)
232
            trn.newRoom = 11
233
            trn.xx = x
234
            trn.yy = y
235
            trn.fadespeed = 1
236
            scene++
237
        }
238
        break
239
}