I made some functions for setting custom controls in the new Super Mod that may help for this as well.
function GetButtonPressed()
for c = 0,1 do -- Only check controller 1 & 2 (raise the 1 if you want to check more)
for b = 0,15 do -- Check buttons 0 to 15
if IsButtonPressed(b,c) then
return b,c
end
end
end
return -1,-1 -- If there was no values returned by the end of the function, return -1 for no button on no controller
end
function GetButtonBeingPressed()
for c = 0,1 do -- Only check controller 1 & 2 (raise the 1 if you want to check more)
for b = 0,15 do -- Check buttons 0 to 15
if IsButtonBeingPressed(b,c) then
return b,c
end
end
end
return -1,-1 -- If there was no values returned by the end of the function, return -1 for no button on no controller
end
function GetButtonBeingReleased()
for c = 0,1 do -- Only check controller 1 & 2 (raise the 1 if you want to check more)
for b = 0,15 do -- Check buttons 0 to 15
if IsButtonBeingReleased(b,c) then
return b,c
end
end
end
return -1,-1 -- If there was no values returned by the end of the function, return -1 for no button on no controller
end
It returns 2 values, the button pressed/released, and on what controller.
Example...
attackButton,attackController = GetButtonBeingPressed()