• gmcl_joystick - DirectInput module with simplified interface
    316 replies, posted
  • Avatar of Night-Eagle
  • [QUOTE=Urablahblah]inefficient[/QUOTE] If we wanted efficiency, we would have abandoned STOOLs for Wire all together.
  • Avatar of F12Bwth
  • Best addon in a LONG while. Use it almost exclusively. I even did a tutorial for the old one that is now useless. I also had never noticed the Invert button next to the axis, Oh well the conversion for use in Hydraulic steering is still relevant. [url]http://silver-rose-studios.com/zeos/uber/gmtut16.htm[/url] Here.. My crane uses ONLY my MoMo wheel, its 3 axis and all 10 buttons. [media]http://video.google.com/videoplay?docid=-410456491592564699[/media] EDIT: Jesus, Why is it so hard to get this thing working. I extract the zip to garrysmod/garrysmod That puts the DLL into \lua\includes\modules and makes the "joystick" Folder in the main garrysmod folder itself... Is this correct? It has an Info.txt file in it which makes me think it belongs in addons. Any configuration of that joystick folder in addons or the main dir get me this error in singleplayer on initial load [B]Timer Error: autorun\client\joynet.lua:24: bad argument #1 to 'pairs' (table expected, got nil)[/B] and then when I spawn a joystick controller I get spammed with [B]weapons\gmod_tool\stools/wire_joystick.lua:255: attempt to call field 'getRegisterByUID' (a nil value)[/B] ... I am just a tad confused to the use of this new system also. Do I actually need a separate controller for each axis and button? If I do it seems a bit ridiculous. Whole reason I use Joystick mod is it is just one entity controlling everything through an conversion expression. Someone that knows how to install this please post.. also I installed this on the TT.com dedicated servers and It downloads 7 client Lua Files over and over and over every time you join the server. And then it doesn't work in there. So any tips on adding what of this to the server as I presume the client stuff isn't needed.
  • Avatar of Night-Eagle
  • Hurrah, it only took 180 downloads for someone to find something wrong. The Joystick folder goes in addons. The whole "no binaries in addons" shit always throws me off. After that, just make sure you have all other joystick modules removed. That error on line 255 can only be caused by installing a third-party addon. A multi-input is WKIP. An input in my fashion is harder because I allow inputs to be shared between players - this calls for custom UIDs. LuaChip will solve the whole mass-amount of input entities though. I think you will like the convenience of setting minimums and maximums, though.
  • Avatar of Night-Eagle
  • Better than hi-speed: [img]http://img401.imageshack.us/img401/7634/luachipjoystickau6.jpg[/img] LuaChip now supports Joystick module. Example code (Upload to a pod chair, link it to a couple Wire displays, and enter it to use): [lua] a = joystick.register("TestA","analog") b = joystick.register("TestB","analog") c = joystick.register("TestC","analog") d = joystick.register("TestD","analog") scro = requestEnt("screen1") scrt = requestEnt("screen2") hook.Add("Think","think",function() local scre = scro:Get() if scre then scre:WireTriggerInput("A",a:Get()) scre:WireTriggerInput("B",b:Get()) end local scre = scrt:Get() if scre then scre:WireTriggerInput("A",c:Get()) scre:WireTriggerInput("B",d:Get()) end end) [/lua] I could make a simple Wire Joystick gate with multiple inputs via LuaChip as well. I could dump the data to a merger, but I can't find an identity gate which just reports multiple inputs. Or, you could just trigger the inputs of a Wire hydraulic, wheel, etc. directly. Syntax: [code] joystick.register(strUID,strType <optional>,strDescription <optional>,numMin <optional>,numMax <optional>,numDefault <optional>) returns tabReg strUID = A unique string 20 minus <length of your SteamID> minus 1 characters long strType = "analog" or "digital", defaults to "analog" strDescription = Defaults to strUID, a description of this input numMin = The minimum value reported (default 0) numMax = The maximum value reported (default 255) numDefault = The value reported when the player has not bound a control (default numMin) tabReg:Get(boolNopod <optional>) returns numValue boolNopod = false if the input is retrieved from the player in the pod, true if input is only retrieved from the uploader of the code (default false) [/code]
  • Avatar of Infectious
  • Well...I don't really know LUA. But I do know Assembly. Maybe I can write an LUAChip, that writes the joystick outputs to hi-speed addresses, and get what I want. Or...hmm...Syranide explained that with the way ExpressionChip2 works, people can easily add modular code to it, including, in an example he gave, joystick inputs (or outputs, for Force Feedback). Since you're the one who worked on this, perhaps it could be something on the to-do list? As far as pod-linking goes you could perhaps code it to read the joysticks off of a specific entity rather than the owner, then one could simply select the entity of the pod itself.
  • Avatar of dbT
  • Eh, having problems with this. As I understand the config is drag n' drop? Well, I can't drag. When I hold at something it just shows up in a small dark, see-through box hovering by my mouse that says what I just selected ("Button 3" for instance). Any ideas?
  • Avatar of Night-Eagle
  • [QUOTE=Infectious]As far as pod-linking goes you could perhaps code it to read the joysticks off of a specific entity rather than the owner, then one could simply select the entity of the pod itself.[/QUOTE] I didn't see this ninja before. That is how the script currently works. :v: [b]Edit:[/b] [QUOTE=dbT]Eh, having problems with this. As I understand the config is drag n' drop? Well, I can't drag. When I hold at something it just shows up in a small dark, see-through box hovering by my mouse that says what I just selected ("Button 3" for instance). Any ideas?[/QUOTE] You can click the source and then click the destination if you don't like to click and drag. That see-through box just tells you that you have a control that you can bind to an input - just click on an input. You need to have made an input first. [b]Edit:[/b] [QUOTE=Infectious]Or...hmm...Syranide explained that with the way ExpressionChip2 works, people can easily add modular code to it, including, in an example he gave, joystick inputs (or outputs, for Force Feedback). Since you're the one who worked on this, perhaps it could be something on the to-do list?[/QUOTE] I made this script to be as developer-friendly as possible. All he needs to know to implement Joystick Module is exemplified [url=http://luachip.googlecode.com/svn/trunk/lua/luachip/libraries/joystick.lua]here[/url]. I'll PM him. I'm still a bit doubtful as to whether this is within the scope of Expression Gate 2.
  • Avatar of evan_madore
  • Are we going to see any updates on this? Awesome tool, just a few things need to be worked out I think.
  • Avatar of F12Bwth
  • [QUOTE=Night-Eagle]What would you like me to change?[/QUOTE] Well it isn't TOTALLY horrible that each axis and button has to be on a separate spawned controller but it still sucks if you use 3 axis and 10 buttons. If you do decide to make it an OPTION for all in one spawn you can have it save presets so you can choose (Basic Car, Plane Controls, etc) Just a note to everyone complaining that this addon seems slow. If you are using hydraulics this can be "fixed" at least temporarily. You see Hydraulics are just Elastics that can get longer or shorter. But their Constant and Dampening are determined by the weight of the props you apply the hydro to. High Constant is good but High dampening slows the hydraulic length change down alot. Our Coder at TrickysTutorials.com has written up a tool that can adjust the Constant and Dampening of existing Hydraulics by hovering over the controller to see what it is currently then you can apply whatever settings you like. Keeping the dampening under 3000 allows for a very responsive Hydro. Our custom stools however are not out for public use and can only be used on a TT.com servers [url]http://trickystutorials.com/index.php?act=announce&f=15&id=12[/url] . The adjustments also will not save in a dup due to the way A-Dup is coded. You have to edit every hydro every time.
  • Avatar of Infectious
  • [QUOTE=Night-Eagle]What would you like me to change?[/QUOTE] Basically, what F12 said above, that there needs to be a separate ent for each axis and button. When you're trying to map a whole HOTAS setup for use in a tiny little SBMP cockpit it gets ridiculous. Also, I've been looking through your code, figuring out how to add this stuff with LUA. For one, it's fairly complex...but it seems like there is no way to simply, directly, ask for somebody's (e.g.,) X-Axis? You have to create an entry in a table and then configure it in the joyconfig menu? It makes sense if you're coding whole vehicles and you want to re-map functions but needlessly complex if you're trying to write an ent that deals with 6 axes and 26 buttons and you want a certain value to ALWAYS be an x-axis and have no use for it to ever be anything else.
  • Avatar of Project 41
  • I am SO CONFUSED THE server I am playing on has the tool already installed, but when I go to configure my joystick it says Unknown command: joyconfig I am sure my joystick is working can someone tell me what I am doing wrong?
  • Avatar of Infectious
  • Also, possibility, I dunno how related it is to the DirectInput and XInput system, but...Rumble/Force Feedback support? Eh? Good idea? Wire inputs for them; I believe XInput has separate vertical and horizontal controls, dunno about standard Force Feedback.
  • Avatar of Night-Eagle
  • I've tried working on force feedback before, but I'll try again. I'm not sure about XInput, though, it is mostly catered to one device. The last thing I was actively working on was keyboard support. The multi-joystick Wire SENT is complete; it just needs to undergo some testing. It can handle up to 8 inputs. Also: Both the server and client must install this module for it to work. The server cannot send binary modules to the client. The only way to fix this would be to have this module officially supported.
  • Avatar of PwnedYoAss
  • My question is what does the scaling do? Because from what I can tell it doesn't make things go faster.
  • Avatar of Night-Eagle
  • You're talking about the axis calibration menu? There are two ways to calibrate an axis: -Setting the minimum and maximum -Setting the center and the scale If you set the minimum and maximum, the center and scale are calculated from those values. If you set the center and scale, the minimum and maximum are calculated from those values. So, if you wanted to make a deadzone at the extremes of an axis, reduce scale to .95 and press the set button to the right of the entry. ...or was it increase the scale to 1.05? Hmm, I forget. It is easy enough to figure out, however, because of the real-time readouts.
  • Avatar of fishface60
  • There's a problem with the Joystick's wire input when it's set to digital. It outputs "0" and "1" instead of 0 and 1, which makes them useless as the inputs don't take strings.
  • Avatar of Night-Eagle
  • Version 22 is now out. -User inputs are now sanitized more carefully (fixes fishface's above issue, prevents advanced duplicator tampering) -Wire Joystick Multi chip added (Supports up to 8 inputs) -Added custom server tags with version number -Added example car
  • Avatar of F12Bwth
  • [QUOTE=Night-Eagle]Version 22 is now out. -User inputs are now sanitized more carefully (fixes fishface's above issue, prevents advanced duplicator tampering) -Wire Joystick Multi chip added (Supports up to 8 inputs) -Added custom server tags with version number -Added example car[/QUOTE] Excellent. I will update all my servers tonight. ---------------- Listening to: [url=http://www.foxytunes.com/artist/henry+rollins+band/track/rejection]Henry Rollins Band - Rejection[/url] via [url=http://www.foxytunes.com/signatunes/]FoxyTunes[/url]
  • Avatar of fishface60
  • Is there any way to reorder joystick controls, right now it's a bit of a mess. [IMG]http://img401.imageshack.us/img401/8/joyconfigrg6.png[/IMG] This is the code I used. [lua]local LTransjcon = {} local LTransJoystickControl = function() --Joystick control stuff LTransjcon.pitch = jcon.register{ uid = "ltrans_pitch", type = "analog", description = "Pitch", category = "Large Transport", } LTransjcon.yaw = jcon.register{ uid = "ltrans_yaw", type = "analog", description = "Yaw", category = "Large Transport", } LTransjcon.roll = jcon.register{ uid = "ltrans_roll", type = "analog", description = "Roll", category = "Large Transport", } LTransjcon.thrust = jcon.register{ uid = "ltrans_thrust", type = "analog", description = "Thrust", category = "Large Transport", } LTransjcon.accelerate = jcon.register{ uid = "ltrans_accelerate", type = "analog", description = "Accelerate/Decelerate", category = "Large Transport", } LTransjcon.up = jcon.register{ uid = "ltrans_strafe_up", type = "digital", description = "Strafe Up", category = "Large Transport", } LTransjcon.down = jcon.register{ uid = "ltrans_strafe_down", type = "digital", description = "Strafe Down", category = "Large Transport", } LTransjcon.right = jcon.register{ uid = "ltrans_strafe_right", type = "digital", description = "Strafe Right", category = "Large Transport", } LTransjcon.left = jcon.register{ uid = "ltrans_strafe_left", type = "digital", description = "Strafe Left", category = "Large Transport", } LTransjcon.launch = jcon.register{ uid = "ltrans_launch", type = "digital", description = "Launch", category = "Large Transport", } LTransjcon.switch = jcon.register{ uid = "ltrans_switch", type = "digital", description = "Yaw/Roll Switch", category = "Large Transport", } LTransjcon.fire1 = jcon.register{ uid = "ltrans_fire1", type = "digital", description = "Fire 1", category = "Large Transport", } LTransjcon.fire2 = jcon.register{ uid = "ltrans_fire2", type = "digital", description = "Fire 2", category = "Large Transport", } end hook.Add("JoystickInitialize","LTransJoystickControl",LTransJoystickControl)[/lua]
  • Avatar of Night-Eagle
  • Well, all the entries are in a subtable of jcon.reg.cat - so you could sort them as part of a custom script. Just run this check before you execute a custom script: [lua] local a = joystick if not type(a) == "table" then return end a = tonumber(a.binaryversion) if not a then return end if a > 1.1 then return end [/lua] I will sort entries by description when the next binary update is made (1.2). Note to self: Allow renaming of devices by GUID.
  • Avatar of chicob
  • I NEED HELP i get exec: couldn't exec userconfig.cfg Host_WriteConfiguration: Wrote cfg/config.cfg when i try to activate my 360 controller and i it is installed and when i press device menu all i get is No joysticks detected. in counsle nothing pops up please help
  • Avatar of evan_madore
  • Night Eagle, I was wondering if you could make the areas where you enter in the Min&Max Value in the joystick-multi larger. You can only see three digits out on those values and that gets kind of confusing when you work with numbers like 3420000. It would be a very helpful little change. Edit: Also, is there a way to make it update the controllers? Say i have nothing plugged in, then I plug in my steering wheel, can you make the steering wheel show up? It is a pain to exit game and rejoin if you forget to plug it in.
  • Avatar of Night-Eagle
  • I need to update the binary for that functionality, so 1.2. chicob: Rename your addons folder and reinstall the module. If this works, you have a conflicting addon. Note that your controller must be plugged in before you join/create a game. Better yet, rename your garrysmod folder and start fresh if you want to be sure. This is all I can say with the information provided.
  • Avatar of rieda1589
  • Is it possible to get a version which updates faster? The toolgun's speed is ok but the actual output is much slower which tends to make whatever you are controlling jumpy.
  • Avatar of chicob
  • ha ha ha lol im not renaming my garrysmod folder again jsut to find out that a mod like Assmod is not leting me use my game corectly so i just got xpadder and teh wireless reciever
  • Avatar of Night-Eagle
  • [QUOTE=rieda1589;13270648]Is it possible to get a version which updates faster? The toolgun's speed is ok but the actual output is much slower which tends to make whatever you are controlling jumpy.[/QUOTE] This is a limitation made by Garry's Mod. If you're talking about resolution, the module sends 10 times per second. However, the latency is so great that it takes a significant amount of time for the server to respond. The only solution would require networking without the use of console commands. Garry is opposed to this, however, because