Redglyph Posted January 5, 2017 Posted January 5, 2017 I'm trying to create a little tutorial mission, and I'm looking for two features that I think are not available, but I'd rather ask to be sure. 1) Is it possible at all to interact with the cockpit from a lua script? I'd like the highlight to appear after a while if the user hasn't clicked the correct button in the cockpit. My main motivation here is to save a lot of redundant triggers with flags, delays and so on, by having a simple lua function to do that (list of elements in a parameter, check for their values, and illuminate after a while if not correct). Seems a bit hopeless from what I found so far, but it would be such a basic feature and so useful to have :) 2) Is there any other way to have persistent data than removing the sanitizing in MissionScripting? Here for example I'd like to keep a record of what went well / wrong, with a score, and retrieve that in a later mission. And if possible, without asking the user to modify this file and thus introducing a security risk. Allowing to read/write files in a fixed, dedicated directory only would do, since I suppose serializing that in the logbook would be a terrible way to do that. Or is there another way that wouldn't require the user to modify things? System specs: Win7 x64 | CPU: i7-4770K | RAM: 16 GB | GPU: GTX 980 Ti 6 GB | Thrustmaster HOTAS | MFG rudder pedals | SATA3 SSD | TrackIR
Redglyph Posted January 13, 2017 Author Posted January 13, 2017 I suppose it's a no then :no_sad: ;) System specs: Win7 x64 | CPU: i7-4770K | RAM: 16 GB | GPU: GTX 980 Ti 6 GB | Thrustmaster HOTAS | MFG rudder pedals | SATA3 SSD | TrackIR
Scifer Posted March 31, 2018 Posted March 31, 2018 :helpsmilie: I want to make missions where certain instruments are preset in a Lua script so I don't have to set them for every mission in ME triggers.
Grimes Posted March 31, 2018 Posted March 31, 2018 :helpsmilie: I want to make missions where certain instruments are preset in a Lua script so I don't have to set them for every mission in ME triggers. I believe that can be done via export.lua but its an area I haven't really messed with. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
BlacleyCole Posted April 1, 2018 Posted April 1, 2018 If you figure out how I ve got something to discuss with you as myself a nd a rl h-60 pilot want to create a series of campaigns that will actually teach someone how to fly the Huey by us army training syllabuses. BlackeyCole 20years usaf XP-11. Dcs 2.5OB Acer predator laptop/ i7 7720, 2.4ghz, 32 gb ddr4 ram, 500gb ssd,1tb hdd,nvidia 1080 8gb vram New FlightSim Blog at https://blackeysblog.wordpress.com. Go visit it and leave me feedback and or comments so I can make it better. A new post every Friday.
Frederf Posted April 1, 2018 Posted April 1, 2018 I don't know the answer but I would tackle this as a script which either does the thing the trigger was supposed to do directly or perhaps more likely use the lua to create the trigger and then the trigger operates as normal.
Grimes Posted April 1, 2018 Posted April 1, 2018 Ok, so the Install/Scripts/Export.lua will contain some of the documentation for what you will need to do. Essentially you will need to call a file from Saved Games/DCS/Scripts/Export.lua that runs your code. This is where tacview and simple radio get the information that allows them to function. Specifically I'd think LoSetCommand(arg, val) is the function to set a given cockpit value. Now its a question of figuring out what is what. I think you might be able to find the values in installs/mods/aircraft/Uh-1h/Cockpit/Scripts/clickableData.lua For example. elements["GOV-PTR"] = default_2_position_tumb(_("Governor Switch, EMER/AUTO") , devices.ENGINE_INTERFACE, device_commands.Button_14, 85) My best guess is that argument 85 corresponds with the governor switch. With a value of -1 or 1 will be on/off. This is a perfect example of me knowing the concept, but have 0 experience in actually messing with it. But at least it could help you get started. Also you'd probably want to have checks for if your own craft is a Huey and if a mission is named X. Because otherwise it could automatically flip those switches on any mission, including if starting in the air. Also it would try those arguments if you are flying anything else, and who knows how that might screw you up. :) The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Redglyph Posted April 1, 2018 Author Posted April 1, 2018 Ok, so the Install/Scripts/Export.lua will contain some of the documentation for what you will need to do. Essentially you will need to call a file from Saved Games/DCS/Scripts/Export.lua that runs your code. This is where tacview and simple radio get the information that allows them to function. Specifically I'd think LoSetCommand(arg, val) is the function to set a given cockpit value. Now its a question of figuring out what is what. I think you might be able to find the values in installs/mods/aircraft/Uh-1h/Cockpit/Scripts/clickableData.lua That'd be great! :) The alternative is having a lot of "arguments in range" predicates like in the mission below - a little tutorial for the MiG-21 I messed up with a few months ago, based on the real start-up procedures (haven't tried in 2.5, it might be broken). It's awkward because it requires a lot of those checks, and if you want to repeat some operations you can't copy/paste the conditions of one state to another. If it were in a script, it would just be the matter of calling a function several times. Pre-setting the cockpit would also be much easier, for ex. if one wants to preset the radio channel, it requires to send several rotate commands to the corresponding cockpit button with a pause in-between :/ I don't have much time to test those export functions right now, I hope they're visible from the mission scripts (a lot of things are hidden in that scope), it would be a good start!Mig21.Red.01.miz System specs: Win7 x64 | CPU: i7-4770K | RAM: 16 GB | GPU: GTX 980 Ti 6 GB | Thrustmaster HOTAS | MFG rudder pedals | SATA3 SSD | TrackIR
Recommended Posts