VirusAM Posted August 18, 2019 Posted August 18, 2019 (edited) Hello, i need the help of the community here as i have an issue for multiplayer. I took what written here as an example (https://forums.eagle.ru/showthread.php?t=174929) and i made an export script which write some information about DCS in a text file. This text file is then read by my Target script. It is important to note that i also took inspiration from Homefries's work and help from IvanWfr (which helped me to to the cycle part).. I take the aircraft name, gear state and other interesting (for me at least) informations and it change (in real time) the warthog behaviour when the aircraft change and for example the gear is up or down. I can share both the lua script and the Target script (which however needs to be heavily customized as it is tailored to my hardware). I have also the DCSFlightpanel programs which does similar things but with the Saitek/Logitech panels and it works correctly online. So i need some help to understand if there is a way to make it work online. Here is an example video (very old version of the script) and the lua code Thanks anyone, in advance, for helping me ${1} local aircraft = LoGetObjectById(LoGetPlayerPlaneId()) local aircraft_id ="U" local MainPanel = GetDevice(0) local LED0, LED1, LED2, LED3 = 0, 0, 0, 0 local TLED0, TLED1, TLED2, TLED3, TLED4 = 0, 0, 0, 0, 0 local BATTERY = 0 local RWR1, RWR2, RWR3, RWR4 = 0, 0, 0, 0 local BACKLIGHTA, BACKLIGHTB = 0, 0 local lightspanel, lightsconsole = 5, 5 local gear = 0 function LuaExportActivityNextEvent(t) if (aircraft.Name == "A-10C") then aircraft_id ="W" --Console backlight LED0 = 0 --Master Caution Light LED1 = 0 --Launch Warning Light LED2 = 0 --(HOTAS Pinkie Switch) LED3 = 0 --Flaps LED4 = 0 --Gear Lock Lights LED5 = 0 --Console backlight TLED0 = math.ceil(MainPanel:get_argument_value(297)) --Master Caution Light TLED1 = MainPanel:get_argument_value(404) --Launch Warning Light TLED2 = MainPanel:get_argument_value(372) --Flaps TLED3 = math.ceil(MainPanel:get_argument_value(653)) --Gear Lock Lights TLED4 = (MainPanel:get_argument_value(659) and MainPanel:get_argument_value(660) and MainPanel:get_argument_value(661)) gear = MainPanel:get_argument_value(716) BATTERY = MainPanel:get_argument_value(246) elseif (aircraft.Name == "M-2000C") then aircraft_id ="M" --Console backlight LED0 = math.abs(math.ceil(MainPanel:get_argument_value(642))) --Master Caution Light LED1 = (MainPanel:get_argument_value(199) or MainPanel:get_argument_value(200)) --(Not Used) LED2 = 0 --Police light Switch LED3 = MainPanel:get_argument_value(449) --Conf Warning LED4 = MainPanel:get_argument_value(553) --Gear Lock Lights LED5 = (MainPanel:get_argument_value(417) and MainPanel:get_argument_value(418) and MainPanel:get_argument_value(419)) gear = MainPanel:get_argument_value(404) elseif (aircraft.Name == "MiG-19P") then aircraft_id ="P" gear = 0 elseif (aircraft.Name == "F-5E-3") then aircraft_id ="5" gear = 0 elseif (aircraft.Name == "AJS37") then aircraft_id ="V" gear = 0 elseif (aircraft.Name == "F-86F Sabre") then aircraft_id ="S" gear = 0 elseif ((aircraft.Name == "Su-33") or (aircraft.Name == "Su-27") or (aircraft.Name == "J-11A") or (aircraft.Name == "MIG-29S") or (aircraft.Name == "SU-25T")) then aircraft_id ="3" gear = 0 ---------------------------------- AV8B ----------------------- elseif (aircraft.Name == "AV8BNA") then aircraft_id ="8" gear = 0 ----------------------------------END AV8B ----------------------- --------------------------------- F/A-18C HORNET --------------------------------- elseif (aircraft.Name == "FA-18C_hornet") then aircraft_id ="H" --MFD LEDS --Speedbrake LED0 = MainPanel:get_argument_value(19) --Caution LED1 = MainPanel:get_argument_value(13) --Fire LED2 = (MainPanel:get_argument_value(10) or MainPanel:get_argument_value(26)) --RWR --LED3 = (MainPanel:get_argument_value(38) or MainPanel:get_argument_value(39) or MainPanel:get_argument_value(40) or MainPanel:get_argument_value(41)) --RWR Light RWR1 = MainPanel:get_argument_value(38) RWR2 = MainPanel:get_argument_value(39) RWR3 = MainPanel:get_argument_value(40) RWR4 = MainPanel:get_argument_value(41) -- right led logic if (RWR1 == 1) then LED3 = 1 elseif (RWR2 == 1)then LED3 = 1 elseif (RWR3 == 1) then LED3 = 1 elseif (RWR4 == 1) then LED3 = 1 elseif (RWR1 == 0) then LED3 = 0 elseif (RWR2 == 0) then LED3 = 0 elseif (RWR3 == 0) then LED3 = 0 elseif (RWR4 == 0) then LED3 = 0 end --THROTTLE LEDS -- battery BATTERY = MainPanel:get_argument_value(404) TLED0 = 4 TLED1 = 5 TLED2 = 6 --APU FIRE TLED3 = MainPanel:get_argument_value(30) --APU LIGHT TLED4 = MainPanel:get_argument_value(376) --Gear State gear = MainPanel:get_argument_value(226) BACKLIGHTA = MainPanel:get_argument_value(413) --console BACKLIGHTB = MainPanel:get_argument_value(414) --instruments panel -- Console Lights Logic if (BACKLIGHTA == 0) then lightsconsole = 0 elseif (BACKLIGHTA < 0.25) then lightsconsole = 1 elseif (BACKLIGHTA < 0.5) then lightsconsole = 2 elseif (BACKLIGHTA < 0.75) then lightsconsole = 3 elseif (BACKLIGHTA < 1) then lightsconsole = 4 elseif (BACKLIGHTA == 1) then lightsconsole = 5 end -- Panel Lights Logic if (BACKLIGHTB == 0) then lightspanel = 0 elseif (BACKLIGHTB < 0.25) then lightspanel = 1 elseif (BACKLIGHTB < 0.5) then lightspanel = 2 elseif (BACKLIGHTB < 0.75) then lightspanel = 3 elseif (BACKLIGHTB < 1) then lightspanel = 4 elseif (BACKLIGHTB == 1) then lightspanel = 5 end --------------------------------- END F/A-18C HORNET --------------------------------- --------------------------------- F-14B TOMCAT --------------------------------- elseif (aircraft.Name == "F-14B") then aircraft_id ="T" gear = MainPanel:get_argument_value(326) --GearLever LED0 =(MainPanel:get_argument_value(9355) or MainPanel:get_argument_value(9356)) --left and right engine stall LED1 = MainPanel:get_argument_value(15015) --LeftFire LED2 = MainPanel:get_argument_value(15014) --RightFire TLED0 = 5 TLED1 = 6 TLED2 = 7 TLED3 = 8 TLED4 = MainPanel:get_argument_value(15046) --Warning Flap RWR1 = MainPanel:get_argument_value(9357) --AI/SAM/AAA Light RWR2 = MainPanel:get_argument_value(9358) RWR3 = MainPanel:get_argument_value(9359) -- right led logic if (RWR1 == 1) then LED3 = 1 elseif (RWR2 == 1)then LED3 = 1 elseif (RWR3 == 1) then LED3 = 1 elseif (RWR1 == 0) then LED3 = 0 elseif (RWR2 == 0) then LED3 = 0 elseif (RWR3 == 0) then LED3 = 0 end BACKLIGHTA = MainPanel:get_argument_value(15008) --console BACKLIGHTB = MainPanel:get_argument_value(15007) --instruments panel if (BACKLIGHTA == 0) then lightsconsole = 0 elseif (BACKLIGHTA < 0.25) then lightsconsole = 1 elseif (BACKLIGHTA < 0.5) then lightsconsole = 2 elseif (BACKLIGHTA < 0.75) then lightsconsole = 3 elseif (BACKLIGHTA < 1) then lightsconsole = 4 elseif (BACKLIGHTA == 1) then lightsconsole = 5 end -- Panel Lights Logic if (BACKLIGHTB == 0) then lightspanel = 0 elseif (BACKLIGHTB < 0.25) then lightspanel = 1 elseif (BACKLIGHTB < 0.5) then lightspanel = 2 elseif (BACKLIGHTB < 0.75) then lightspanel = 3 elseif (BACKLIGHTB < 1) then lightspanel = 4 elseif (BACKLIGHTB == 1) then lightspanel = 5 end --------------------------------- END F14-B TOMCAT --------------------------------- --------------------------------- PROPS AND WW2 -------------------------------------- elseif (aircraft.Name == "Yak-52") then aircraft_id ="Y" gear = 0 elseif ((aircraft.Name == "SpitfireLFMkIX") or (aircraft.Name == "FW-190D9") or (aircraft.Name == "P-51D")) then aircraft_id ="2" gear = 0 elseif (aircraft.Name == "Bf-109K-4") then aircraft_id ="K" gear = 0 --------------------------------- END PROPS AND WW2 -------------------------------------- end default_output_file = io.open(lfs.writedir().."/Logs/TargetScript.log", "w") default_output_file:write(string.format("%s", aircraft_id)) default_output_file:write(string.format("%d", gear)) default_output_file:write(string.format("%d%d%d%d", LED0, LED1, LED2, LED3)) default_output_file:write(string.format("%d%d%d%d%d", TLED0, TLED1, TLED2, TLED3, TLED4)) default_output_file:write(string.format("%d%d", lightsconsole, lightspanel)) default_output_file:write(string.format("%d", BATTERY)) default_output_file:write(string.format(" lightsconsoleight=%s", BACKLIGHTA)) default_output_file:write(string.format(" lightspanelight=%s", BACKLIGHTB)) default_output_file:write(string.format(" RWR1=%s", RWR1)) default_output_file:write(string.format(" RWR2=%s", RWR2)) default_output_file:write(string.format(" RWR3=%s", RWR3)) default_output_file:write(string.format(" RWR4=%s", RWR4)) default_output_file:write(string.format(" Aircraft name = %s", aircraft.Name)) default_output_file:write(string.format(" Gear Lever = %s", gear)) default_output_file:close() return t + 0.1 end -------------------------------------------------------------- function LuaExportStop() default_output_file = io.open(lfs.writedir().."/Logs/TargetScript.log", "w") default_output_file:write("U200000000055100000000000") default_output_file:close() end Edited August 18, 2019 by VirusAM R7-5800X3D 64GB RTX-4090 LG-38GN950 N/A Realsimulator FFSB MKII Ultra+F-16 grip+F/A-18 grip, VKB Stecs Max, VKB T-Rudder MKV, Razer Tartarus V2 Secrets Lab Tytan, Monstertech ChairMounts
Drakoz Posted August 22, 2019 Posted August 22, 2019 I'm not a DCS Lua expert, but what I know from previous people trying to do this kind of thing is it works in single player fine, but not in multiplayer. The reason is because the parameters that everyone seems to find for their LUA script tends to only work in single player. You have to find the equivalent information which is available for multiplayer, but comes from a different source. This is related (I assume) to issues of cheat avoidance, or multipayer server settings locking out certain information. You might want to use hooks into DCSBios (or are you already?). The latest DCSBios which is being maintained by the guys working on DCSFlightPanels has hooks for all the latest aircraft, and is has always worked fine in single and multiplayer. I also assume DCSBios will make your task easier, but I haven't played with it directly to know. I just assume the whole purpose of DCSBios is to streamline the access to DCS information and control things in DCS as well even over a longer period of time where ED might change the LUA scripts, but DCSBios will always be consistent (assuming development continues on it).
VirusAM Posted August 23, 2019 Author Posted August 23, 2019 Hi drakoz, thanks for the reply. Anyway i understood that the issue is related to the anticheat features. But as is possible to see in the code above i am only exporting cockpit states, like lights or gear up or down. I don't see how this can be used for cheating, and also i took the parameters from the dcs-bios code of the relevant plane. I understand that you suggest to use dcs bios...but i don't know how to interface it with target. I asked some time ago in their thread about this possibility, but i had no reply. So i hope someone can show up with some solution. Thanks R7-5800X3D 64GB RTX-4090 LG-38GN950 N/A Realsimulator FFSB MKII Ultra+F-16 grip+F/A-18 grip, VKB Stecs Max, VKB T-Rudder MKV, Razer Tartarus V2 Secrets Lab Tytan, Monstertech ChairMounts
Drakoz Posted August 23, 2019 Posted August 23, 2019 Ya, sorry I haven't dove into LUA and DCSBios yet - you are way ahead of me. I only suggested the "cheat" comment because I have seen several people ask questions like yours and the only consistent answer I've seen is single and multi player use different hooks to the LUA code. I'm in the dark beyond that. BTW, the Youtube video link doesn't work for me. Was it taken down, or posted as a private video?
slughead Posted November 13, 2023 Posted November 13, 2023 On 8/23/2019 at 10:26 AM, VirusAM said: Hi drakoz, thanks for the reply. Anyway i understood that the issue is related to the anticheat features. But as is possible to see in the code above i am only exporting cockpit states, like lights or gear up or down. I don't see how this can be used for cheating, and also i took the parameters from the dcs-bios code of the relevant plane. I understand that you suggest to use dcs bios...but i don't know how to interface it with target. I asked some time ago in their thread about this possibility, but i had no reply. So i hope someone can show up with some solution. Thanks Hi. Old thread revival but would you mind sharing your target script, please? I'd like to do a similar thing with the new Thrustmaster Viper TQS to configure the LEDs according to DCS state. Did you ever solve your anti-cheat problem? Slugmouse: a finger-mounted mouse button emulator for hand-tracked VR cockpit clicking. Available now! Slugmouse Demonstration Video
VirusAM Posted November 13, 2023 Author Posted November 13, 2023 (edited) Hi @slughead...I have to check, as I don't have anything from thrustmaster at the moment, and I hope I have the files somewhere. About the DCS export, I am pretty sure I still have it. It basically wrote on a text file some values (module name, gear and lights state etc). Then the target script opened that file (remember target uses C ), and read it and set lights and commands accordingly. EDIT: I found some backup on my onedrive folder: Target script (the main file to load should be DCS_global.tmc don't quite remember) and export lua to put in dcs saved games, script folder. About the online, I never solved it...I read the documentation about the online export, and the lua functions I used should be working also in MP, but it didn't. Maybe it is something time dependant (in MP you need first to select the slot)...but I abandoned the project when I sold my thrustmaster gear. DCS_Global.7z Scripts.7z Edited November 13, 2023 by VirusAM 1 R7-5800X3D 64GB RTX-4090 LG-38GN950 N/A Realsimulator FFSB MKII Ultra+F-16 grip+F/A-18 grip, VKB Stecs Max, VKB T-Rudder MKV, Razer Tartarus V2 Secrets Lab Tytan, Monstertech ChairMounts
slughead Posted November 13, 2023 Posted November 13, 2023 @VirusAM thanks. It's a pointer in a direction at least for me to get started. Slugmouse: a finger-mounted mouse button emulator for hand-tracked VR cockpit clicking. Available now! Slugmouse Demonstration Video
Recommended Posts