Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_scr_get_input

(view raw script w/o annotations or w/e)
1
function scr_get_input
scr_get_input

function scr_get_input() //gml_Script_scr_get_input { if live_call() return global.live_result; scr_stick_press() global.down_key = (keyboard_check(vk_down) || gamepad_button_check(0, gp_padd) || gamepad_axis_value(0, gp_axislv)) global.left_key = (keyboard_check(vk_left) || gamepad_button_check(0, gp_padl) || (-(gamepad_axis_value(0, gp_axislh)))) global.right_key = (keyboard_check(vk_right) || gamepad_button_check(0, gp_padr) || gamepad_axis_value(0, gp_axislh)) global.up_key = (keyboard_check(vk_up) || gamepad_button_check(0, gp_padu) || (-(gamepad_axis_value(0, gp_axislv)))) global.down_keyp = (keyboard_check_pressed(vk_down) || gamepad_button_check_pressed(0, gp_padd) || down_stick) global.left_keyp = (keyboard_check_pressed(vk_left) || gamepad_button_check_pressed(0, gp_padl) || left_stick) global.right_keyp = (keyboard_check_pressed(vk_right) || gamepad_button_check_pressed(0, gp_padr) || right_stick) global.up_keyp = (keyboard_check_pressed(vk_up) || gamepad_button_check_pressed(0, gp_padu) || up_stick) if ((gamepad_button_check_pressed(0, gp_padd)) + (gamepad_button_check_pressed(0, gp_padu)) + (gamepad_button_check_pressed(0, gp_padl)) + (gamepad_button_check_pressed(0, gp_padr)) + down_stick + left_stick + right_stick + up_stick + (gamepad_button_check_pressed(0, global.button1)) + (gamepad_button_check_pressed(0, global.button2)) + (gamepad_button_check_pressed(0, global.button3)) + instance_exists(obj_phone_controls)) global.using_gamepad = true else if keyboard_check(vk_anykey) global.using_gamepad = false if global.using_gamepad { if (global.button1 == gp_face1) global.action_key = "A" else if (global.button1 == gp_face2) global.action_key = "B" else if (global.button1 == gp_face3) global.action_key = "X" else if (global.button1 == gp_face4) global.action_key = "Y" if (global.button2 == gp_face1) global.cancel_key = "A" else if (global.button2 == gp_face2) global.cancel_key = "B" else if (global.button2 == gp_face3) global.cancel_key = "X" else if (global.button2 == gp_face4) global.cancel_key = "Y" if (global.button3 == 32769) global.pause_key = "A" else if (global.button3 == 32770) global.pause_key = "B" else if (global.button3 == 32771) global.pause_key = "X" else if (global.button3 == 32772) global.pause_key = "Y" } else { global.pause_key = "C" global.action_key = "Z" global.cancel_key = "X" } if instance_exists(obj_phone_controls) { global.down_key += obj_phone_controls.phn_down global.left_key += obj_phone_controls.phn_left global.right_key += obj_phone_controls.phn_right global.up_key += obj_phone_controls.phn_up global.down_keyp = sign(global.down_keyp + obj_phone_controls.phn_downp) global.left_keyp = sign(global.left_keyp + obj_phone_controls.phn_leftp) global.right_keyp = sign(global.right_keyp + obj_phone_controls.phn_rightp) global.up_keyp = sign(global.up_keyp + obj_phone_controls.phn_upp) } }
() //gml_Script_scr_get_input
2
{
3
    if live_call()
4
        return global.live_result;
5
    scr_stick_press
scr_stick_press

function scr_stick_press() //gml_Script_scr_stick_press { down_stick = 0 left_stick = 0 up_stick = 0 right_stick = 0 if (gamepad_axis_value(0, gp_axislv) > global.gamepad_deadzone && global.down_pressed == 0) { down_stick = 1 global.down_pressed = 1 } else down_stick = 0 if (gamepad_axis_value(0, gp_axislv) < (-global.gamepad_deadzone) && global.up_pressed == 0) { up_stick = 1 global.up_pressed = 1 } else up_stick = 0 if (gamepad_axis_value(0, gp_axislh) < (-global.gamepad_deadzone) && global.left_pressed == 0) { left_stick = 1 global.left_pressed = 1 } else left_stick = 0 if (gamepad_axis_value(0, gp_axislh) > global.gamepad_deadzone && global.right_pressed == 0) { right_stick = 1 global.right_pressed = 1 } else right_stick = 0 if (gamepad_axis_value(0, gp_axislh) > (-global.gamepad_deadzone) && gamepad_axis_value(0, gp_axislh) < global.gamepad_deadzone) { global.left_pressed = 0 global.right_pressed = 0 } if (gamepad_axis_value(0, gp_axislv) > (-global.gamepad_deadzone) && gamepad_axis_value(0, gp_axislv) < global.gamepad_deadzone) { global.up_pressed = 0 global.down_pressed = 0 } }
()
6
    global.down_key = (keyboard_check(vk_down) || gamepad_button_check(0, gp_padd) || gamepad_axis_value(0, gp_axislv))
7
    global.left_key = (keyboard_check(vk_left) || gamepad_button_check(0, gp_padl) || (-(gamepad_axis_value(0, gp_axislh))))
8
    global.right_key = (keyboard_check(vk_right) || gamepad_button_check(0, gp_padr) || gamepad_axis_value(0, gp_axislh))
9
    global.up_key = (keyboard_check(vk_up) || gamepad_button_check(0, gp_padu) || (-(gamepad_axis_value(0, gp_axislv))))
10
    global.down_keyp = (keyboard_check_pressed(vk_down) || gamepad_button_check_pressed(0, gp_padd) || down_stick)
11
    global.left_keyp = (keyboard_check_pressed(vk_left) || gamepad_button_check_pressed(0, gp_padl) || left_stick)
12
    global.right_keyp = (keyboard_check_pressed(vk_right) || gamepad_button_check_pressed(0, gp_padr) || right_stick)
13
    global.up_keyp = (keyboard_check_pressed(vk_up) || gamepad_button_check_pressed(0, gp_padu) || up_stick)
14
    if ((gamepad_button_check_pressed(0, gp_padd)) + (gamepad_button_check_pressed(0, gp_padu)) + (gamepad_button_check_pressed(0, gp_padl)) + (gamepad_button_check_pressed(0, gp_padr)) + down_stick + left_stick + right_stick + up_stick + (gamepad_button_check_pressed(0, global.button1)) + (gamepad_button_check_pressed(0, global.button2)) + (gamepad_button_check_pressed(0, global.button3)) + instance_exists(obj_phone_controls))
15
        global.using_gamepad = true
16
    else if keyboard_check(vk_anykey)
17
        global.using_gamepad = false
18
    if global.using_gamepad
19
    {
20
        if (global.button1 == gp_face1)
21
            global.action_key = "A"
22
        else if (global.button1 == gp_face2)
23
            global.action_key = "B"
24
        else if (global.button1 == gp_face3)
25
            global.action_key = "X"
26
        else if (global.button1 == gp_face4)
27
            global.action_key = "Y"
28
        if (global.button2 == gp_face1)
29
            global.cancel_key = "A"
30
        else if (global.button2 == gp_face2)
31
            global.cancel_key = "B"
32
        else if (global.button2 == gp_face3)
33
            global.cancel_key = "X"
34
        else if (global.button2 == gp_face4)
35
            global.cancel_key = "Y"
36
        if (global.button3 == 32769)
37
            global.pause_key = "A"
38
        else if (global.button3 == 32770)
39
            global.pause_key = "B"
40
        else if (global.button3 == 32771)
41
            global.pause_key = "X"
42
        else if (global.button3 == 32772)
43
            global.pause_key = "Y"
44
    }
45
    else
46
    {
47
        global.pause_key = "C"
48
        global.action_key = "Z"
49
        global.cancel_key = "X"
50
    }
51
    if instance_exists(obj_phone_controls)
52
    {
53
        global.down_key += obj_phone_controls.phn_down
54
        global.left_key += obj_phone_controls.phn_left
55
        global.right_key += obj_phone_controls.phn_right
56
        global.up_key += obj_phone_controls.phn_up
57
        global.down_keyp = sign(global.down_keyp + obj_phone_controls.phn_downp)
58
        global.left_keyp = sign(global.left_keyp + obj_phone_controls.phn_leftp)
59
        global.right_keyp = sign(global.right_keyp + obj_phone_controls.phn_rightp)
60
        global.up_keyp = sign(global.up_keyp + obj_phone_controls.phn_upp)
61
    }
62
}