hotstick Posted April 3 Posted April 3 (edited) I created a utility that allows you to launch or change the profile (Target TMC) of a Thrustmaster Warthog hotas while the DCS game is running. To do this, I capture the name of the current module via DCS export.lua using "LoGetSelfData()" and property "Name". The two functions used to receive the module name are: -LuaExportStart() -LuaExportOnHumanStart() This works fine except for "Combined Arms" or "tactical commander" because this module isn't detected by the two functions used. Is this normal? Thanks. Edited April 3 by hotstick http://51thMassilia.net France
Flappie Posted April 5 Posted April 5 Hi @hotstick. Can you please share you script so I can reproduce the issue? ---
hotstick Posted April 6 Author Posted April 6 Hello, here is the script in Export.lua Quote -- Debut Script DCSProfilSwitch Par HotStick le 13/09/2024 default_output_file = io.open(lfs.writedir().."/Logs/TargetHotStick.log", "w") -- Si pas de selection de module dans la mission function LuaExportStart() if default_output_file then local OwnAirframe = LoGetSelfData() local Module = OwnAirframe.Name default_output_file:write(string.format("Mod=%s\n", Module)) local PrepCMD = "C:/HotStick_Script/DCSProfilSwitch/DCSProfilSwitch.cmd ".. Module default_output_file:write(string.format("PrepCMD=%s\n", PrepCMD)) os.execute(PrepCMD) end end -- Si selection de module dans la mission function LuaExportOnHumanStart() if default_output_file then local OwnAirframe = LoGetSelfData() local Module = OwnAirframe.Name default_output_file:write(string.format("Mod=%s\n", Module)) local PrepCMD = "C:/HotStick_Script/DCSProfilSwitch/DCSProfilSwitch.cmd ".. Module default_output_file:write(string.format("PrepCMD=%s\n", PrepCMD)) os.execute(PrepCMD) end end function LuaExportStop() -- Works once just after mission stop. -- Close files and/or connections here. -- 1) File if default_output_file then default_output_file:close() default_output_file = nil end -- 2) Socket -- socket.try(c:send("quit")) -- to close the listener socket -- c:close() end -- Fin Script DCSProfilSwitch And the result in the file "C:\Users\xxxxxxx\Saved Games\DCS.openbeta\Logs\TargetHotStick.log" Quote Mod=F-4E-45MC PrepCMD=C:/HotStick_Script/DCSProfilSwitch/DCSProfilSwitch.cmd F-4E-45MC The problem is that when I enter a Tank or something else using Combined Arms, the TargetHotStick.log file is always empty. http://51thMassilia.net France
hotstick Posted April 17 Author Posted April 17 Hello Flappie, were you able to try and reproduce the problem? http://51thMassilia.net France
Flappie Posted June 14 Posted June 14 Hi @hotstick. Sorry about the delay in my answer. I tried your script but I'm getting an error. So I tried to have it display a message ingame instead, but it did not work either (I'm not a script guy). function LuaExportStart() local OwnAirframe = LoGetSelfData() local Module = OwnAirframe.Name trigger.action.outText( 'Module name: ' .._Module,40) end function LuaExportOnHumanStart() local OwnAirframe = LoGetSelfData() local Module = OwnAirframe.Name trigger.action.outText( 'Module name: ' .._Module,40) end ---
Recommended Posts