BrontoloIT Posted June 14, 2012 Share Posted June 14, 2012 If can be of any help, function from: local sensor_data = get_base_data() getAngleOfAttack getAngleOfSlide getBarometricAltitude getCanopyPos getCanopyState getEngineLeftFuelConsumption getEngineLeftRPM getEngineLeftTemperatureBeforeTurbine getEngineRightFuelConsumption getEngineRightRPM getEngineRightTemperatureBeforeTurbine getFlapsPos getFlapsRetracted getHeading getHelicopterCollective getHelicopterCorrection getHorizontalAcceleration getIndicatedAirSpeed getLandingGearHandlePos getLateralAcceleration getLeftMainLandingGearDown getLeftMainLandingGearUp getMachNumber getMagneticHeading getNoseLandingGearDown getNoseLandingGearUp getPitch getRadarAltitude getRateOfPitch getRateOfRoll getRateOfYaw getRightMainLandingGearDown getRightMainLandingGearUp getRoll getRudderPosition getSpeedBrakePos getStickPitchPosition getStickRollPosition getThrottleLeftPosition getThrottleRightPosition getTotalFuelWeight getTrueAirSpeed getVerticalAcceleration getVerticalVelocity getWOW_LeftMainLandingGear getWOW_NoseLandingGear getWOW_RightMainLandingGear Link to comment Share on other sites More sharing options...
SilentEagle Posted June 15, 2012 Share Posted June 15, 2012 (edited) I think I understand how this is supposed to work now and I am following the example of Macro_handler.lua in the /Script/Aircrafts/_Common folder but it's still not working. If I understand correctly, dev:listen_command calls SetCommand(command,value) when the command being listened to is sent to the sim. What I don't understand is why I would have to call a macro to perform one action. BrakeController.lua local dev = GetSelf() local sensor_data = get_base_data() local f = loadfile(LockOn_Options.script_path.."Macro_sequencies.lua") if f then pcall(f) end local update_rate = 0.2 -- 1/5 sec, or 5 times per second make_default_activity(update_rate) local m_max = get_param_handle("Max_Mach") local auto_ext = get_param_handle("AutoExtended") local iPlaneAirBrakeOn = 147 local iPlaneAirBrakeOff = 148 dev:listen_command(iPlaneAirBrakeOn) dev:listen_command(iPlaneAirBrakeOff) function post_initialize() auto_ext:set(0) m_max:set(0) print("post_initialize called in BrakeController.lua") end function update() local spdbrkpos = sensor_data.getSpeedBrakePos() local mach = sensor_data.getMachNumber() if mach>0.78 then m_max:set(1) else m_max:set(0) end if mach>0.78 and spdbrkpos==0 then --BRAKES OUT dispatch_action(nil,iPlaneAirBrakeOn) auto_ext:set(1) elseif mach<0.75 and spdbrkpos==1 and auto_ext==1 then --BRAKES IN dispatch_action(nil,iPlaneAirBrakeOff) auto_ext:set(0) end end function SetCommand(command,value) if track_is_reading() then return end if command == iPlaneAirBrakeOn then check_routine(start_order,airbrakes_out) elseif command == iPlaneAirBrakeOff then check_routine(start_order,airbrakes_in) end end need_to_be_closed = true -- close lua state after initialization Command_defs.lua Keys = { PlaneAirBrakeOn = 147, PlaneAirBrakeOff = 148, } Macro_Sequences.lua std_message_timeout = 2 airbrakes_out = { {time = 0.050000,action = 147,message = _("AIRBRAKES OUT"),message_timeout = std_message_timeout}, } airbrakes_in = { {time = 0.050000,action = 148,message = _("AIRBRAKES IN"),message_timeout = std_message_timeout}, } I have even tried to make my own button macro using this guide and replacing the common script modifications with the aircraft specific scripts. I couldn't get this to work either. http://en.wiki.eagle.ru/wiki/Macros_%28Command_Sequences%29 Edited June 15, 2012 by SilentEagle Link to comment Share on other sites More sharing options...
ED Team Alex Okean Posted June 15, 2012 Author ED Team Share Posted June 15, 2012 dev:listen_command is just subscribe this device to given command number , i.e. when you push putton on joystick and when this button is assigned to this command , your device will be notified about it and SetCommand will be called . macro_handler.lua is just sample of how to use dispatch_action , nothing more . dispatch_action is replacement for LoSetCommand ( which is export.lua function ) Link to comment Share on other sites More sharing options...
ED Team Alex Okean Posted June 15, 2012 Author ED Team Share Posted June 15, 2012 I think I understand how this is supposed to work now and I am following the example of Macro_handler.lua in the /Script/Aircrafts/_Common folder but it's still not working. If I understand correctly, dev:listen_command calls SetCommand(command,value) when the command being listened to is sent to the sim. What I don't understand is why I would have to call a macro to perform one action. BrakeController.lua local dev = GetSelf() local sensor_data = get_base_data() local f = loadfile(LockOn_Options.script_path.."Macro_sequencies.lua") if f then pcall(f) end local update_rate = 0.2 -- 1/5 sec, or 5 times per second make_default_activity(update_rate) local m_max = get_param_handle("Max_Mach") local auto_ext = get_param_handle("AutoExtended") local iPlaneAirBrakeOn = 147 local iPlaneAirBrakeOff = 148 dev:listen_command(iPlaneAirBrakeOn) dev:listen_command(iPlaneAirBrakeOff) function post_initialize() auto_ext:set(0) m_max:set(0) print("post_initialize called in BrakeController.lua") end function update() local spdbrkpos = sensor_data.getSpeedBrakePos() local mach = sensor_data.getMachNumber() if mach>0.78 then m_max:set(1) else m_max:set(0) end if mach>0.78 and spdbrkpos==0 then --BRAKES OUT dispatch_action(nil,iPlaneAirBrakeOn) auto_ext:set(1) elseif mach<0.75 and spdbrkpos==1 and auto_ext==1 then --BRAKES IN dispatch_action(nil,iPlaneAirBrakeOff) auto_ext:set(0) end end function SetCommand(command,value) if track_is_reading() then return end if command == iPlaneAirBrakeOn then check_routine(start_order,airbrakes_out) elseif command == iPlaneAirBrakeOff then check_routine(start_order,airbrakes_in) end end need_to_be_closed = true -- close lua state after initialization Command_defs.lua Keys = { PlaneAirBrakeOn = 147, PlaneAirBrakeOff = 148, } Macro_Sequences.lua std_message_timeout = 2 airbrakes_out = { {time = 0.050000,action = 147,message = _("AIRBRAKES OUT"),message_timeout = std_message_timeout}, } airbrakes_in = { {time = 0.050000,action = 148,message = _("AIRBRAKES IN"),message_timeout = std_message_timeout}, } I have even tried to make my own button macro using this guide and replacing the common script modifications with the aircraft specific scripts. I couldn't get this to work either. http://en.wiki.eagle.ru/wiki/Macros_%28Command_Sequences%29 your sample have mistakes : need_to_be_closed must be false if you want get this state active after initialization . if you set it to true , "update" , "SetCommand" will never be called , track_is_reading() should be checked before calling dispatch_action , if it will be checked on start of SetCommand , SetCommand will be not fully executed in track which broke track reproducibility. you dont need to dlisten PlaneAirBrakeOn and PlaneAirBrakeOff in this sample, Link to comment Share on other sites More sharing options...
BrontoloIT Posted June 15, 2012 Share Posted June 15, 2012 Just to clear it in my mind dispatch_action(nil,iPlaneAirBrakeOff) it's the code needed to send to sim engine the "close air break" command? and if i need to close them just to 40% (or just for three state flaps (closed, takeoff, landing))? Link to comment Share on other sites More sharing options...
SilentEagle Posted June 15, 2012 Share Posted June 15, 2012 Thanks Alex!! Got it working perfectly. local dev = GetSelf() local sensor_data = get_base_data() local update_rate = 0.2 -- 1/5 sec, or 5 times per second make_default_activity(update_rate) local m_max = get_param_handle("Max_Mach") local auto_ext local iPlaneAirBrakeOn = 147 local iPlaneAirBrakeOff = 148 function post_initialize() auto_ext=0 m_max:set(0) print("post_initialize called in BrakeController.lua") end function update() local spdbrkpos = sensor_data.getSpeedBrakePos() local mach = sensor_data.getMachNumber() if mach>0.78 then m_max:set(1) else m_max:set(0) end if mach>0.78 and spdbrkpos==0 then --BRAKES OUT dispatch_action(nil,iPlaneAirBrakeOn) auto_ext=1 elseif mach<0.75 and spdbrkpos==1 and auto_ext==1 then --BRAKES IN dispatch_action(nil,iPlaneAirBrakeOff) auto_ext=0 end end need_to_be_closed = false -- close lua state after initialization question about what you said on track_is_reading. Where exactly in my example should: if track_is_reading() then return end be called? Or is it even needed? Link to comment Share on other sites More sharing options...
ED Team Alex Okean Posted June 15, 2012 Author ED Team Share Posted June 15, 2012 Thanks Alex!! Got it working perfectly. local dev = GetSelf() local sensor_data = get_base_data() local update_rate = 0.2 -- 1/5 sec, or 5 times per second make_default_activity(update_rate) local m_max = get_param_handle("Max_Mach") local auto_ext local iPlaneAirBrakeOn = 147 local iPlaneAirBrakeOff = 148 function post_initialize() auto_ext=0 m_max:set(0) print("post_initialize called in BrakeController.lua") end function update() local spdbrkpos = sensor_data.getSpeedBrakePos() local mach = sensor_data.getMachNumber() if mach>0.78 then m_max:set(1) else m_max:set(0) end if mach>0.78 and spdbrkpos==0 then --BRAKES OUT dispatch_action(nil,iPlaneAirBrakeOn) auto_ext=1 elseif mach<0.75 and spdbrkpos==1 and auto_ext==1 then --BRAKES IN dispatch_action(nil,iPlaneAirBrakeOff) auto_ext=0 end end need_to_be_closed = false -- close lua state after initialization question about what you said on track_is_reading. Where exactly in my example should: if track_is_reading() then return end be called? Or is it even needed? ok let's me to explain : dispatch_action send command to player's unit and put copy to the track . when track is reading this value poped from track and sended back to player's unit so correct handling should be if not track_is_reading() then dispatch_action(nil,command,value_if_it_exist) end to avoid duplicates in input queue when track is playnig , cause command will be already there Link to comment Share on other sites More sharing options...
BrontoloIT Posted June 15, 2012 Share Posted June 15, 2012 Ok Alex, thanks for your help, correct me if i am wrong. This is the scenario: 3D cockpit, i click on a button X to set flaps to landing; button X is attached to device Y; on device Y is called the function SetCommand(); we call the dispatch_action(nil, iFlaps, iFull). Is this the right way to interact from our LUA device with the simulation engine? Link to comment Share on other sites More sharing options...
july865 Posted June 16, 2012 Share Posted June 16, 2012 my question is: how do i export to a log file, the words that are displayed on the screen while in game? Asus x99, i7 5930k, 32g mem, MSI 1070GTX, 970 Samsung M.2, LG 35in Ultra-Wide, TrackIR 4 Thrustmaster Warthog HOTAS [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Mt5_Roie Posted June 18, 2012 Share Posted June 18, 2012 Great info! Thanks for your work. Coder - Oculus Rift Guy - Court Jester Link to comment Share on other sites More sharing options...
july865 Posted June 20, 2012 Share Posted June 20, 2012 any idea's?? Asus x99, i7 5930k, 32g mem, MSI 1070GTX, 970 Samsung M.2, LG 35in Ultra-Wide, TrackIR 4 Thrustmaster Warthog HOTAS [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
aaron886 Posted June 21, 2012 Share Posted June 21, 2012 (edited) Alex... can you help me find a list of element controllers? I know only of these: text_using_parameter move_up_down_using_parameter move_left_right_using_parameter rotate_using_parameter parameter_in_range I'd also love to find a list of Elements themselves... like ceTexPoly ceStringPoly etc. Edited June 26, 2012 by aaron886 Link to comment Share on other sites More sharing options...
aaron886 Posted June 28, 2012 Share Posted June 28, 2012 Officially up against a wall. Any instructions on the parenting method as well? I'd like to have a part move in relation to its parent. Many thanks in advance, Alex. Link to comment Share on other sites More sharing options...
Haddock Posted July 1, 2012 Share Posted July 1, 2012 I hope there will be some replies... Could be useful... Link to comment Share on other sites More sharing options...
Pat01 Posted August 11, 2012 Share Posted August 11, 2012 (edited) Is there a way to add helicopter ? EDIT : I opened a new threat here : http://forums.eagle.ru/showthread.php?p=1529516#post1529516 Edited August 12, 2012 by Pat01 Link to comment Share on other sites More sharing options...
BR55Sevas Posted August 15, 2012 Share Posted August 15, 2012 I have some difficulties with adding new aircraft unit in DCSW. Using Wunderluft template, I`ve made new aircraft Mod folder. I`ve changed all "wunderluft" inside files of my Mod folder. Result is only working patch (I can set wallpaper) bottom in main DCS window, in mission editor my craft is absent. Also I tried delete Wunderluft mod folder, but no success again. I suppose problem in some identifier like CLSID or something else. So, what parameters exactly should be different compare to another craft? thanks 1 МиГ-29 Fly by wire СДУ Su-27SM second display panel https://www.youtube.com/embed/videoseries?list=PL_2GGwNpWNp_fKXfRtDhIk8s5Jf4a9XHS http://berkuts.ru Пилотажный сервер с роботом | Aerobatic server with PhantomControl Link to comment Share on other sites More sharing options...
Ells228 Posted August 15, 2012 Share Posted August 15, 2012 (edited) Sevas, If you just copy all of the template files into the mods\aircrafts folder withouth changing anything, do you see it in main menu, mission editor and in flight? If you do, then it's a process of elimination to see what file is causing your problem. I would suggest step by step like this: Copy templates files to mods\aircrafts - do not rename anything Export your exterior 3d model and rename that file to Wunderluft.edm and put it into mods\aircrafts\wunderluft\shapes Do you see the exterior model in sim? If so, move onto the next step which is to rename things. You have to be very careful here though to make sure you don't delete " or ; or , Next is to look at the code. Always do things one step at a time, don't rush in changing things here and there. Trust me I've spent many hours trying to debug errors when I've changed a lot. It may seem like a long task to change one thing, go in sim, check it, change another, check in sim, repeat... but it is worth it in the long run. Let me know how you get on with the exterior model bit first and then I'll talk you through the code, and then the cockpit functions. Cheers, Chris. Edited August 15, 2012 by Ells228 Link to comment Share on other sites More sharing options...
Ells228 Posted August 15, 2012 Share Posted August 15, 2012 Beaker, did you get around your issues? Link to comment Share on other sites More sharing options...
BR55Sevas Posted August 16, 2012 Share Posted August 16, 2012 (edited) If I just copy and past Wunderluft folder (like Wunderluft2) without changing anything then impossible to run DCSW. After, I tried to change entry.lua and myplane.lua and I see myplane only in main DCS menu. So, all tests with shapes impossible, cause in editor I can`t choose my plane. Someone, test please my mod folder, is it appear in mission editor? Edited September 22, 2012 by BR=55=Sevas МиГ-29 Fly by wire СДУ Su-27SM second display panel https://www.youtube.com/embed/videoseries?list=PL_2GGwNpWNp_fKXfRtDhIk8s5Jf4a9XHS http://berkuts.ru Пилотажный сервер с роботом | Aerobatic server with PhantomControl Link to comment Share on other sites More sharing options...
aaron886 Posted August 16, 2012 Share Posted August 16, 2012 Doesn't work for me either, Sevas. I've had similar problems when trying to use the correct identifier/name for my aircraft, in the end I had to settle for a name consisting only of letters. ("Hornet") I wonder if it's just a limitation of the present system. Link to comment Share on other sites More sharing options...
madhog Posted August 16, 2012 Share Posted August 16, 2012 Sevas, in Mig-15.lua change MiG-15 = { to MiG_15 = { and at the end of file make it add_aircraft(MiG_15) let me know if it works for you at this stage to avoid confusion try naming your aircraft with one word without -,_ etc 1 Link to comment Share on other sites More sharing options...
BR55Sevas Posted August 16, 2012 Share Posted August 16, 2012 (edited) Thanks, Aaron! Now it works. Madhog, I will try. UPD: It works, madhog, thank you very much! I hope developers will fix it in future. Edited August 16, 2012 by BR=55=Sevas МиГ-29 Fly by wire СДУ Su-27SM second display panel https://www.youtube.com/embed/videoseries?list=PL_2GGwNpWNp_fKXfRtDhIk8s5Jf4a9XHS http://berkuts.ru Пилотажный сервер с роботом | Aerobatic server with PhantomControl Link to comment Share on other sites More sharing options...
Ells228 Posted August 16, 2012 Share Posted August 16, 2012 Yeah that would have been my suggestion as Aaron and I found out one night recently. Glad you got it working buddy. Any more questions just ask. Link to comment Share on other sites More sharing options...
VBS_Nero Posted August 17, 2012 Share Posted August 17, 2012 Hello to all.. I was able to successfully import the-39 thanks to your comments positive Downloaded MI-15 I am not visual model in mission editor I renamed the files .. but without success. I noticed that the folder shepes "mig 15" and 'without file.Il ME does not lead to see the model. In the root there is a file DCSW edm Mig-15 and we will never see it. Reason for the opposite L-39 'cause exists at the root DCSW. [sIGPIC][/sIGPIC] DCS SQ° Italia Virtual Black Sheep VBS Fan Page Facebook You Tube Page Link to comment Share on other sites More sharing options...
SVKSniper Posted August 17, 2012 Share Posted August 17, 2012 Doesn't work for me either, Sevas. I've had similar problems when trying to use the correct identifier/name for my aircraft, in the end I had to settle for a name consisting only of letters. ("Hornet") I wonder if it's just a limitation of the present system. Aaron i resolve this problem.....now i have 2(and i see) aircraft for my mod( SMT and UBT)....if i have free time this week i help you..... Support my work Link to comment Share on other sites More sharing options...
Recommended Posts