Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dunes_12_elevator_Step_0

(view raw script w/o annotations or w/e)
1
if (global.dunes_flag[4] < 2)
2
{
3
    if (keyboard_multicheck_pressed(0) && 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; } }
())
4
    {
5
        if (global.dunes_flag[4] == 0)
6
        {
7
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
8
            with (msg)
9
            {
10
                message[0] = "* (A piece of wood is lodged#  in-between the elevator doors.)"
11
                message[1] = "* (What could fix this poor#  elevator?)"
12
            }
13
            elevator_menu_open = true
14
            global.dunes_flag[4] += 1
15
        }
16
        else if (global.dunes_flag[4] == 1)
17
            elevator_menu_open = true
18
    }
19
    if ((!global.dialogue_open) && elevator_menu_open == true)
20
    {
21
        instance_create(x, y, obj_item_use_menu)
22
        scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() //gml_Script_scr_cutscene_start { global.cutscene = true obj_pl.state = gml_Script_scr_frozen_state obj_pl.image_index = 0 obj_pl.image_speed = 0 }
()
23
        elevator_menu_open = false
24
    }
25
    if (global.item_used_overworld != undefined)
26
    {
27
        scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
28
        with (msg)
29
        {
30
            switch global.item_used_overworld
31
            {
32
                case "Pickaxe":
33
                    message[0] = "* (You use the pickaxe to hack#  away at the wood.)"
34
                    other.elevator_solution = "Pickaxe"
35
                    break
36
                case "Steel Buckle":
37
                case "Flint":
38
                    if (scr_item_exists_check
scr_item_exists_check

function scr_item_exists_check(argument0) //gml_Script_scr_item_exists_check { var i = 1 while (i <= 8) { if (global.item_slot[i] == argument0) return true; else { if (i == 8) return false; i += 1 continue } } }
("Flint") && scr_item_exists_check
scr_item_exists_check

function scr_item_exists_check(argument0) //gml_Script_scr_item_exists_check { var i = 1 while (i <= 8) { if (global.item_slot[i] == argument0) return true; else { if (i == 8) return false; i += 1 continue } } }
("Steel Buckle"))
39
                    {
40
                        message[0] = "* (You start rubbing the steel#  buckle against the flint.)"
41
                        other.elevator_solution = "Flint & Steel"
42
                    }
43
                    else
44
                    {
45
                        message[0] = "* (You can't think of a way to#  make this work.)"
46
                        global.cutscene = false
47
                    }
48
                    break
49
                case "Matches":
50
                    message[0] = "* (You strike a match on the#  piece of wood.)"
51
                    other.elevator_solution = "Matches"
52
                    break
53
                default:
54
                    message[0] = "* (You can't think of a way to#  make this work.)"
55
                    global.cutscene = false
56
                    break
57
            }
58
59
        }
60
        if (!global.dialogue_open)
61
            global.item_used_overworld = undefined
62
    }
63
    if ((!global.dialogue_open) && elevator_solution != "none")
64
    {
65
        switch elevator_solution
66
        {
67
            case "Pickaxe":
68
                var newsprite = spr_dunes_13_elevator_pick
69
                var newmessage = "* (The pickaxe broke.)"
70
                var newsound = snd_elevator_pickaxe
71
                break
72
            case "Flint & Steel":
73
                newsprite = spr_dunes_13_elevator_burn
74
                newmessage = "* (The flint crumbled away and#  the buckle melted.)"
75
                newsound = snd_elevator_burn
76
                scr_item_remove
scr_item_remove

function scr_item_remove(argument0) //gml_Script_scr_item_remove { i = 1 while (i <= 8) { if (global.item_slot[i] == argument0) { while (i < 8) { global.item_slot[i] = global.item_slot[(i + 1)] i += 1 } global.item_slot[8] = "Nothing" return true; } else { if (i == 8) return false; i += 1 continue } } }
("Flint")
77
                scr_item_remove
scr_item_remove

function scr_item_remove(argument0) //gml_Script_scr_item_remove { i = 1 while (i <= 8) { if (global.item_slot[i] == argument0) { while (i < 8) { global.item_slot[i] = global.item_slot[(i + 1)] i += 1 } global.item_slot[8] = "Nothing" return true; } else { if (i == 8) return false; i += 1 continue } } }
("Steel Buckle")
78
                break
79
            case "Matches":
80
                newsprite = spr_dunes_13_elevator_burn
81
                newmessage = "* (The whole box of matches#  caught fire and burnt up.)"
82
                newsound = snd_elevator_burn
83
                break
84
        }
85
86
        if (sprite_index == spr_dunes_13_elevator)
87
        {
88
            scr_item_remove
scr_item_remove

function scr_item_remove(argument0) //gml_Script_scr_item_remove { i = 1 while (i <= 8) { if (global.item_slot[i] == argument0) { while (i < 8) { global.item_slot[i] = global.item_slot[(i + 1)] i += 1 } global.item_slot[8] = "Nothing" return true; } else { if (i == 8) return false; i += 1 continue } } }
(elevator_solution)
89
            sprite_index = newsprite
90
            audio_play_sound(newsound, 1, 0)
91
            image_speed = 0.3
92
            timer = 30
93
        }
94
        else if (image_index >= (image_number - 1))
95
        {
96
            if (!scr_timer
scr_timer

function scr_timer() //gml_Script_scr_timer { if (timer > 0) { timer-- return false; } else return true; }
())
97
            {
98
                image_speed = 0
99
                return;
100
            }
101
            else if (sprite_index == newsprite)
102
            {
103
                audio_play_sound(snd_elevator_open, 1, 0)
104
                sprite_index = spr_dunes_13_elevator_fixed
105
                image_speed = 0.3
106
                image_index = 0
107
                return;
108
            }
109
            image_speed = 0
110
            instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_12)
111
            global.dunes_flag[4] = 2
112
            scr_text
scr_text

function scr_text() //gml_Script_scr_text { if (!instance_exists(obj_dialogue)) msg = instance_create(x, y, obj_dialogue) }
()
113
            with (msg)
114
                message[0] = newmessage
115
        }
116
    }
117
}
118
else
119
{
120
    if (keyboard_multicheck_pressed(0) && 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; } }
() && image_speed == 0)
121
    {
122
        if (image_speed == 0)
123
        {
124
            scr_cutscene_start
scr_cutscene_start

function scr_cutscene_start() //gml_Script_scr_cutscene_start { global.cutscene = true obj_pl.state = gml_Script_scr_frozen_state obj_pl.image_index = 0 obj_pl.image_speed = 0 }
()
125
            image_speed = 0.3
126
            audio_play_sound(snd_elevator_open, 1, 0)
127
            return;
128
        }
129
    }
130
    if (floor(image_index) <= 0 && image_speed < 0)
131
    {
132
        image_speed = 0
133
        image_index = 0
134
    }
135
    if (image_index >= (image_number - 1) && image_speed > 0)
136
    {
137
        image_speed = 0
138
        instance_create(obj_pl.x, obj_pl.y, obj_npc_clover_dunes_12)
139
    }
140
}