skypickle Posted February 26, 2023 Posted February 26, 2023 This github is JavaScript that allows voice communication with chatGPT https://github.com/C-Nedelcu/talk-to-chatgpt i would like to turn it into a lua file that i can activate with a button on my throttle 4930K @ 4.5, 32g ram, TitanPascal
Dragon1-1 Posted February 26, 2023 Posted February 26, 2023 (edited) Well, the first step would be to rewrite it in LUA (which is quite different from JavaScript), and make it Chrome-independent, since DCS doesn't talk to Chrome. Once you get that small matter of programming done, I think you should be able to use training commands that look for a specific button press. EDIT: In case my sarcasm was too subtle, the first thing you should do is take a good hard look at the feasibility of the whole idea. The first two steps in particular. Edited February 26, 2023 by Dragon1-1
Chump Posted February 26, 2023 Posted February 26, 2023 (edited) Adding to what @Dragon1-1 said, since it was written as a Chrome plug-in, it will not be a direct port. Although it is possible to trigger LUA with a new key/button press using listen_command(), the next hurdle would be that DCS does not have native voice recognition to generate the input to send to ChatGPT. Edited February 26, 2023 by Chump lol @ ChatGPT
Dragon1-1 Posted February 26, 2023 Posted February 26, 2023 Yeah, that's kind of what "making it Chrome-independent" was about. Also very much nontrivial, since Chrome is how it talks to ChatGPT in first place. It seems to use Windows dictation feature, so at least that shouldn't depend on DCS. Indeed, it makes no sense for DCS to ever make its own voice recognition, seeing as Windows already handles that, and programs like VA just make macros based on it. 1
skypickle Posted February 28, 2023 Author Posted February 28, 2023 Could you elaborate on where the listen command would be placed? Somewhere in the default.lua of an aircraft input joystick file? 4930K @ 4.5, 32g ram, TitanPascal
Solution Chump Posted February 28, 2023 Solution Posted February 28, 2023 @skypickle You would add your LUA script into the creators table in device_init.lua. Your script would then call the listen_command(), and you would trigger it with an input definition. You can see how it is done by looking at other LUAs that are called from device_init.lua. For example: -- devices.lua devices["newThing"] = counter() -- device_init.lua creators[devices.newThing] = { "avLuaDevice", LockOn_Options.script_path .. "newThing.lua" } -- newThing.lua GetSelf():listen_command(1234) -- default.lua { down = 1234, name = _("My New Thing Command"), category = _("MODS") }, There is a bit more to it like defining the functions/logic that is triggered, but this should get you started.
jjl9999 Posted March 2, 2023 Posted March 2, 2023 On 2/26/2023 at 8:41 PM, Dragon1-1 said: Well, the first step would be to rewrite it in LUA (which is quite different from JavaScript), and make it Chrome-independent, since DCS doesn't talk to Chrome. Once you get that small matter of programming done, I think you should be able to use training commands that look for a specific button press. EDIT: In case my sarcasm was too subtle, the first thing you should do is take a good hard look at the feasibility of the whole idea. The first two steps in particular. It does not seem "crazy", it depends on what you want to do and obtain. You can execute any executable or batch in windows in an lua by using os.execute() . This is what I use in the encyclopedia that I have slightly "tuned" to be able to go directly to detailed info on the displayed plane/object in wikipedia by a push on a button, I have also another button to go directly to corresponding DCS forum topics.... 1
Dragon1-1 Posted March 2, 2023 Posted March 2, 2023 Interesting. If you have that part figured out, it can be done. Although, worth noting that a JavaScript plugin is not an executable, but if you can run Chrome from DCS (and don't mind the waste of memory), you should be able to do that.
Recommended Posts