memento10 Posted July 17, 2010 Share Posted July 17, 2010 Can anyone tell me if it's possible to use Sioc to send joystick commands, or keypresses to DCS. I created this targeting panel but not having luck getting it to communicate. I run Sioc on a 2nd computer... I found code that would work if it's running on the same PC by sending keystrokes but won't work from a remote PC. I'd rather not buy a Keyboard Emulator if I don't have to. Any Suggestions? Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 17, 2010 Share Posted July 17, 2010 common problem on network with SIOC I can't confirm neither negate the fact SIOC may work on network or has to be on the main PC. I think it should be on main PC but I'm not sure. Other bugs : check network check ports in lua files and sioc ini and config order of launch of softwares is important, but I can't tell you what is the good one version of touchpal software import [ if you use it ] , then see Oakes thread for details and comments about merging SIOC touhpal and BSVP if you speek french, I know a user who made a pit with SIOC and BSVP and on network, (but I can't confirm SIOC is on main or not) ; he did it, but he reads and speaks very very bad english langage... it will be difficult to communicate with him directly and many people is in holidays at this time Link to comment Share on other sites More sharing options...
memento10 Posted July 17, 2010 Author Share Posted July 17, 2010 Thanks for your quick reply Hellfrog. I actually do have Sioc, Touchpal, BSVP all working and running on a client PC but my problem here is sending these particuliar commands: Shkval Slew left, right, up down, center. Track Lock/Unlock Target Gate Size Zoom There's just not these commands in Clickabledata.lua So I'm guessing the only way is to send key press commands...? Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 20, 2010 Share Posted July 20, 2010 if you find an other way, you will certainly gain many reputation points on the forum !!! lOl this is the problem with all commands not assigned in clikabledata.lua I just think there is another option, but I can't test it at this time : use a directX entry and assign that in BS directly, as for a HOTAS button... that mean you need an interface card to emulate DirectX output to PC, but that should work... interest / keyboard emulation ? I don't know ... unless you have many usb sticks from garbage to recycle ... Link to comment Share on other sites More sharing options...
brydling Posted July 20, 2010 Share Posted July 20, 2010 SIOC cannot generate keystrokes on another PC than the one it is running on. I am not familiar with the way SIOC interfaces with BS, but I guess it's a LUA-script that is talking to SIOC with the protocol IOCP? LUA is a powerful language. It may be possible to generate a keystroke in a LUA-script. Digital-to-Synchro converter for interfacing real aircraft instruments - Thread Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13 www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen. Link to comment Share on other sites More sharing options...
y2kiah Posted July 20, 2010 Share Posted July 20, 2010 Lua will be running within the context of the DCS sim anyway, so it's pointless to have Lua send a keystroke to the OS, to then be handled by DCS. You might as well use the provided APIs to send the command directly. I would be very very surprised if this wasn't somehow possible. Even if ED doesn't publish it in the clickabledata.lua file, there are many other lua files that you can browse through to see if something looks promising. You can also try dumping the metatables to a file to check out all of the functions made available. Sure those particular commands may not be clickable from the virtual cockpit, but shouldn't all sim commands be exposed to Lua in some way? I'll look into this at home when I get a chance, I'm now curious too... SIOC can't generate a remote keystroke, but does SIOC at least generate a TCP message that the virtual keystroke occurred? If so, whatever listening software on the sim computer (in this case export.lua script probably) can listen for those messages and respond with custom code as described above. Link to comment Share on other sites More sharing options...
brydling Posted July 20, 2010 Share Posted July 20, 2010 (edited) SIOC can't generate a remote keystroke, but does SIOC at least generate a TCP message that the virtual keystroke occurred? If SIOC communicates with a LUA-script over IOCP, it doesn't generate a message about a virtual keystroke. How do you set up SIOC to talk to BS? Does IOCP sound familiar? I know that with MS Flight Simulator you can have a module in SIOC which talks to FSUIPC. In that case it isn't IOCP. However I don't know if such modules are user-creatable, so that one exists for BS. If they aren't, then BS probably takes the IOCP-way. IOCP is a very simple protocol that sends the values of the SIOC-variables whenever they change. Not even the name of the variable, only the number. Edited July 20, 2010 by brydling Digital-to-Synchro converter for interfacing real aircraft instruments - Thread Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13 www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen. Link to comment Share on other sites More sharing options...
y2kiah Posted July 20, 2010 Share Posted July 20, 2010 If SIOC communicates with a LUA-script over IOCP, it doesn't generate a message about a virtual keystroke. How do you set up SIOC to talk to BS? Does IOCP sound familiar? I know that with MS Flight Simulator you can have a module in SIOC which talks to FSUIPC. In that case it isn't IOCP. However I don't know if such modules are user-creatable, so that one exists for BS. If they aren't, then BS probably takes the IOCP-way. IOCP is a very simple protocol that sends the values of the SIOC-variables whenever they change. Not even the name of the variable, only the number. I think that because FSUIPC already defines its own protocol, that integrating SIOC with FSUIPC was a simple matter of translating IOCP messages sent to the IOCP server, into FSUIPC messages sent from the server to the sim software. For DCS, no such protocol exists and instead we have export.lua to work with. You should be able to connect to IOCP server from export.lua and appear as an IOCP client by following the protocol. At that point, all event messages will be forwarded to the script from all other clients. memento10 seems to have found something that he writes about in his thread on this topic: inputEvents['JOY_BTN1'] = JOYSTICK_BUTTON0 while it doesn't mean much by itself, this appears to be proof that all input events are exposed to lua script and not just clickable events. What if it's just a simple matter of doing something like sendInputEvent(inputEvents['KEY_C']) to send a 'C' keypress to DCS? Of course, I made up the function name but there should be something like that available. Wish I was home now so I could find out for sure Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 20, 2010 Share Posted July 20, 2010 Hey man, if you find something constructive about that way, shout it out here ! many readers don't have the knowledge to achieve that research but would apreciate to use it ! Link to comment Share on other sites More sharing options...
y2kiah Posted July 21, 2010 Share Posted July 21, 2010 I have your answer guys I used the Shkval Center command as my example, the following code will do it local dev = GetDevice(8) -- 8 == SHKVAL dev:SetCommand(92) -- 92 == Keys.iCommandPlaneRadarCenter another example, lock/unlock shkval target, and toggle white/black dev:SetCommand(100) -- 100 == Keys.iCommandPlaneChangeLock dev:SetCommand(846) -- 846 == iCommandPlane_I251_Background_WhiteBlack To find other commands browse SHKVAL_commands.lua, then look at command_defs.lua to find the corresponding command number for other devices besides shkval browse to the appropriate folder and follow the same pattern. Link to comment Share on other sites More sharing options...
brydling Posted July 21, 2010 Share Posted July 21, 2010 Great find! I will save this thread. Digital-to-Synchro converter for interfacing real aircraft instruments - Thread Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13 www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen. Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 21, 2010 Share Posted July 21, 2010 (edited) nice shot ! will study that ASAP ! [EDIT] files are in .\scripts\aircrafts\ka50 and .\scripts\aircrafts\ka50\cockpit once you have looked it and read it, it seems to be so easy... but it wasn't... as no one said it before ! Edited July 21, 2010 by C6_Hellfrog Link to comment Share on other sites More sharing options...
memento10 Posted July 21, 2010 Author Share Posted July 21, 2010 Thanks so much guys for help in figuring this out! I understand how you're getting the corresponding numbers from those files... but how do I connect a switch on a client PC to control them? I add that script to SiocConfig.lua on the BS computer? Link to comment Share on other sites More sharing options...
y2kiah Posted July 21, 2010 Share Posted July 21, 2010 Put the following new function at the end of your ExportSupport.lua file -- Calls non-clickable commands without parameters for two-position switch function TwoPositionSwitch_NCC_noparam(pDevice, pCommandNumber) GetDevice(pDevice):SetCommand(pCommandNumber) end Then, in your siocConfig.lua file, add the switch definition local SIOCNbr = 0 -- insert your correct SIOC button number here for shkval center inputsTable = { ... [sIOCNbr] = {TwoPositionSwitch_NCC_noparam, 8, 92}, ... } just keep in mind that this code is not tested at all I'm taking a leap of faith here that SIOC is actually passing the switch event to the sim machine just like all other events. If it's not coming through, try configuring it as a standard switch with SIOC, instead of as a key emulation type. Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 21, 2010 Share Posted July 21, 2010 working on it... will test with touchpal (stil don't have SIOC, but same way of working) from this WE, and post results ASAP... Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 21, 2010 Share Posted July 21, 2010 (edited) a file for work in progress to save time commands_defs : this file contains many keys, but not sorted by device order, so I managed to process lua files to sort a bit all that stuff and compile it in an exel sheet. compiling files *.lua in .\scripts\aircrafts\ka50\cockpit and commands_def.lua and devices.lua : exel sheet with device_name, deviceID, key_name, key_ID, sorted by devices : see linked file xls 2010 format lines from commands_defs.lua not in this sheet are keynames not investigated at this time : need to process lua files in sub folders from .\scripts\aircrafts\ka50\cockpit... will update when achieved... it is work in progress if anyone has corrections to add or remarks... appreciated... since all interested peolple by this thread will have to search these informations, if it may save some time, it is usefull... EDIT : file removed : see post 21 for an update Edited July 22, 2010 by C6_Hellfrog Link to comment Share on other sites More sharing options...
y2kiah Posted July 21, 2010 Share Posted July 21, 2010 working on it... will test with touchpal (stil don't have SIOC, but same way of working) from this WE, and post results ASAP... Oh I know it works standalone, tested yesterday. I meant the SIOC bits are untested, I wanted to help out memento10 with his SIOC issue. Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 21, 2010 Share Posted July 21, 2010 (edited) I wanted to help out memento10 with his SIOC issue and you did it very well ! many other people had the same problem as memento10 ! One question more : for many actions you may use the classic 'performclickableAction' way or this new 'getdevice:setcommand' way... is there a difference between the two ones ? I think about FPS hit on large export.lua files or on complex stuff (SIOC multiscreen BSVP BS network) ? Edited July 21, 2010 by C6_Hellfrog Link to comment Share on other sites More sharing options...
memento10 Posted July 22, 2010 Author Share Posted July 22, 2010 Thanks guys, will test this out tomorrow... work is getting in the way of my hobby :( I hope this works through Sioc, I may have some questions but will try to troubleshoot myself as much as possible. Link to comment Share on other sites More sharing options...
memento10 Posted July 22, 2010 Author Share Posted July 22, 2010 Thanks for the file Hellfrog, will save me a lot of time! Will be trying to get this working today. Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 22, 2010 Share Posted July 22, 2010 (edited) file to use DeviceName, DeviceID, KeyName, KeyID with getDevice():SetCommand() update : much more completed ! final version of the datasheet : DeviceName, DeviceID, KeyName, KeyID only a few keys from commands_defs.lua have no replication in other *.lua._Datas GetDevice_SetCommand.zip Edited July 22, 2010 by C6_Hellfrog Link to comment Share on other sites More sharing options...
y2kiah Posted July 22, 2010 Share Posted July 22, 2010 nice work on the speadsheet, that will be helpful! regarding your question, I'm not sure of the difference between the clickableaction method and the setcommand method. I think in the end they probably accomplish the same thing, and I doubt there is any difference in performance. I would say use the one you like better. Do clickableaction calls work from an external view? Link to comment Share on other sites More sharing options...
C6_Hellfrog Posted July 22, 2010 Share Posted July 22, 2010 (edited) yes it does from ext view (autopilot, door and so on are ok) EDIT : if you downoaded 1st version of xls sheet, please update to last one, much more complete, see some posts previous Edited July 22, 2010 by C6_Hellfrog Link to comment Share on other sites More sharing options...
memento10 Posted July 23, 2010 Author Share Posted July 23, 2010 Well I've been trying to get this working without any luck but I wonder if I'm making any silly mistakes. First I added this code to the ExportSupport.lua: -- Calls non-clickable commands without parameters for two-position switch function TwoPositionSwitch_NCC_noparam(pDevice, pCommandNumber) GetDevice(pDevice):SetCommand(pCommandNumber) end Then I created the Sioc variable on the client PC as follows with the physical switch 136 and using variable 485. I created this as a switch: Var 485 , name ShkvalCenter, Link IOCARD_SW, Input 136 Then I added the following code to SiocConfig.lua: inputsTable = { ... [485] = {TwoPositionSwitch_NCC_noparam, 8, 92}, ... } Is there anything obvious I'm doing that you think would be a problem? I checked the Error Log but saw no problems regarding this code. When I press the button... the Shkval doesn't center. Really appreciate everyone's help with this, I'm sure many others will also appreciate this solution! Link to comment Share on other sites More sharing options...
y2kiah Posted July 23, 2010 Share Posted July 23, 2010 can you post those two .lua files and your export.lua file? I'll see if I can find anything Link to comment Share on other sites More sharing options...
Recommended Posts