Lineaxe Posted July 26, 2020 Posted July 26, 2020 Hi, I really would like to get access to OS:time and only this OS:feature at the moment. I am thinking I can just write some C code to do the call to OS:time and then integrate that with the rest of my lua code. Otherwise I am having to comment out the following line in the Scripts/ MissionScripting.lua file -- sanitizeModule('os') I will post this in the Wishlist area and post links to it in a couple of other forums as well (I think) :chair:
Olddog Posted July 28, 2020 Posted July 28, 2020 Maybe something like this will work for you. starting a about 1:00
Lineaxe Posted July 28, 2020 Author Posted July 28, 2020 (edited) Hi , I went over that video. It has a lot of good information in it. Well, I have only coded in Lua for about 3 months now, and all of it related to DCS . While google searching , I found that people were communicating between c and Lua . (C++ as well , but with way more libs needed it seems). So I thought that might be a good approach. I haven't really played around with installing custom campaigns yet ,such as described in the video you suggested. IT seems ,in the video he is changing over the names of io & lfs to some test ones that he then refers to in his example campaign's lua files. I think I like this approach , it does make it safer than having the comment out lines in MissionScripting.lua . However, MissionScripting gets rewritten every time they do a patch upgrade , any modifications at all to it will be lost until you write the new copy over. With a c to lua interface I can call the c code's functions anytime I need inside of lua and get the results I need without having to keep on having to copy over the MissionScripting.lua file every time there is a patch upgrade,(which seems to be quite often). Now with DCS, Is it possible to interface c to Lua code. Are people doing it here, as they are in other lua environments? A better overall option , I think , would have DCS to allow those who write up the mission an option to copy their NEW missionScripting.lua file over automatically. Not manually , every time .. Edited July 28, 2020 by Lineaxe
chromium Posted July 28, 2020 Posted July 28, 2020 You can use the DCS API, instructions are in the main DCS folder, \API subfolder. i.e. (please do the necessary backup first ;) ): if you place the attached file in your Saved Games\DCS.(whateverversion)\Scripts\Hooks folder, it will automatically desanitize missionscripting.lua at any DCS start, even after updates. It will search and comment the target lines, so if it's a modified missionscritping.lua due to other mods, it shouldn't affect them. PS: io, lfs, os, and other functions locked in the mission lua environment are available in the hooks (plugin, server, call what you like) environement.desanitizer_hooks.lua Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Lineaxe Posted July 30, 2020 Author Posted July 30, 2020 Heh, gotta admit I like that so much I thought I would just reformat all the info you gave me back into the lua file so everyone can just grab it and use it with it's instructions. :blink:desanitizer_hooks.lua 1
chromium Posted July 30, 2020 Posted July 30, 2020 As you want :). I didn't done that before cause desanitization is anyway something delicate cause: it's a bypass of ED safety check done for the sake of the customer. Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Lineaxe Posted July 30, 2020 Author Posted July 30, 2020 Hmm, what I am using it for , I am thinking should actually be patched in thru C# (into the XNA code) for DCS as it makes DCS even better than it is.
chromium Posted July 30, 2020 Posted July 30, 2020 I don't know C, I'm not a programmer, so... I don't understand what you mean :) Author of DSMC, mod to enable scenario persistency and save updated miz file Stable version & site: https://dsmcfordcs.wordpress.com/ Openbeta: https://github.com/Chromium18/DSMC The thing is, helicopters are different from planes. An airplane by it's nature wants to fly, and if not interfered with too strongly by unusual events or by a deliberately incompetent pilot, it will fly. A helicopter does not want to fly. It is maintained in the air by a variety of forces in opposition to each other, and if there is any disturbance in this delicate balance the helicopter stops flying; immediately and disastrously.
Lineaxe Posted May 30, 2021 Author Posted May 30, 2021 Going back over this thread . It turns out, as many here know , the DCS core engine is written in C++ . Anyhow, I would be happy to code something in C++ that would just access the clock info only. Having ReadOnly info from it available would not compromise the existing code I am sure & would even be advantageous. Heh, I know that I would use it right off the bat with my lua code .
Recommended Posts