GMS 2 How to Dynamically Detect and Assign Controller to Player? - 4-Player Game

I have a top down rpg game that has single player controller support for Xbox One controllers that I'd like to add 4 player co-op to and I'm having trouble figuring out how I would detect and assign each contoller to the player and instead of just Xbox One controllers, I would like it to support all the popular controllers, like Xbox 360, Xbox One, Nintendo Switch Pro controller and PS4.

I found this Reddit post that looks to be what I'm wanting to do, but the wording is confusing.

Can someone explain this a little more user friendly? or if there's an easier way?

Also, I don't know much about Data Structures or the Asynchronous Events currently. So the more user friendly the better. But I am willing to learn new techniques.

But like the Reddit post says, I'd like it to function where whichever type of controller presses a button first is the controller that Player 1, Player 2, etc, uses.

This is what my control input code looks like now:

Create Event of o_input

Begin Step of o_input

User Event 0 of o_input

xbox_controller = 0;
    // Movement
    right_ = keyboard_check(vk_right) or gamepad_axis_value(xbox_controller, gp_axislh) > 0.50 or gamepad_button_value(xbox_controller, gp_padr);
    left_  = keyboard_check(vk_left)  or gamepad_axis_value(xbox_controller, gp_axislh) < -0.50 or gamepad_button_value(xbox_controller, gp_padl);
    up_    = keyboard_check(vk_up)    or gamepad_axis_value(xbox_controller, gp_axislv) < -0.40 or gamepad_button_value(xbox_controller, gp_padu);
    down_  = keyboard_check(vk_down)  or gamepad_axis_value(xbox_controller, gp_axislv) > 0.40 or gamepad_button_value(xbox_controller, gp_padd);    
    right_pressed_ = keyboard_check_pressed(vk_right) or gamepad_button_check_pressed(xbox_controller, gp_padr);
    left_pressed_  = keyboard_check_pressed(vk_left)  or gamepad_button_check_pressed(xbox_controller, gp_padl);
    up_pressed_    = keyboard_check_pressed(vk_up)    or gamepad_button_check_pressed(xbox_controller, gp_padu);
    down_pressed_  = keyboard_check_pressed(vk_down)  or gamepad_button_check_pressed(xbox_controller, gp_padd);
    // Action Keys

    pause_pressed_        = keyboard_check_pressed(vk_enter) or gamepad_button_check_pressed(xbox_controller, gp_start);
    menu_pause_pressed_   = keyboard_check_pressed(vk_shift) or gamepad_button_check_pressed(xbox_controller, gp_select);

    action_one_   = gamepad_button_check(xbox_controller, gp_face3) or keyboard_check(ord("D"));
    action_two_   = gamepad_button_check(xbox_controller, gp_face2) or keyboard_check(ord("A"));
    action_three_ = gamepad_button_check(xbox_controller, gp_face4) or keyboard_check(ord("W"));
    action_four_  = gamepad_button_check(xbox_controller, gp_face1) or keyboard_check(ord("S"));

    action_one_pressed_   = gamepad_button_check_pressed(xbox_controller, gp_face3) or keyboard_check_pressed(ord("D"));
    action_two_pressed_   = gamepad_button_check_pressed(xbox_controller, gp_face2) or keyboard_check_pressed(ord("A"));
    action_three_pressed_ = gamepad_button_check_pressed(xbox_controller, gp_face4) or keyboard_check_pressed(ord("W"));
    action_four_pressed_  = gamepad_button_check_pressed(xbox_controller, gp_face1) or keyboard_check_pressed(ord("S"));