Announcement

Collapse
No announcement yet.

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MIssion Scripting Tools (Mist)- enhancing mission scripting Lua

    Mission Scripting Tools
    Expanded Lua Scripting Library for mission scripting by Speed and Grimes

    What is it?
    MIssion Scripting Tools (Mist) is a collection of Lua functions and databases that is intended to be a supplement to the standard Lua functions included in the simulator scripting engine. Mist functions and databases provide ready-made solutions to many common scripting tasks and challenges, enabling easier scripting and saving mission scripters time. The table mist.flagFuncs contains a set of Lua functions (that are similar to Slmod functions) that do not require detailed Lua knowledge to use. However, the majority of Mist does require knowledge of the Lua language, and, if you are going to utilize these components of Mist, it is necessary that you read the Simulator Scripting Engine guide on the official ED wiki.

    Community Contributions
    The purpose of Mist is to provide a set of scripts for the DCS community, by the DCS community. We are open to people contributing their own scripts into Mist, but we reserve the right to edit your script in any way we see fit before “officially” including it into Mist. Also, feel free to contribute ideas as for what scripts to develop next.

    Usage Rights
    Feel free to modify or redistribute Mist in any way you see fit (even including it in paid content is OK by us), AS LONG AS you don’t try claim that our work is your own.

    How to use it?

    Mist is not a mod of the game files. You include it into your missions simply by using the DO SCRIPT or DO SCRIPT FILE trigger actions to load Mist at or near mission start.

    Mist Guide
    A full .pdf guide for Mist is included in the attached Mist v3_3.rar file. Additionally, documentation is available online here.

    Example DBs are also included.


    Current feature overview
    “Flag functions” – functions that can be used by persons with very little Lua knowledge. Functionally similar to many Slmod functions, these set a flag to true when they detect a certain game condition.
    Spoiler:

    mist.flagFunc.mapobjs_dead_zones
    mist.flagFunc.mapobjs_dead_polygon
    mist.flagFunc.units_in_zones
    mist.flagFunc.units_in_moving_zones
    mist.flagFunc.units_in_polygon
    mist.flagFunc.units_LOS


    “Scripting functions”- intended to be used within a larger Lua script. These require knowledge of the Lua language to use.
    Spoiler:

    General
    mist.scheduleFunction
    mist.removeFunction
    mist.addEventHandler
    mist.removeEventHandler
    mist.getGroupPoints
    mist.getUnitsInZones
    mist.getUnitsInMovingZones
    mist.pointInPolygon
    mist.getDeadMapObjsInZones
    mist.getDeadMapObjsInPolygonZone
    mist.getUnitsLOS
    mist.getNorthCorrection
    mist.getHeading
    mist.getPitch
    mist.getRoll
    mist.getYaw
    mist.getAoA
    mist.getClimbAngle
    mist.getAttitude

    Utilities
    mist.utils.makeVec2
    mist.utils.makeVec3
    mist.utils.toDegree
    mist.utils.toRadian
    mist.utils.deepCopy
    mist.utils.round
    mist.utils.dostring
    mist.utils.basicSerialize
    mist.utils.serialize
    mist.utils.serializeWithCycles
    mist.utils.oneLineSerialize
    mist.utils.tableShow

    Debug
    mist.debug.dump_G
    mist.debug.writeData
    mist.debug.dumpDBs

    Vector Operations in Vec3
    mist.vec.add
    mist.vec.sub
    mist.vec.scalar_mult
    mist.vec.dp
    mist.vec.cp
    mist.vec.mag

    Demos
    mist.demos.printFlightData


    Databases- databases built for easier mission scripting. (Example DBs included with Mist v3_3.rar file).
    Spoiler:

    STATIC DBs
    Unit DBs
    mist.DBs.units
    mist.DBs.unitsByName
    mist.DBs.unitsById
    mist.DBs.unitsByCat
    mist.DBs.unitsByNum

    Group DBs
    mist.DBs.groupsByName
    mist.DBs.groupsById


    Zone DBs
    mist.DBs.zonesByName
    mist.DBs.zonesByNum

    Human-controllable unit DBs
    mist.DBs.humansByName
    mist.DBs.humansById

    Misc. static DBs
    mist.DBs.navPoints
    mist.DBs.missionData

    REAL-TIME DBs
    mist.DBs.aliveUnits
    mist.DBs.deadObjects

    DOWNLOAD LATEST VERSION HERE
    Last edited 01-31-2018, 08:58 AM. Reason: updated mist link and removed old mist version
    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.

    #2
    Reserved
    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.

    Comment


      #3
      V4+ must be used for DCS 1.5 or higher.

      MIST on Github for latest release
      Mist 4.1 Download and info Posthttp://forums.eagle.ru/showpost.php?...&postcount=910
      Mist Online Documentation: http://wiki.hoggit.us/view/Mission_S..._Documentation
      Some great references for LUA in general:
      http://www.lua.org/pil/
      http://lua-users.org/wiki/TutorialDirectory
      http://lua-users.org/wiki/SampleCode

      Also feel free to make suggestions for features you might want to see added.
      Last edited 01-11-2016, 11:05 AM. Reason: 4.0 release
      The right man in the wrong place makes all the difference in the world.
      Current Projects: Scripting Wiki, Something...
      Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD, IADScript, Mission Editing Wiki!, Mission Building Forum

      Comment


        #4
        Thanks. This is the mut's nuts

        Comment


          #5
          speed what is the difference between mist.flagfunc.units_in_moving_zone and the function in SLmod. Looks the same.
          I was in Art of the Kill D#@ it!!!!

          Comment


            #6
            They are basically the same. However the key difference is that Slmod functions require slmod to be installed. Mist is added to the mission file itself and therefore DOESN'T require the end user to install a mod in order for the function to work.
            The right man in the wrong place makes all the difference in the world.
            Current Projects: Scripting Wiki, Something...
            Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD, IADScript, Mission Editing Wiki!, Mission Building Forum

            Comment


              #7
              Originally posted by Grimes View Post
              They are basically the same. However the key difference is that Slmod functions require slmod to be installed. Mist is added to the mission file itself and therefore DOESN'T require the end user to install a mod in order for the function to work.
              Ahhh thats awesome. Now it makes the mission more modular and transportable and still get the benefits of slmod... Nice!!!!!! I also like the ability to create zones that arent just circular.
              I was in Art of the Kill D#@ it!!!!

              Comment


                #8
                New Toys but i haven`t manage the old ones....!
                Waiting for:DCS: Mi-24 Hind, ...
                Intel i5-7600K @4.1GHz, 32GB DDR4 @2400MHz, GTX 1070 Gigabyte Gaming OC 8GB DDR5, WIN 10 64Bit Prof.


                Squadron "Serious Uglies"
                sigpic
                Ghost0815

                Comment


                  #9
                  Thanks guys

                  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.

                  Comment


                    #10
                    PS: seems the attachment doesn't exist now

                    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.

                    Comment


                      #11
                      ATTENTION:

                      There was a major problem with Mist v1_0. The mist.addEventHandler function was broken. You know how they always say "if it ain't broke don't fix it"? Well, yea... maybe I should have listened Anyway that also broke the mist.DBs.deadObjects database, preventing it from being populated.

                      I've already updated the Mist post to include Mistv1_1, which fixes these problems (never thought we'd see version 1.1 so early...). The only change is the fixing of mist.addEventHandler (and mist.DBs.deadObjects).
                      Last edited 12-05-2012, 08:40 AM.
                      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.

                      Comment


                        #12
                        Here's the mist.demos.printFlightData function applied to weapons fired. For example, load the attached mission "Mist Weapon Flight Data.miz", select an F-15, and fire an AMRAAM- the mist.demos.printFlightData will output real-time flight data for the weapon:


                        When applied to player aircraft, there's still some shakiness in the acceleration-based values that I need to sort out, but angular data and velocity works very well- "Mist Player Flight Data.miz" is mist.demos.printFlightData applied to the player aircraft.

                        mist.demos.printFlightData isn't really useful for mission scripting, that's why we put it in the "demos" table- it demonstrates some of the power of the Simulator Scripting Engine for collecting data about the game environment. You can embed Tacview-like data collecting into your mission itself, base mission logic off of it if you want, and if you "unsanitize" the io and lfs libraries in MissionScripting.lua, then you can even output your data to a file and graph it using like Excel or something.
                        Attached Files
                        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.

                        Comment


                          #13
                          To use those script, can I:

                          1) execute by Triggered actions - command - run script action? + trigger with AI TASK action

                          2) load a .lua file instead of "run script" text?

                          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.

                          Comment


                            #14
                            Originally posted by chromium View Post
                            To use those script, can I:

                            1) execute by Triggered actions - command - run script action? + trigger with AI TASK action

                            2) load a .lua file instead of "run script" text?
                            Yes

                            Yes

                            Anywhere the mission editor lets you put Lua, that Lua will run in the global environment, where it will "see" Mist.
                            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.

                            Comment


                              #15
                              ok the last questions (than I will leave you at work ):

                              How do I load a function by file? I have to copy & paste (notepad ++) the function text in a new .lua file named as I want (es. functionLOS.lua)?

                              If I have to send the mission to other people, do this loaded file will be stored in the .miz archive? Or I have to send also the .lua files to be loaded?

                              thanks a lot

                              (as usual I'm keeping group names between consecutive mission and scenarios, so I need to reduce at most the "porting" workload to save time and prevent errors)


                              ------------------------------------------------------

                              PS: Speed, Grimes, would you like to see a "script wish list thread" to let the mission builder to tell you what functions could be intersting to be added?
                              Last edited 12-05-2012, 10:32 AM.

                              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.

                              Comment


                                #16
                                Originally posted by chromium View Post
                                ok the last question (than I will leave you at work ):

                                How do I load a function by file? I have to copy & paste (notepad ++) the function text in a new .lua file named as I want (es. functionLOS.lua)?
                                Yes, this is part of why I prefer using DO SCRIPT instead of DO SCRIPT FILE. Also, you're probably aware of the rare "crap, my mission lost all its attachments" bug. DO SCRIPT FILE may also be affected by this bug; DO SCRIPT is immune to it. So yea, I like using DO SCRIPT instead. However, Grimes often prefers using DO SCRIPT FILE... to each his own, I guess.

                                If I have to send the mission to other people, do this loaded file will be stored in the .miz archive? Or I have to send also the .lua files to be loaded?

                                thanks a lot
                                Yes, the Lua file is included in the zipped .miz archive, just like any sounds or pictures your mission might also use.
                                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.

                                Comment


                                  #17
                                  Perfect... ehm... to be onest I'm not aware of that attachment problems, but I'll find my way using it .

                                  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.

                                  Comment


                                    #18
                                    The attachment problem often happened to me when I saved the mission withou actually changing anything within it. You know, you alt tab out for a long time, then alt tab back in and you're not sure whether you saved the mission or not. So you just save it one more time. That's when I lost my files within the mission.

                                    I believe it is enough to move a unit a little bit to make the mission "changed".

                                    Speed, have you gotten this bug WITHOUT not having changed it between saves?
                                    sigpic
                                    System specs:
                                    Spoiler:
                                    2500k @ 4.6 GHz
                                    8GB RAM
                                    HD7950 OC'd
                                    Win7 x64
                                    Posting tracks to make your DCS better - attention bump incoming!

                                    Comment


                                      #19
                                      Originally posted by Megagoth1702 View Post
                                      You know, you alt tab out for a long time, then alt tab back in and you're not sure whether you saved the mission or not. So you just save it one more time. That's when I lost my files within the mission.
                                      sounds like the story of my editing life: I suffer a compulsive "PRESS SAVE BUTTON" syndrome. I'll definitely go thrugh the DO SCRIPT if it's like you told.

                                      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.

                                      Comment


                                        #20
                                        Awesome, no SLmod but pretty much the same functions, haha.

                                        Speed, looking at the mist manual I can not find anything like "unitsFiring", that sets a flag to true once a unit has fired something. Am I overlooking something?

                                        Thanks.
                                        sigpic
                                        System specs:
                                        Spoiler:
                                        2500k @ 4.6 GHz
                                        8GB RAM
                                        HD7950 OC'd
                                        Win7 x64
                                        Posting tracks to make your DCS better - attention bump incoming!

                                        Comment

                                        Working...
                                        X