Controller reporting incorrectly

I'm running the gamepad_is_supported(); function. It reports true when no controller is connected. How does it know? This makes no sense to me.
 

O.Stogden

Member
Gamepad_is_supported is to check whether the platform you're on (windows, Ubuntu, HTML5 etc.) supports gamepads.

Gamepad_is_connected is to check if a gamepad is connected.
 

O.Stogden

Member
I believe some web browsers don't support gamepads via HTML5. The manual mentions that Apple's Safari browser doesn't.

I don't know whether gamepad_is_supported could tell what browser you are on or not though.
 
Thanks. I don't think this will be a problem as I know what platforms I'm targeting.

I'm getting issues with the is connected function now. When I first started messing with this morning it was reporting correctly. Now it says the controller is not connected but it's still happy to take input.
 
OK

GML:
for (var i = 0; i < 12; ++i)
{
    show_debug_message(gamepad_is_connected(i));
}
It's zeros all the way down. Yet the controller does work with Gamemaker.

Edit: Separate note, when you post code on the forum the syntax highlighting is different to the Gamemaker defaults and seems to change from day today?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Use the ASYNC SYSTEM event to detect your connected controllers. GM can assign controller IDs higher than 11 so the async event is a more reliable system for detecting them.
 
OK, I think that's the answer I need, thank you.

Edit: That solved the problem thanks. (On further inspection putting this code under any event with step-like qualities works just the same). It doesn't work well under the creation event. Don't know if this would be useful information for the manual.
 
Last edited:

kburkhart84

Firehammer Games
Use the ASYNC SYSTEM event to detect your connected controllers. GM can assign controller IDs higher than 11 so the async event is a more reliable system for detecting them.
The documentation(not that you care anymore :) ) says the devices are 0 - 11, with 0 - 3 being XInput and the rest being DInput. On Windows I've never had that not be the case. However, another user pointed out to me that on mobile it completely skips 0 and starts with 1, and another mentioned that on Linux it seems to start at 20....not very consistent.
 
I thought it only went up to 12. Slightly, but only slightly a segway. I had a piece of code that says if you scroll the mouse this way or that way there is a limit and it will cap at that. Try it on a laptop see what happens. I am hitting some serious limitations.
 
Top