Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dev_console_Step_0

(view raw script w/o annotations or w/e)
1
if (mouse_check_button_pressed(mb_left))
2
{
3
    var clicked_instance = instance_place(mouse_x, mouse_y, all);
4
    if (clicked_instance == -4)
5
    {
6
        instance_selected = 0;
7
        instance_selected_name = "nothing";
8
    }
9
    else
10
    {
11
        instance_selected = clicked_instance;
12
        instance_selected_name = object_get_name(clicked_instance.object_index);
13
        instance_selected_variables = variable_instance_get_names(clicked_instance);
14
        instance_selected_variable_current = 0;
15
    }
16
}
17
if (mouse_check_button_pressed(mb_right))
18
{
19
    instance_selected = 0;
20
    instance_selected_name = "nothing";
21
    instance_selected_variable_current = 0;
22
    instance_selected_variables = 0;
23
}
24
if (keyboard_check_pressed(vk_pageup))
25
{
26
    if (instance_selected_variable_current < (array_length(instance_selected_variables) - 1))
27
        instance_selected_variable_current += 1;
28
    else
29
        instance_selected_variable_current = 0;
30
}
31
if (keyboard_check_pressed(vk_pagedown))
32
{
33
    if (instance_selected_variable_current > 0)
34
        instance_selected_variable_current -= 1;
35
    else
36
        instance_selected_variable_current = array_length(instance_selected_variables) - 1;
37
}
38
output = keyboard_string;
39
var command_end_pos = string_length(output);
40
var command = "";
41
if (keyboard_check_pressed(vk_home) && is_array(instance_selected_variables) && array_length(instance_selected_variables) >= 1)
42
{
43
    for (var i = 0; i < string_length(output); i++)
44
    {
45
        if (string_char_at(output, i) == " ")
46
        {
47
            command_end_pos = i - 1;
48
            break;
49
        }
50
    }
51
    command = string_copy(output, 0, command_end_pos);
52
    var value = string_copy(output, command_end_pos + 2, string_length(output) - command_end_pos);
53
    switch (command)
54
    {
55
        case "varset":
56
            var variable_name = instance_selected_variables[instance_selected_variable_current];
57
            var variable_value = variable_instance_get(instance_selected, variable_name);
58
            var output_value;
59
            if (is_real(variable_value))
60
            {
61
                var output_digits = string_digits(output);
62
                if (output_digits == "")
63
                {
64
                    show_message("Not a digit.");
65
                    exit;
66
                }
67
                output_value = real(output_digits);
68
            }
69
            else
70
            {
71
                output_value = string(output);
72
            }
73
            variable_instance_set(instance_selected, variable_name, output_value);
74
            break;
75
        case "roomset":
76
            var room_id = asset_get_index(string(value));
77
            if (room_exists(room_id))
78
                room_goto(room_id);
79
            else
80
                show_message(value + " This room does not exist.");
81
            break;
82
        case "mute":
83
            audio_master_gain(0);
84
            break;
85
        case "unmute":
86
            audio_master_gain(1);
87
            break;
88
    }
89
    output = "";
90
    keyboard_string = "";
91
}