1. Post #1
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts

    Download


    To find older versions, or to link to the project download, use this link:

    Project Link




    Pod linking to share contraptions with friends

    Playing around

    Easy-to-use with Wire





    Download



    Source code

    Description:
    A DirectInput interface and wire chip.
    Comes with configuration menu to ease developer integration.
    (Does not support mouse input yet. Sends data to server.)

    Features:[list][*] *NEW* Supports keyboard input[*] *NEW* Scan for newly attached devices mid-game[*] *NEW* .125 second faster Joystick Wire updates - now works as fast as Sandbox thrusters[*] *NEW* Two boolean inputs can be mapped to a single analog input[*]Automatically saves bindings[*]Wire integration chip that links to pods for bind sharing[*]Multi-input chip for Wire that supports 8 separate joystick bindings[*]Full networking at 10 Hz data rate with serializing[*]Both standalone clientside and networked bindings[*]Axis calibration[*]All DirectInput joystick outputs available:[list][*]8 Axes[*]32 Buttons[*]2 POV Hats[/list][*]Easy-to-integrate analog and digital bindings interface for the developer (No messing with axes, buttons, and hats!)[*]Click-and-drag interface[*]Categorized and tabbed configuration menu[*]Reverse compatibility with the old joystick module[/list]Future features:[list][*]Two button/hat position incremental analog bindings[/list]Warnings:[list][*]Calibration is not saved[/list]Binding support:[list][*]Full axis to analog binding[*]Half axis to analog binding[*]Button to analog binding[*]HAT position to analog binding[*]Button to digital binding[*]HAT position to digital binding[*]Full axis to digital binding with thresholds[*]Half axis to digital binding with thresholds[*] *NEW* Any combination of two buttons, hats, or keys to make an analog input[/list]Usage:
    Open the menus using the console command "joyconfig".

    To bind a control to a binding, click the desired control from the Device Menu then the desired binding from the Joystick Configuration menu.
    To invert an axis, check the box next to the readout in the Joystick Configuration menu.
    To adjust the minimum threshold for an axis to digital binding, click and drag on the readout in the Joystick Configuration menu.
    To unbind a control, click the binding in the Joystick Configuration menu.

    To link a Wire joystick input to a pod, use reload on the joystick input, then reload on the pod.

    Example:
    Change the first "true" in lua/autorun/client/joyexample.lua and lua/autorun/server/joyexample.lua to "false", then start Garry's Mod.

    Reply With Quote Edit / Delete Reply Show Events Useful x 32Lua King x 9Winner x 3Dumb x 3Artistic x 1Funny x 1 (list)

  2. Post #2
    Gold Member
    -SAH-'s Avatar
    July 2006
    342 Posts
    Oh god yes
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  3. Post #3
    Gold Member
    Hatsen's Avatar
    January 2006
    1,042 Posts
    USEFUL! :D
    Reply With Quote Edit / Delete Reply Denmark Show Events Agree Agree x 1 (list)

  4. Post #4
    Gold Member
    elevator13's Avatar
    December 2006
    2,486 Posts
    Holy moly. I hope you can make a version that sends data to the server soon :D

  5. Post #5

    June 2006
    7 Posts
    You just made my goal of the week to butcher a poor xbox controller and male usb connector with wirecutters. I hope you're happy :(

    Edit:

    Hope I can find one of the first style gamepads. Those big ol' bulcky tanks.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Funny Funny x 2 (list)

  6. Post #6
    CapsAdmin's Avatar
    August 2005
    3,971 Posts
    Very nice. I'm gonna see if I can find a MIDI to Joystick program so I can use my 64 knob synthesizer.

  7. Post #7
    Gold Member
    kimba23's Avatar
    May 2005
    29 Posts
    Hey, what does it mean that is reverse compatible with old joystick module? Does it mean one can use axis thrusters and wire axis input? Anyhow, great work, gold star for you! ;)

    Well I cannot get it to work. I am using a wiimote and I see it in the "device menu" as a ppjoy virtual joystick but I cannot set the "joystick configurator" So, do I leave the old mudule installed? The axis thruster? the axis wire? Help please. Thanks

  8. Post #8
    Gold Member
    LPine's Avatar
    April 2007
    260 Posts
    I want to rate you God but I can't find the button.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 2Funny Funny x 1 (list)

  9. Post #9
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Theoretically, the old axis thrusters should still work.

    In order to use the configurator, you must be using something that integrates with it. This could be a gamemode, addon, etc.
    There is, again, an example included that lets you see how binding is done.

    Perhaps I should make an axis input for wire?

  10. Post #10
    Gold Member
    kimba23's Avatar
    May 2005
    29 Posts
    Yes, an axis input for wire would be great; i will try to do the bindings from your example

    thanks

  11. Post #11
    Gold Member
    Treelor's Avatar
    February 2005
    2,072 Posts
    Oh dear.
    There's semen.
    EVERYWHERE.

    Look what you've done Night-Eagle.

    [spoiler]Not caring how old the thread is, certainly worth any length bump.[/spoiler]

    Damn epic job, bud.
    Reply With Quote Edit / Delete Reply Show Events Funny Funny x 1 (list)

  12. Post #12
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    New version released.

    Now with full serialized networking. All the inputs of an Xbox 360 controller can be sent in 10 bytes per poll.
    Currently, the client sends data to the server at a rate of up to 10 Hz. No updates are sent when there is no change in data. Latency is more noticeable than resolution, however.

    A chip for wire is included. All that is needed is a UID; the configuration panel lets the user take care of the rest easily.

    You can test the module on this server:
    steam://connect/69.162.110.93:27018

    I should have probably mentioned that UIDs may only consist of the following characters and may only be 20 characters long (17 for the Wire chip):
    Code:
    ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz,.<>?:[]{}\|1234567890-=!@#$%^&*()_+
    No spaces are accepted.

    Edit:

    Version 15 released.
    Fixed bugs with digital inputs and made some cosmetic changes.
    Unregistering of bindings is now supported and exploited.
    Maximum and minimum values are now adjustable.

  13. Post #13
    2598matt's Avatar
    June 2008
    12 Posts
    Hey just wandering, will it work with a PS3 controller?

  14. Post #14
    Gold Member
    Airdoo's Avatar
    April 2007
    509 Posts
    Please make the save function the next feature to work on.

  15. Post #15
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Well shit, its already on the top of the list. Couldn't really implement a save system without the backbone behind it.
    2598matt posted:
    Hey just wandering, will it work with a PS3 controller?
    Any controller for the PC that has a DirectInput driver - pretty much every PC controller ever made. There is a DInput hack for the PS3 controller.
    Reply With Quote Edit / Delete Reply Show Events Agree Agree x 1 (list)

  16. Post #16
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Version 16 Binary 1.1 released.
    This version adds a save feature.

    All saves are made by the GUID of the controller and the UID of the bind.
    Inactive but bounded binds carry through games and save as well. Here is an example data file:
    Code:
    GUID Guide
    	{123456789-12345-1234-123:1:12:12:12:12:1:1} = Microsoft Xbox 360 Wireless Controller
    Binding List (Lower entries override higher entries)
    [START]
    jm_a
    	GUID={123456789-12345-1234-123:1:12:12:12:12:1:1}
    	TYPE=analog
    	type=str:axis
    	index=num:0
    	axismod=num:0
    jm_s
    	GUID={123456789-12345-1234-123:1:12:12:12:12:1:1}
    	TYPE=analog
    	type=str:axis
    	index=num:1
    	axismod=num:2
    	invert=boo:false
    [END]
    This means that the order of your devices does not mess up the binds. It does mean, however, that a UID can only be saved to a single device. The GUID guide is included for manual user editing, and is not used by the parser.
    Unregistered binds are cached as well - if you undo a Joystick chip and replace it, your bind will carry over. If you never replace it, the bind will saved from the cache.

    Edit:

    Version 18 Binary 1.1 released.
    Various bugs have been fixed.

  17. Post #17
    Gold Member
    Airdoo's Avatar
    April 2007
    509 Posts
    I'm still getting this error with the newest version, v.18 bin V1.1.

    Code:
    weapons\gmod_tool\stools/wire_joystick.lua:255: attempt to call field 'getRegisterByUID' (a nil value)

  18. Post #18
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    I am unable to reproduce that error. Try to get the error in singleplayer/on a listenserver and do
    Code:
    lua_run_cl PrintTable(jcon)
    Are you sure you're not getting an error before that one?

  19. Post #19
    Gold Member
    Airdoo's Avatar
    April 2007
    509 Posts
    Ok now it is spamming the console with this:

  20. Post #20
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    You have a conflicting addon installed.
    If you have a version of my joystick module released by LIghtDemon, you need to uninstall it.

    You can delete that wall of text if you'd like, now.

  21. Post #21
    Gold Member
    Airdoo's Avatar
    April 2007
    509 Posts
    Wait I think I may have found it, Space Build Model pack has the gmcl_joystick.dll in it. Could I have found it?

    EDIT: I erased all traces of a joystick for my gmod folder and it didn't work in Single Player, error on line 255, but then I joined your server and it works, confusing is it not?

    Also was looking through the code of the offending file and I realized where is this,
    Code:
    reg.IsJoystickReg
    declared?

  22. Post #22
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    It is defined in joyconfig.lua.
    If you want to batch search the contents of your scripts, do this:
    Download AutoHotkey
    Run this AHK file from the garrysmod/garrysmod directory:
    Code:
    Gui, Add, Edit, Default vtofind x6 y0 w370 h20 ,Search
    Gui, Add, ListView, x6 y30 w460 h340 , ListView
    Gui, Add, Button, Default gSearch x376 y0 w90 h20 , Search
    
    Gui, Show, x131 y91 h378 w473, New GUI Window
    Return
    
    GuiClose:
    ExitApp
    
    Search:
    	GuiControlGet, tofind
    	LV_Delete()
    	Loop, *.lua, 0, 1
    	{
    		found = false
    		Loop, Read, %A_LoopFileFullPath%
    		{
    			if found = false
    			{
    				if InStr(A_LoopReadLine,tofind,0)
    				{
    					LV_Add("",A_LoopFileFullPath)
    					found = true
    				}
    			}
    		}
    	}
    return
    I would search for "joystick." and "jcon.". If it isn't in addons/joystick, see if it looks like a near duplicate file - if it is, delete it.

    This is definitely a conflict with an errant script.

  23. Post #23
    OlivierHamel's Avatar
    April 2008
    220 Posts
    I'll have to update the SVN for wiremod... One sec.

    Edit:

    Bug report: All registration entries seem to HAVE to be network, which seems pointless. That and the fact that it's getting all pissy because it's trying to network everything and my old numpad controller script didn't specify UIDs for everything (hooks dying, which is causing a chained failure in the system).

  24. Post #24
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Yeah, I don't have a net request for bindings yet.
    As for UIDs, UIDs are used for saving and networking; there is a purpose for them if the bind is clientside in saving and loading binds.
    Also, scripts don't get pissy. Developers do.

    There shouldn't be a problem with networking unless you have around 250 analog binds or 1500 digital binds or a proportional combination of both.

    I don't see a point in a hard-coded registry without a UID - that simply means that the user must rebind it every time they play. I will make the server send a list of needed binds, though.

  25. Post #25
    OlivierHamel's Avatar
    April 2008
    220 Posts
    The reason I'm avoiding your UID networking feature is that I don't want to have to add the serverside code to the SBMP & relatives, I'm already managing my own networking (which isn't totally optimal but it's not bad, and it's independent).

    As for graceful handling, a random this-session-only UID should be allocated if a bind without one is added. Just graceful error handling.

    I said wiremod. :blah: Got to do that too perhaps but I was meaning SBMP.

    (Goes off to add a loopz to his SENTs.)

    Edit:

    What if we DON'T want it to save the configs?

    Edit:

    Personally I've used the 'v.uid = v.category .. "_" .. v.description' as a default UID if none is provided, seems to work ok...

    Edit:

    'joyconfig.lua: 1143: 'joynet.update()'' Causes error on startup of CL Lua. This in turn causes:
    'Timer Error: autorun\client\joynet.lua:24: bad argument #1 to 'pairs' (table expected, got nil)'

  26. Post #26
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    You don't need to add serverside code at any point - the joystick module can be used 100% clientside, although it is currently assumed that "ja" is a valid console command.
    Careful, because the maximum UID length is 20 characters.

    As for that error on 1143, did you manually load any script? Are you using any unorthodox or strange methods in interfacing with the module? The only way that should happen is if the script failed and the user tried to re-load a script.

  27. Post #27
    OlivierHamel's Avatar
    April 2008
    220 Posts
    The 20 char thing might be it, but I haven't done anything hackzy, I've been a good citizen:
    I've reported all the rebels in my section for an extra ration.
    I've followed your hooker instructions.
    I've filled in all the boxes in the form (the fields in the tables).

    Edit:

    Code:
    Joystick module loaded!
    1.0 Night-Eagle
    Night-Eagle's joystick module loaded.
    Script version 1.1.
    Binary version 1.1.
    Night-Eagle's joystick configurator loaded.
    Version 1.
    Night-Eagle's joystick module loaded.
    Script version 1.
    Binary version 1.1.
    autorun\client\joyconfig.lua:1143: attempt to index global 'joynet' (a nil value)
    Night-Eagle's joystick configurator loaded.
    Version 1.2.
    
    <LATER ON>
    
    
    Timer Error: autorun\client\joynet.lua:24: bad argument #1 to 'pairs' (table expected, got nil)
    
    Redownloading all lightmaps
    R_RedownloadAllLightmaps took 3.166 msec!
    Finished! 57 achievements loaded!
    hooking into LS RD1 system...
    hooking into LS RD1 system...
    <DONE INIT.>
    :confused:

  28. Post #28
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    The sequence of characters "1.2" occurs a total number of 0 times in my officially released scripts.
    You have conflicting scripts/addons installed.

  29. Post #29

    November 2008
    1 Posts
    Hey, i just downloaded Joystick mod and i cant seem to get it working. I installed it like you said, but I get this error:
    Timer Error: autorun\client\joyconfig.lua:2376: PEBCAK error. RTFM or slap developer around with a large trout.
    uid is not a string
    Have a nice day.

    Is this fixable? or am I being an idiot?

    Thanks in advance.

  30. Post #30
    Urablahblah's Avatar
    March 2008
    6 Posts
    So correct me if I'm wrong, but you have to have one chip per one control? (axis, button) That seems very inefficient to me but I may just be stupid and can't figure out how to get more than one.

  31. Post #31
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Urablahblah posted:
    inefficient
    If we wanted efficiency, we would have abandoned STOOLs for Wire all together.

  32. Post #32
    F12Bwth's Avatar
    March 2006
    609 Posts
    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.

    http://silver-rose-studios.com/zeos/uber/gmtut16.htm

    Here.. My crane uses ONLY my MoMo wheel, its 3 axis and all 10 buttons.

    http://video.google.com/videoplay?docid=-410456491592564699
    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

    Timer Error: autorun\client\joynet.lua:24: bad argument #1 to 'pairs' (table expected, got nil)

    and then when I spawn a joystick controller I get spammed with

    weapons\gmod_tool\stools/wire_joystick.lua:255: attempt to call field 'getRegisterByUID' (a nil value)

    ... 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.

  33. Post #33
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    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.

  34. Post #34
    Infectious's Avatar
    October 2007
    52 Posts
    Hi-speed version? :D Yes? No? Probably not? If so, damn. :/

  35. Post #35
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Better than hi-speed:

    LuaChip now supports Joystick module.

    Example code (Upload to a pod chair, link it to a couple Wire displays, and enter it to use):
    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)
    
    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)

  36. Post #36
    Infectious's Avatar
    October 2007
    52 Posts
    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.

  37. Post #37
    dbT
    dbT's Avatar
    August 2007
    11 Posts
    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?

  38. Post #38
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    Infectious posted:
    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.
    I didn't see this ninja before.

    That is how the script currently works.

    Edit:

    dbT posted:
    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?
    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.

    Edit:

    Infectious posted:
    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?
    I made this script to be as developer-friendly as possible. All he needs to know to implement Joystick Module is exemplified here.

    I'll PM him. I'm still a bit doubtful as to whether this is within the scope of Expression Gate 2.

  39. Post #39
    Gold Member
    evan_madore's Avatar
    December 2006
    265 Posts
    Are we going to see any updates on this? Awesome tool, just a few things need to be worked out I think.

  40. Post #40
    Gold Member
    Night-Eagle's Avatar
    January 2005
    815 Posts
    What would you like me to change?