Jump to content

Recommended Posts

Posted (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 by hotstick
Posted

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.

 

 

  • 2 weeks later...
  • 1 month later...
Posted

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

 

---

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...