Bushmanni Posted December 28, 2012 Posted December 28, 2012 I made a script that gives you latitude and longitude in a neat format when you give it coordinates as Vec3. The outputted coordinates are strings. The output format is for example "+42 50.345" for northing and "+041 21.654" for easting. My main goal is to build a script that will read the coordinates out loud, this is just a preliminary tool to get the characters for the script. Here's an example on how to use the code. You need to load the LLtool.lua like you load MIST. There's no error checkings in the function so you need to give it proper data or it will bug you with an error message. I have attached an example mission using the code to get continuous LL coordinate updates for a flying helicopter. For a more useful purpose you would need to concatenate the coordinate strings into your own text. player = {} pos1 = {} player = Unit.getByName("shark") if player ~= nil then pos1 = player:getPosition() LLposNstring, LLposEstring = LLtool.LLstrings(pos1.p) trigger.action.outText('N ' .. LLposNstring .. ' E ' .. LLposEstring, 1) endLLtool.lua contents: LLtool = {} LLtool.LLstrings = function(pos) -- pos is a Vec3 local LLposN, LLposE = coord.LOtoLL(pos) local LLposfixN, LLposdegN = math.modf(LLposN) LLposdegN = LLposdegN * 60 local LLposdegN2, LLposdegN3 = math.modf(LLposdegN) LLposdegN3 = LLposdegN3 * 1000 local LLposfixE, LLposdegE = math.modf(LLposE) LLposdegE = LLposdegE * 60 local LLposdegE2, LLposdegE3 = math.modf(LLposdegE) LLposdegE3 = LLposdegE3 * 1000 local LLposNstring = string.format('%+.2i %.2i %.3d', LLposfixN, LLposdegN2, LLposdegN3) local LLposEstring = string.format('%+.3i %.2i %.3d', LLposfixE, LLposdegE2, LLposdegE3) return LLposNstring, LLposEstring end Speed and Grimes, if this code is of any worth feel free to use it for MIST. And maybe it would be time to create a sub forum for lua scripting in DCS? Few big threads containing all kinds of noise will make it hard to find the scripting advice you need or share scripts.LLtool.luaSSE test 3.mizLLcoordinates.lua DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community -------------------------------------------------- SF Squadron
chromium Posted December 28, 2012 Posted December 28, 2012 Many thanks, I was looking for something similar right now :). Can I use LLtool scripting in another script that I'm trying to build? (the very first one...) 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.
Bushmanni Posted December 28, 2012 Author Posted December 28, 2012 chromium: Go ahead as long as your creation is also free to use by everybody. I have a working alpha version of the coordinate reader up and running. Currently it will play the sound for everybody. I have a problem getting trigger.action.outSoundForCoalition to work. I suspect the problem lies in the arguments. Currently I have tried using (coalition.side[3], 'one.ogg'), (BLUE, 'one.ogg') and (3, 'one.ogg') as arguments but the result has been the same every time, no errors but no sound either. Can anyone help? In general what are you supposed to give as argument if the type is "enum sometable"? DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community -------------------------------------------------- SF Squadron
Druid_ Posted December 28, 2012 Posted December 28, 2012 coalition.side.BLUE if I remember rightly. Useful script btw. Nice to see more people using the SSE. i7-7700K : 16Gb DDR4 2800 Mhz : Asus Mobo : 2TB HDD : Intel 520 SSD 240gb : RTX 2080ti: Win10 64pro : Dx10 : TrackiR4 : TM Warthog : ASUS ROG SWIFT PG348Q
Grimes Posted December 28, 2012 Posted December 28, 2012 Note the preliminary change log: Scripting Engine: Fixed outText and outSound for Coalition and Group (its also fixed for Country) It should be fixed in the 1.2.3 patch. I've used the following code for testing. trigger.action.outSoundForCoalition(coalition.side.BLUE, 'CarHorn3.wav') Also the sound file has to be included into the .miz in order to work. 1 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
Bushmanni Posted December 29, 2012 Author Posted December 29, 2012 Druid and Grimes, thanks! Seems I got to work with what I got for now until 1.2.3 comes along. DCS Finland: Suomalainen DCS yhteisö -- Finnish DCS community -------------------------------------------------- SF Squadron
yallu Posted March 3, 2013 Posted March 3, 2013 Out of curiosity and slightly on topic... Is there a way to get the current MGRS grid with a script as well? Getting LL is great for purposes requiring precision but often rough location would be enough. Something like the 9-grid system (or whatever that is called in english). For example, take grid location GG39. City of Hamiskuri would be in location GG394. You take the grid and then imagine your numpad keyboard over the grid and therefore split it into 9 smaller grids. Number 4 on numpad therefore is the left center of the GG39 grid. Very intuitive and fast way to get rough locations without typing lots of numbers into flight computers. If you need to, you may futher revise, for example, GG3949 meaning left center of GG39, top right of that left center part. That is relatively accurate already. So the question really is, can you dig up the MGRS grid and does it have enough LL information (top-left, right-bottom etc.) to allow splitting it into 9 subgrids and perhaps those 9 subgrids to further 9 subgrids each? To get the outcome: "I'm on grid GG394" or "I'm on grid GG3949"... Just an idea...
Speed Posted March 6, 2013 Posted March 6, 2013 Out of curiosity and slightly on topic... Is there a way to get the current MGRS grid with a script as well? Yes, see here: http://en.wiki.eagle.ru/wiki/Simulator_Scripting_Engine/DCS:_World_1.2.1/Part_1#coord Mist version 2.0 will hopefully be out in a few days, it will include various coordinate display scripts. Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
Recommended Posts