Jump to content

timothyboss

Members
  • Posts

    83
  • Joined

  • Last visited

Everything posted by timothyboss

  1. Sharing a mission as a static template will cause the supplied data to change if another user imports the stm file in their mission. In the static template the STN should be 67201, 67202 and the Callsign should be RD11, RD12 etc. When another user adds it to their mission the STN defaults to 0J.... and the callsign reverts to ED11 or PC11 or HK11 etc. Is this normal behavior? VFA-97 Ridgid 4 ODS M06 Template Rev 2.stm
  2. Can you maybe allow it integrate realtime uploading of people's export.lua file for realtime unit display on embedded websites or is that not an ability without an API service? Is there a coordinate only export in the form of excel or parsed text? Thanks for your work and time.
  3. It is only for Google Sheets.
  4. Made some updates. On the site one can upload a KML file to the map. In the sheet one can get, via the exports, a file for TheWay. One can download their flight via a KML too.
  5. @Dangerzone @cfrag what are your thoughts on the Export.lua making a call to a file that loads the two independently. So for the FlightPlanner Lua I would have a LuaExportStart () start the server, start to write directory. Perform the task to export and end. Start the write of the second Lua latlongelev.lua and just perform the script. No need for the second script to start at the LuaExportStart (). Once complete with the second Lua... Repeat until the game ends and then I can luaExportStop ().
  6. Maybe using the hooks is the way to go? This is not the first time this issues has been brought up either. There are some good talks across a couple forums of this same issue. People get creating by refining global variables that end up calling on the LuaExportStart () / stop / before frame / after frame / next event. I just need to get smarter on that part.
  7. I'd find myself running into this problem 2 years later. I have two Lua files that both use the LuaExportStart()/...Stop()/...NextEvent(). Both are listed in the Export.lua file located in the Scripts folder. Individually both files work great, but the minute I try to use both together in the Export.lua.... forget it. One steps on the other or vise versa based on the order they are placed in the Export.lua file. Maybe hooks is my solution? One Lua script starts and writes to a folder that is sent off by a server using node.js and the other Lua script just writes locally and both are almost identical with the same functions use within but the file is named differently. I cannot change the function name but maybe can have if, then conditions so they do not step on one another?
  8. I have a suspicion it is probably overwriting the other because of how the scripts were written at one test point. The first (of two) dofile Lua's I am having issues with called the luaexportactivitynextevent() function and the second Lua actually performed the write to the location which confused me. But the second Lua exportnextevent was renamed something else, so I feel there might need to be a pause or delay in the dofile if possible. Maybe have a dofile that performs 1 script and then ends then performs the second then ends. Maybe like a subroutine?
  9. Good question. I don't even see it reporting in the DCS.log file. I might need to print to. Should, normally, the Lua start / stop / exportActiveNextEvent function regardless if other scripts call the same functions?
  10. @Dangerzone is that what you meant. Above post.
  11. I'm thinking that maybe for this project... If I have to start or stop or pause and wait with if statements in the exporting of the same or similar data, then I might just try to build a master export Lua that writes to multiple locations in the format I need for both separate projects. I should be able to set a global variable that starts say named function script1() and runs through the code in latlongelev.lua and then end with a continuation to function script2() run FlightPlannerGPS.lua end and then 30 seconds later repeat. That way both files should be written, and ended so the other can be written and ended without being stepped on. I will just have to start the server for node.js outside in a new global variable, remove the loops inside the independent Lua scripts so they complete and I should be good. When the game closes, the server closes and the problem should be solved? Maybe? Thoughts. If only DCS Lua environ would allow multiple calls of the LuaExportActivityNextEvent () by affixing a 1,2,3.... To the end. Or I just need to get better... The later.
  12. Hello and thanks for your reply. you are correct in that the two files called by the export.lua are in fact "FlightPlannerlfs" and "multiExportGSlfs" and the "w" to "a" did nothing as the ..'Scripts/FlightPlanner/FlightPlanner.lua') is being blocked by ..'Scripts/multiExportGS/latlongelev.lua'). Im still at it, but a good head scratcher. seems like I need to call on them separately, but having a heck of a time defining that process. That is correct. I wan them to both be independent of one another an each run at a set time after executed. they can be staggered, but I am going to attempt to go with your approach and see the outcome. thank you for your input. I let all know of the findings.
  13. in case I still have followers in this post. I did not have much luck in the previous posting so I instead used some info from the export and knowledge of units to have excel functions lookup and such. anyhow thank you all for your inputs. I do have a second question if anyone might have the answer (I will continue to search the forum too) I have the Export.lua script in my saved games with the following call outs. local wwtlfs=require('lfs');dofile(wwtlfs.writedir()..'Scripts/wwt/wwtExport.lua') local FlightPlannerlfs = require('lfs');dofile(FlightPlannerlfs.writedir()..'Scripts/FlightPlanner/FlightPlanner.lua') local multiExportGSlfs=require('lfs');dofile(multiExportGSlfs.writedir()..'Scripts/multiExportGS/latlongelev.lua') dofile(lfs.writedir()..[[Scripts\DCS-BIOS\BIOS.lua]]) local Tacviewlfs=require('lfs');dofile(Tacviewlfs.writedir()..'Scripts/TacviewGameExport.lua') local TheWayLfs=require('lfs');dofile(TheWayLfs.writedir()..'Scripts/TheWay.lua') pcall(function() local dcsSr=require('lfs');dofile(dcsSr.writedir()..[[Mods\Services\DCS-SRS\Scripts\DCS-SimpleRadioStandalone.lua]]); end,nil) Now my problem is that these two keep stepping on one another meaning which ever is in the bottom wins and thats is the lua that provides the output file. when I swap these two around then the one on the bottom wins etc. and writes. local FlightPlannerlfs = require('lfs');dofile(FlightPlannerlfs.writedir()..'Scripts/FlightPlanner/FlightPlanner.lua') local multiExportGSlfs=require('lfs');dofile(multiExportGSlfs.writedir()..'Scripts/multiExportGS/latlongelev.lua') so what are the two lua scripts it calls? see below, in order of the above post. function LuaExportStart() -- create file object for writing d_output_file = io.open(lfs.writedir().."/Scripts/FlightPlanner/data.json", "w") -- get the start time start_time = os.clock() end function LuaExportStop() -- close the file object if d_output_file then d_output_file:close() d_output_file = nil end -- delete the data.json file os.remove(lfs.writedir().."/Scripts/FlightPlanner/data.json") end function LuaExportActivityNextEvent(t) local currentTime = LoGetModelTime() if not lastExportTime or (currentTime - lastExportTime) >= 30.0 then lastExportTime = currentTime local o = LoGetWorldObjects() -- delete the data.json file before writing to it os.remove(lfs.writedir().."/Scripts/FlightPlanner/data.json") -- create file object for writing d_output_file = io.open(lfs.writedir().."/Scripts/FlightPlanner/data.json", "w") for k,v in pairs(o) do d_output_file:write(string.format("%.1f,%s,%f,%f,%.1f,%.1f,%s\n", t, v.Name, v.LatLongAlt.Lat, v.LatLongAlt.Long, 3.28084*v.LatLongAlt.Alt, 57.2958*v.Heading, v.Coalition)) end -- close the file object if d_output_file then d_output_file:close() d_output_file = nil end end end and function startServer() local folderPath = "E:/Saved Games/DCS.openbeta/Scripts/multiExportGS" -- Replace this with the desired folder location local command = 'start "" powershell.exe -noexit -command "cd \'' .. folderPath .. '\'; node import.js"' -- Concatenate the command to change directory and start the server os.execute(command) -- Execute the command in the system shell end function LuaExportStart() -- create file object for writing default_output_file = io.open(lfs.writedir().."/Scripts/multiExportGS/FltPlannerGPS.log", "w") -- get the start time start_time = os.clock() -- Start the server upon LuaExportStart() startServer() end function LuaExportStop() -- close the file object if default_output_file then default_output_file:close() default_output_file = nil end -- delete the Export.log file os.remove(lfs.writedir().."/Scripts/multiExportGS/FltPlannerGPS.log") -- Close the server upon LuaExportStop() if os.getenv("OS") == "Windows_NT" then os.execute("taskkill /IM node.exe /F") -- Terminate the node.exe process os.execute("taskkill /IM powershell.exe /F") -- Terminate the PowerShell process else os.execute("pkill node") -- Terminate the node process on Unix-like systems os.execute("pkill powershell") -- Terminate the PowerShell process on Unix-like systems end end function LuaExportActivityNextEvent(t) local currentTime = LoGetModelTime() if not lastExportTime or (currentTime - lastExportTime) >= 30.0 then lastExportTime = currentTime local o = LoGetWorldObjects() for k,v in pairs(o) do default_output_file:write(string.format("%.1f,%s,%f,%f,%.1f,%.1f,%s\n", t, v.Name, v.LatLongAlt.Lat, v.LatLongAlt.Long, 3.28084*v.LatLongAlt.Alt, 57.2958*v.Heading, v.Coalition)) end end end I suspect my problem is related to multiple calls to the same function at the same time, but I cannot wrap my head around it. I am suspecting the function: function LuaExportActivityNextEvent(t) is causing the binding or overwritten or stepping on issue. Does anyone know how I might be able to run these two lua scripts separately and independent of one another while both performing as they are intended to function? Thanks in advance.
  14. I haven't had much luck. I have a work around. Get the name of the unit and just use a lookup function to compare and if criteria is met...it's a SHIP, HELICOPTER etc. A little more work, but that's ok. Thanks for your help.
  15. with ground being catchall at the end I was hoping it would at least generate something, it did where the v.Type did not, but its not the right thing. looking at the documentation i need to use something like getCategory or maybe getDesc and try to have that pull a class of the item from a table somewhere.
  16. Hello cfrag. Thanks for the reply. I have been trying to get v.Type to output data but then the entire export.log is blank and nothing is written to it. The output right now is "time, name of unit (i.e. F-18C_Hornet), Lat, Long, Altitude, Heading, enemy or allied" lastly I am trying to determine if it is a ship, ground, airplane or helicopter, but with v.Type the output fails to write anything to my .log file.
  17. Hello All. I have been working on a project to get items to export from DCS world using the local o = LoGetWorldObjects() and having great success for the most part. What I have been wrapping my head around is to get exported is also the unit type> AIRPLANE, SHIP, GROUND, HELICOPTER. to also be identified and exported. Below is the lua that I have been using with all working well except when I try to get the unitType or Group. Now I see 'group' might quantify the total number of each and I am searching for each line of my CSV Export.log file to also include HELICOPTER or AIRPLANE, etc. Please see lua. --This Export.lua illustrates how to export multiple data in 30 second intervals lat/long and flight alt etc. function LuaExportStart() -- create file object for writing default_output_file = io.open(lfs.writedir().."/Scripts/multiExportGS/Export.log", "w") end function LuaExportBeforeNextFrame() end function LuaExportAfterNextFrame() end function LuaExportStop() if default_output_file then default_output_file:close() default_output_file = nil end -- delete the Export.log file os.remove(lfs.writedir().."/Scripts/multiExportGS/Export.log") end function LuaExportActivityNextEvent(t) local tNext = t local o = LoGetWorldObjects() for k,v in pairs(o) do default_output_file:write(string.format("%.1f, %s, %f, %f, %f, %f, %s, %.1f\n", t, v.Name, v.LatLongAlt.Lat, v.LatLongAlt.Long, 3.28084*v.LatLongAlt.Alt, 57.2958*v.Heading, v.Coalition)) end tNext = tNext + 30.0 return tNext end tNext = tNext + 30.0 return tNext // I have tried to use a v.Type with no success. I have tried making some statements like this function LuaExportActivityNextEvent(t) local tNext = t local o = LoGetWorldObjects() for k,v in pairs(o) do print(v.Type) -- add this line for debugging purposes local objectType = "unknown" if v.Type == "Ship" then objectType = "ship" elseif v.Type == "Helicopter" then objectType = "helicopter" elseif v.Type == "Airplane" then objectType = "airplane" else objectType = "ground" end default_output_file:write(string.format("%.1f, %s, %f, %f, %f, %f, %s, %s\n", t, v.Name, v.LatLongAlt.Lat, v.LatLongAlt.Long, 3.28084*v.LatLongAlt.Alt, 57.2958*v.Heading, v.Coalition, objectType)) end tNext = tNext + 30.0 return tNext end and the only thing that is output is 'ground' as it is not finding the type correctly. Anyone have any ideas how i might be able to locate the level number or an ID 1,2,3,4 and I know what it is easily? Any help is greatly appreciated.
  18. I think what the question was regarding is not all the map itself, but use DCS-Bios to collect all objects on the map, export relevant data to be parsed (aircraft, vehicle, ship, missile etc) altitude, heading, speed and then have that parsed data besaved as a JSON. Use that JSON data in conjunction with a Google Map as a JSON overlay with custom markers. I am new at the DCS-BIOS, but I am taking a shot at doing just that. Pull relevant data from the server I fly on, parse the data and store it at a JSON for my HTML site to pull from with a built in trigger to refresh every so often. This will just be a standalone for me when I fly, but my goal is to have it maybe running on Google cloud in the free tier while collecting constant data and posting to a map for a virtual air wing that I fly with.
  19. I have a larger planning tool I use on my site, but wanted to try out the down and dirty of AI. Well here the question went and results are in attached zip as well.: (so long as the user makes a couple flights virtually any platform can use the resulting numbers to build a quick fuel calculator) Resulting script: <!DOCTYPE html> <html> <head> <title>Interpolate and compute fuel consumption</title> </head> <body> <h1>F/A-18C Fuel Calculator</h1> <p>Enter the weight, distance, altitude, and drag:</p> <form> <label for="weight">Weight (lbs):</label> <input type="number" id="weight" name="weight"><br> <label for="distance">Distance (NM):</label> <input type="number" id="distance" name="distance"><br> <label for="altitude">Altitude (ft):</label> <input type="number" id="altitude" name="altitude"><br> <label for="drag">Drag (units):</label> <input type="number" id="drag" name="drag"><br> <button type="button" onclick="computeFuelConsumption()">Compute fuel consumption</button> </form> <p id="result"></p> <script> // Define the input data const weights = [26000, 52000]; const drags = [0, 315]; const altitudes = [0, 45000]; // Interpolate lb/NM based on weight and altitude function interpolate(x, x0, x1, y0, y1) { const t = (x - x0) / (x1 - x0); const a = y1 - y0; return y0 + a * (t * t * (3 - 2 * t)); } // Compute fuel consumption in lb/NM based on weight, distance, altitude, and drag function fuelConsumption(weight, distance, altitude, drag) { // Limit the weight, distance, altitude, and drag to their respective min/max values weight = Math.max(Math.min(weight, weights[1]), weights[0]); altitude = Math.max(Math.min(altitude, altitudes[1]), altitudes[0]); drag = Math.max(Math.min(drag, drags[1]), drags[0]); // Interpolate lb/NM based on weight and altitude const lbnm = interpolate(weight, weights[0], weights[1], 13, 16) - interpolate(altitude, altitudes[0], altitudes[1], 0, 9); // Interpolate drag value in lb/NM based on drag const drag_lbnm = interpolate(drag, drags[0], drags[1], 0, 13); // Compute fuel consumption in lb const fuel = lbnm + drag_lbnm; return (fuel * distance).toFixed(2); // Round to 2 decimal places } // Define a function to handle the button click function computeFuelConsumption() { // Get the input values const weight = parseInt(document.getElementById("weight").value); const distance = parseInt(document.getElementById("distance").value); const altitude = parseInt(document.getElementById("altitude").value); const drag = parseInt(document.getElementById("drag").value); // Compute the fuel consumption const fuel = fuelConsumption(weight, distance, altitude, drag); // Set the result text document.getElementById("result").textContent = `Fuel consumption: ${fuel} lb`; } </script> </body> </html> FA-18C Fuel Calculator.zip
      • 3
      • Like
  20. Check out something I have created for this exact issue. (link below) There is nothing out there for good fuel planning so I made something over the last couple years. Make a copy of your own and use it for fuel planning. It is always a work in progress to continuously improve from users input, but I recently overhauled the fuel consumption by taking an ungodly amount of flights at different weights, drag indexes and altitudes. I did notice that the LB/NM on the FPAS page is not accurate (about 2-4 lb/nm low on average) and that the fuels weight changes with temperature (which is nice) but is backwards. On a cold day the fuel should weigh more, not less. see for yourself sometime. https://sites.google.com/view/fa-18c-flight-planner/home
  21. I took many flights to record and understand the fuel burn rate in the Hornet for mission planning and I noticed 2 things. FIRST: The Hornet 'FPAS Page' LB/NM is not accurate with actual fuel burned: To validate: Make a standard mission in editor with 15C air temp AGL 15 air start for ease. low drag loadout (centerline only) and 50% fuel capacity. Get airborne, straight and level flying FPAS recommended. Record fuel at start of flight, fly FPAS for 50NM record fuel at end of flight. Also take note of the LB/NM, you will need this. Calculation 1:: Total fuel at start of 50nm flight minus remaining = total fuel burned. Calculation 2: 50NM * LB/NM (FPAS Page)= total fuel burned. Calculation 1 will not be the same as calculation 2. The actual burn rate is on average 2-4 lbs/NM more than what is displayed on FPAS. SECOND: Fuel weight changes based on temperature, but backwards: To Validate: Make a mission with a Hornet on ground, centerline, max fuel to remove variables keep volume constant. (Density of fuel at -12.4C = 6.94 / 0C = 6.74 / 40C = 6.09) Set mission editor temperature to 15C and result is weight of fuel in hornet is 13,047lbs in DCS. This is close to 6.74 * 1919 gal = 12,934 lbs. Set mission editor temperature to max (40C) and result is weight of fuel in Hornet is higher than 13,047 lbs. But Real World is 6.09 * 1919 = 11,686 lbs. Why is the hornet more when it should be less. Set mission editor temperature to min (-12.4C) and result is weight of fuel in Hornet is lower than 13,047 lbs. But Real World is 6.94 * 1919 = 13,317 lbs. Why is the Hornet Less when it should be more. The Hornets fuel poundage is changing with respect to volume changes when it should change with respect to density changes. The volume is constant! The only variable is temperature which we can control. Hopefully one day ED will acknowledge.....
  22. Take a look at my sheet. It can be located from my site. Take a copy. Take the data. The data sheets are hidden, just unhide. All weights/drags/ factors are included. Take what you need. https://sites.google.com/view/fa-18c-flight-planner/home I have interpolated the values in the 'MACH AND FUEL DATA' sheet. This is raw data from many flights in the hornet at different weights, drag indexes, altitude, temperatures (did not effect) and winds(very little effect). The values did required some factoring as the fuel page did not accurately display the LB/NM with accuracy. Also note when fuel planning that in-game temperature changes in mission editor changes the weight of the fuel of the aircraft in reverse from real world meaning: The F18 has a fixed volume fuel capacity. Colder fuel is more dense than warm fuel. Colder temps should have a higher weight displayed in jet but does not. Its backwards in DCS, for now, so keep that in mind when fuel planning. Hopefully ED will acknowledge it.
  23. Check out the revised planner. Has a new look. Has built in scripts to print kneeboards to PDF and also exports a JSON file for use with DCS waypoint editor by Santi871. https://sites.google.com/d/1-xhxW7vvzMLRtBhevAQxKRkAbd_OnjjY/edit Follow the instructions on the download page. Many coordinate entry types available. I overhauled the fuel consumption based on DCS flights. I steered away from RW calculations and weather factors a bit as DCS apparently does not have temperature built into the core game to effect flight. Fuel quantity ∆ is proportional with in game temp ∆. (Reversed from RW conditions, but mimics DCS for proper fuel qty.)
  24. That would be nice. Not sure if you tried, but set total fuel about 2300 lbs low Per tank you have loaded out. Immediately following startup set WING or CTR to override. This will cause the tank(s) selected to fill internals while on the ground leaving you with empty externals prior to departure. But yes, should be a wishlist item!!!
  25. Yup +1 just give us the trigger back.
×
×
  • Create New...