Undertale script viewer

← back to main script listing

gml_Script_control_update

(view raw script w/o annotations or w/e)
1
var new_state = keyboard_check(ord("Z")) || keyboard_check(vk_enter);
2
if (global.osflavor >= 4)
3
    new_state = new_state || gamepad_button_check(0, global.button0);
4
else if (obj_time.j_ch > 0)
5
    new_state = new_state || joystick_check_button(obj_time.j_ch, global.button0);
6
global.control_new_state[0] = new_state;
7
new_state = keyboard_check(ord("X")) || keyboard_check(vk_shift);
8
if (global.osflavor >= 4)
9
    new_state = new_state || gamepad_button_check(0, global.button1);
10
else if (obj_time.j_ch > 0)
11
    new_state = new_state || joystick_check_button(obj_time.j_ch, global.button1);
12
global.control_new_state[1] = new_state;
13
new_state = keyboard_check(ord("C")) || keyboard_check(vk_control);
14
if (global.osflavor >= 4)
15
    new_state = new_state || gamepad_button_check(0, global.button2);
16
else if (obj_time.j_ch > 0)
17
    new_state = new_state || joystick_check_button(obj_time.j_ch, global.button2);
18
global.control_new_state[2] = new_state;
19
for (var i = 0; i <= 2; i++)
20
{
21
    global.control_pressed[i] = !global.control_state[i] && global.control_new_state[i];
22
    global.control_state[i] = global.control_new_state[i];
23
}