Jump to content

Just full of weird questions. Multiple controller port recognition?


Recommended Posts

Sooo

I'm not even sure if this sort of thing is even possible.

 

But is it possible to have the game distinguish inputs from two different controllers?... 

If there are two controlers plugged in at the same time, does it recognize the different ports? Would it be possible to set it up to do so? Or is it impossible?

 

I see something in input.lua about  Input:GetControllerID()    But I don't know if it's able to distinguish anything more than just if a controller is plugged in or not.

Link to comment
Share on other sites

This sounds like science. I like science.

 

Did you try to print() the output of that function?

 

FOR SCIENCE

 

oh boy, yep! It looks like it does. I don't have 4 controllers, but it looks like it might even be able to support up to 4! (I would question why they bothered adding multiple controller support for a game like this but whatever)

 

Okay, so how would I go about binding a controler key to something. Besides just reconfiguring it in the options menu.

 

I mean, Input:IsControlPressed(control) is probably the way to go, but what are the control keys defined as?

 

That one old problem with the keybinding to numpad_2 was fixed by using they key's number value in strings.lua. But none of the controller buttons have number values assigned to them, so I have no idea how to identify them.

 

Is there a way to print out the name of a button pressed? the OnControl() function doesn't actually return anything, so I don't know how I would get the name of the button pressed.

 

 

Aslo; here, maybe someone smarter than me might know what this is. This looks important.

function Input:GetLocalizedControl(deviceId, controlId, use_default_mapping)        if nil == use_default_mapping then        -- default mapping not specified so don't use it        use_default_mapping = false    end        local device, numInputs, input1, input2, input3, input4, intParam = TheInputProxy:GetLocalizedControl(deviceId, controlId, use_default_mapping)    local inputs = {        [1] = input1,        [2] = input2,        [3] = input3,        [4] = input4,    }    local text = ""    if nil == device then        text = STRINGS.UI.CONTROLSSCREEN.INPUTS[6][1]    else        -- concatenate the inputs        for idx = 1, numInputs do            local inputId = inputs[idx]            text = text .. STRINGS.UI.CONTROLSSCREEN.INPUTS[device][inputs[idx]]            if idx < numInputs then                text = text .. " + "            end        end                -- process string format params if there are any        if not (nil == intParam) then            text = string.format(text, intParam)        end    end    --print ("Input Text:" .. tostring(text))    return text;end

It's from input.lua

 

I'm pretty sure that  STRINGS.UI.CONTROLSSCREEN.INPUTS[6][1]   refers to the 6 different types of inputs. (keyboard/mouse being [1](of 6), and then theres like 4 different types of controllers, and a touchpad input. 

For example; GLOBAL.STRINGS.UI.CONTROLSSCREEN.INPUTS[1][258]  is how I was able to reference the numpad 2 key, even though it isn't defined in constants.lua with all the other keys.

 

I assume the [inputs] refers to the key number (which only the keyboard and mouse were assigned) but I have no idea what [idx] is

Link to comment
Share on other sites

That function just returns a string of the controller inputs. Idx is the index number (just a number assigned to a controller to keep track of it). As for working out the press pressed in OnControlled, put a print statement in there yourself :p The base game files can be altered after all. Just be aware that if a RoG file overwrites a base game file, and you have RoG active for the world your playing in, you'll need to edit the RoG one instead.

Link to comment
Share on other sites

Just be aware that if a RoG file overwrites a base game file, and you have RoG active for the world your playing in, you'll need to edit the RoG one instead.

 

oooohhh, so thats why nothing was printing from input.lua. I didn't know RoG even changed anything from there.

 

So I would just put my version of input.lua inside a DLC00001 (or whatever that file was called) folder in my mod files, just like it is in the game files?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...