How to detect Directional Stick on gamepad?

Does MV have any default codes for detecting the directional sticks?(the ones not used for movement but for "looking around") I checked the engine's code and even the script call list for Input.gamepadMapper but I only see inputs for up/down/left/right.

If not, what would be the simplest way to implement it? It's been a while since I last used the gamepad api
You could try a plugin specialized for gamepad support
You could try a plugin specialized for gamepad support
that again seems to only check for D-pad(the arrows) and/or left stick which is for movement.
I need something for checking the right stick, for aiming around
that again seems to only check for D-pad(the arrows) and/or left stick which is for movement.
I need something for checking the right stick, for aiming around
The gamepad state update function doesn't support it by default but it shouldn't be hard to add the right stick axes to it.
The API used in RPGMV's RPG_CORE.js is Input, it's not something simple for common users...
Going to line 3036 there is a mapping of the keys by the ID passed from what I understand:
JavaScript:
Input.gamepadMapper = {
    0: 'ok',        // A
    1: 'cancel',    // B
    2: 'shift',     // X
    3: 'menu',      // Y
    4: 'pageup',    // LB
    5: 'pagedown',  // RB
    12: 'up',       // D-pad up
    13: 'down',     // D-pad down
    14: 'left',     // D-pad left
    15: 'right',    // D-pad right
};

The problem is that the "core" functions make the keys work in parallel, so Input.isPressed("right") will check if the "AXIS" is to the right, but it will also check if the "Right" key on the keyboard will also activate the Conditional Branch.

Code:
◆If:Button [Right] is pressed down
  ◆Show Balloon Icon:Player, Exclamation (Wait)
  ◆
:End

Now to be able to confirm that only the GamePad would really have to learn the native API:

I believe that to check whether it is to the right or left it is like this, with "-1" being left and "1" being right:
JavaScript:
parseInt(navigator.getGamepads()[0].axes[0])

On RPG Maker:
Code:
◆If:Script:parseInt(navigator.getGamepads()[0].axes[0]) == 1
  ◆Show Balloon Icon:Player, Exclamation (Wait)
  ◆
:End

I'm not a programmer, I just read the APIs and use logical sense to understand something, so that's what I assume.
But one thing is certain, this check is for control "1", if you connect another control the object will appear in Array [ 1 ] and not in [ 0 ]:
JavaScript:
navigator.getGamepads()[0] /*Gampad 1*/
navigator.getGamepads()[1] /*Gampad 2*/
navigator.getGamepads()[2] /*Gampad 3*/

I have two USB controllers here to test if I disconnect the first one to see if the second one will take control of the game, but I don't have time at the moment.
The API used in RPGMV's RPG_CORE.js is Input, it's not something simple for common users...
Going to line 3036 there is a mapping of the keys by the ID passed from what I understand:
Code:
Input.gamepadMapper = {
    0: 'ok',        // A
    1: 'cancel',    // B
    2: 'shift',     // X
    3: 'menu',      // Y
    4: 'pageup',    // LB
    5: 'pagedown',  // RB
    12: 'up',       // D-pad up
    13: 'down',     // D-pad down
    14: 'left',     // D-pad left
    15: 'right',    // D-pad right
};

The problem is that the "core" functions make the keys work in parallel, so Input.isPressed("right") will check if the "AXIS" is to the right, but it will also check if the "Right" key on the keyboard will also activate the Conditional Branch.

Code:
◆If:Button [Right] is pressed down
  ◆Show Balloon Icon:Player, Exclamation (Wait)
  ◆
:End

Now to be able to confirm that only the GamePad would really have to learn the native API:

I believe that to check whether it is to the right or left it is like this, with "-1" being left and "1" being right:
Code:
parseInt(navigator.getGamepads()[0].axes[0])

I'm not a programmer, I just read the APIs and use logical sense to understand something, so that's what I assume.
But one thing is certain, this check is for control "1", if you connect another control the object will appear in Array [ 1 ] and not in [ 0 ]:
Code:
navigator.getGamepads()[0] //Gampad 1
navigator.getGamepads()[1] //Gampad 2
navigator.getGamepads()[2] //Gampad 3

I have two USB controllers here to test if I disconnect the first one to see if the second one will take control of the game, but I don't have time at the moment.
You're along the right lines, but the left stick axes are [0] and [1] and the right stick is axes[2] and axes[3].

The whole thing with the stick causing the directionals to activate is also built in to the gamepad update function. It sets the corresponding direction press to true if the axes are beyond the thresholds for that direction.
I tested in Firefox and Chrome with this:
JavaScript:
setInterval(function(){console.log("0: "+navigator.getGamepads()[0].axes[0]+"\n1: "+navigator.getGamepads()[0].axes[1]+"\n2: "+navigator.getGamepads()[0].axes[2]+"\n3: "+navigator.getGamepads()[0].axes[3])},800)

But only 0 and 1 returned results:
Code:
0: -0.0039215686274509665
1: -0.0039215686274509665
2: undefined
3: undefined
I tested in Firefox and Chrome with this:
JavaScript:
setInterval(function(){console.log("0: "+navigator.getGamepads()[0].axes[0]+"\n1: "+navigator.getGamepads()[0].axes[1]+"\n2: "+navigator.getGamepads()[0].axes[2]+"\n3: "+navigator.getGamepads()[0].axes[3])},800)

But only 0 and 1 returned results:
Code:
0: -0.0039215686274509665
1: -0.0039215686274509665
2: undefined
3: undefined
Maybe the gamepad you have connected has a different axis set to mine. I'm using a DualSense if that helps.
Spoiler
Sorry, you don't need to "quote" my entire post replicating the content, it gets confusing, you can drag the mouse and mark only the lines you want to comment on. As my answer was the only one above, I just had to respond.
(Don't think I'm being rude, that's not my first language...)

I really can't confirm about your control, possibly controls with more buttons work differently.
I use this site to test the controls:

To test visually I use this:

I'm using a DualSense if that helps.
Probably the correct thing to do is list:
JavaScript:
navigator.getGamepads()[0].axes.length
Sorry, you don't need to "quote" my entire post replicating the content, it gets confusing, you can drag the mouse and mark only the lines you want to comment on. As my answer was the only one above, I just had to respond.
I'm aware of this, but your entire post in that particular instance was what I was replying to. 😛
What about this one?
Thank you all for the help! Kinda made the post late at night and brain wasn't braining haha

I've changed core scripts a couple of times before but like I said its been a while so I'm a little rusty, but I ended up figuring it out with yall's help:

Code:
if(Math.abs(navigator.getGamepads()[0].axes[2])>Math.abs(navigator.getGamepads()[0].axes[3])){ //turn in X
    if(navigator.getGamepads()[0].axes[2] > 0.5) $gamePlayer.setDirection(6)
    else if(navigator.getGamepads()[0].axes[2] < -0.5) $gamePlayer.setDirection(4)
}else{ //turn in y
    if(navigator.getGamepads()[0].axes[3] > 0.5) $gamePlayer.setDirection(2)
    else if(navigator.getGamepads()[0].axes[3] < -0.5) $gamePlayer.setDirection(8)
}

Gonna probably work more on this to implement as part of the core code so its more easily customizable and whatnot, but thats for future me

Original thread: https://forums.rpgmakerweb.com/threads/how-to-detect-directional-stick-on-gamepad.165374/