Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

Hey Grimes,

 

Is in 2.0 A the MIST function mist.dynAddStatic working?

 

I use the following table: (parameters are defined in other tables)

 

missionwreckagedatatable[#missionwreckagedatatable + 1]= 
                                   {
                                       country = "RUSSIA",
                                       category = tableofwreckage[tableofwreckageindex].category,
                                       x = actualwreckageunitpos.x,
                                       y = actualwreckageunitpos.z,
                                       type = tableofwreckage[tableofwreckageindex].type_,
                                       dead = true,
                                   }
mist.dynAddStatic(actualwreckagedata)

But it does not spawn in dead static, but intact ones. Is that part of the alpha or am I doing something wrong? Intention is to place dead units.


Edited by SNAFU

[sIGPIC][/sIGPIC]

 

Unsere Facebook-Seite

Link to comment
Share on other sites

  • 3 weeks later...

Hey Grimes!

 

I just forked the MIST development branch on github and I'm in the progress of making it use some code styling guidelines or at least be coherant (function declaration syntax, function names always in CamelCase) as well as adding LDoc comments to all functions for a easy generation of API documentation. I'm also adding a logger which should allow faster debugging by supporting log levels and easy shorthands.

 

If you want to checkout the progress here is the repo.


Edited by lukrop
Link to comment
Share on other sites

There is info on every thing but where to install it.

 

You don't install it as such but instead add a mission start trigger to your mission in the editor and select the action be a DO SCRIPT FILE and then click open to browse in the usual windows dialog sort of fashion to where you saved the mist lua file, select it and click ok in the dialog box. What happens behind the scenes is that when you save the mission a copy of the mist lua file is embedded in the mission file for the mission to use. That way the whole thing is encapsulated and avoids users having to download scripts to get the mission to work. I think it does tell you in the user guide pdf but aren't 100% sure on that. FYI It also does mean that you need to delete the action with the script file, save the mission and then re-add it if you are upgrading a script to a later version in an existing mission. This is because the script embedded in the mission is a separate copy of the actual lua file.


Edited by Stonehouse
Link to comment
Share on other sites

Hi, I have just found out I am having problem doing my very first respawn script.

In this entry at the very end of DCS.log, it may seem I have done something wrong with script, because soon after this entry server crashed...?

What I am trying to do is use Trigger SWITCHED CONDITION to respawn dead group from very beginning of its flight plan - cold ramp start (AWACS - 1 aircraft in flight plan).

 

65943.032 ERROR DCS: Mission script error: : [string "C:\Users\USDedi\AppData\Local\Temp\DCS\/~mis0000092C"]:3612: attempt to index field '?' (a nil value)

stack traceback:

[C]: ?

[string "C:\Users\USDedi\AppData\Local\Temp\DCS\/~mis0000092C"]:3612: in function 'getGroupRoute'

[string "C:\Users\USDedi\AppData\Local\Temp\DCS\/~mis0000092C"]:5383: in function 'respawnGroup'

[string "if not Group.getByName('Blue AWACS (Magic)') then mist.respawnGroup('Blue AWACS (Magic)', true) end"]:1: in main chunk

65952.292 INFO DCS: AWACSDBG: removed id - 18005249, whois -

 

and that was the end of log, server had crashed.

 

I am attaching mission version file used on server.

Farewell Caucasus.miz


Edited by Shaman

51PVO Founding member (DEC2007-)

100KIAP Founding member (DEC2018-)

 

:: Shaman aka [100☭] Shamansky

tail# 44 or 444

[sIGPIC][/sIGPIC] 100KIAP Regiment Early Warning & Control officer

Link to comment
Share on other sites

Next mission load rotation I have realized AWACS had not respawned (issue both on red and blue) and server had not crashed although these flights were already destroyed. Whenever anyone has the time pretty please check for me what I am doing wrong in AWACS respawn triggers.

51PVO Founding member (DEC2007-)

100KIAP Founding member (DEC2018-)

 

:: Shaman aka [100☭] Shamansky

tail# 44 or 444

[sIGPIC][/sIGPIC] 100KIAP Regiment Early Warning & Control officer

Link to comment
Share on other sites

Next mission load rotation I have realized AWACS had not respawned (issue both on red and blue) and server had not crashed although these flights were already destroyed. Whenever anyone has the time pretty please check for me what I am doing wrong in AWACS respawn triggers.

 

 

  1. Dont use brackets "()" within group or unit names, this can cause many issues within DCS
  2. A Continus Action to respawn a unit and/or group will do this infinit!!!
  3. Use two swichted condition. First to raise a flag when a specified group is dead or less alive or whatever.....
    then use a second switched condition to react on this flag, do action to set this flag to false and a do script!
  4. why don't you doesn'use the simple mist.respawnGroup('AWACS Wizard', true)???

 

have edited you mission and watch the last 4 triggers within as an example

 

Thats all :D

 

Regards

Farewell Caucasus.miz


Edited by Quax456

My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 1TB Samsung EVO 970, RTX4080, Thrustmaster HOTAS WARTHOG + Saitek Pro Flight Pedals, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2

Link to comment
Share on other sites

  1. Dont use brackets "()" within group or unit names, this can cause many issues within DCS
  2. A Continus Action to respawn a unit and/or group will do this infinit!!!
  3. Use two swichted condition. First to raise a flag when a specified group is dead or less alive or whatever.....
    then use a second switched condition to react on this flag, do action to set this flag to false and a do script!
  4. why don't you doesn'use the simple mist.respawnGroup('AWACS Wizard', true)???

 

have edited you mission and watch the last 4 triggers within as an example

 

Thats all :D

 

Regards

 

May I use other type of brackets and special characters like?: [] or ' or |

Changed myself to CONDITION SWITCH trigger type and first trigger changed flag if group is dead. Second trigger recognizes flag is true, does the command you have suggested via DO SCRIPT... and sends MSG to ALL it is respawning AWACS ...and it works :) Thank you for your input.

Updated scenario on <51>SERVER now bug fixed:pilotfly:

 

Will look now into example you sent me just to be sure I have done it properly :)

51PVO Founding member (DEC2007-)

100KIAP Founding member (DEC2018-)

 

:: Shaman aka [100☭] Shamansky

tail# 44 or 444

[sIGPIC][/sIGPIC] 100KIAP Regiment Early Warning & Control officer

Link to comment
Share on other sites

I would say: It's always a good style to only use '_' underscores or '-' minus maybe.....

 

The nature of many programming and scripting languages are that brackets in all forms are used for functions, tables, and/or function parameters like mist.respawnGroup()

 

Hope I have made it more clear.....:smartass:

 

But if a code is running who relay cares? :music_whistling:

My Rig: Windows 11 Pro, Intel i7-13700k@5.4GHz, 64GB DDR5 5200 RAM, Gigabyte Z790 AORUS Elite AX, 1TB Samsung EVO 970, RTX4080, Thrustmaster HOTAS WARTHOG + Saitek Pro Flight Pedals, LG 32" 4K 60FPS, ACER 30" 4K 60FPS GSync Display, HP Reverb G2 V2

Link to comment
Share on other sites

I pushed the assorted changes/fixes I've made over the last few months to release. Mist is now on 4.1. If you were using the development version nothing major has changed. The PDF documentation is updated, I still have to update the wiki at time of posting, but that is usually pretty quick and easy.

 

4.1 Release

 

Added:

-mist.getAvgPoint(). Function is similar to mist.getAvgPos except it uses raw vec2/3 coordinates instead of units

-mist.utils.roundTbl() Has the same input values as mist.utils.round except it accepts a table and it rounds all numbers in the first level of the table to the passed precision.

-mist.utils.unitToWP( ) Convers a units current position to a WP table. Will also use the unit's current velocity for the speed variable.

-mist.utils.vecToWP() Converts vec2/3 to a WP table {x,y alt}

 

Fixes/Tweaks

-mist.utils.makeVec3 now supports being given a table in WP format. Specifically it now coverts a table {x, y, alt) to vec3

-fixed issue with dynAdd functions naming a group with the country ID insead of country name

-mist.utils.getDir 2nd variable is now optional

-Fixed issue with country names in the editor not matching enum country name values. For example "Best Korea" could not match with "BEST_KOREA". Thanks lukrop for this fix

-Added check to DB update functions to only update if data from the group has changed from what is currently in the DB. This fixes an issue I had where some data was lost if you spawned a group normally after mission start and then used a respawn, clone, or teleport function on said group.

-Fixed locality issue with mist.getNorthCorrection

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Thanks Grimes!

Scripts: Complete Transport And Logistics Deployment - CTLD / CTLD Examples - Lots of example of how to use CTLD

CSAR Script - Downed Pilot Rescue / Dedicated Server Script - Automatically launch DCS Multiplayer server at startup

Range Scoring Script - Get scores and counts hits on targets for gunnery or bombs / SimpleSlotBlock - Multiplayer dynamic Slot Blocking Script

 

Projects: DCS-SimpleRadio Standalone - DCS Radio Integration for All Aircraft - NO TeamSpeak Required! :)

DCS-SimpleRadio Troubleshooting Post / DCS-SimpleRadio Free Support Channel on Discord

Link to comment
Share on other sites

Can someone else please confirm the function mist.respawnInZone function does not work in mist 4.1.61 and DCS 1.5.2? It does nothing, and does not generate an error either.

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Can someone else please confirm the function mist.respawnInZone function does not work in mist 4.1.61 and DCS 1.5.2? It does nothing, and does not generate an error either.

 

Works with ground vehicles for me. Can you post a sample where it doesnt work?

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

Works with ground vehicles for me. Can you post a sample where it doesnt work?

 

Sure thing. Here you go. Theres a message displayed when the unit reaches the end zone, to verify that the trigger itself is working.

respawnInZone.miz

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

In my semi sleepy state of testing this I was adding comments to mist left and right to figure out where the issue was occurring. I narrowed it down to the function and was adding more comments to figure out exactly where it was failing it... and then it dawned on me. You have the zone on the ramp at an airbase. Simply put the spawn "inZone" functions have an automatic check so that objects don't spawn in the middle of a runway, taxiway, or whatever. Move the zone onto grass and the function works properly.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

In my semi sleepy state of testing this I was adding comments to mist left and right to figure out where the issue was occurring. I narrowed it down to the function and was adding more comments to figure out exactly where it was failing it... and then it dawned on me. You have the zone on the ramp at an airbase. Simply put the spawn "inZone" functions have an automatic check so that objects don't spawn in the middle of a runway, taxiway, or whatever. Move the zone onto grass and the function works properly.

 

Wow how cheeky! Sorry I didn't spot this myself :doh:. I imagine you tore your hair for a bit there with error tracing :thumbup:

Updated the wiki documentation for this function to inform about this.


Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Can anyone shed any light on how exactly the flagFunc functions work, or more specifically, how the stopFlag works? I'm having trouble getting the stopFlag to work.

 

I've set up a flagFunc that sets a flag to a value in a group dead scenario.

Also using e.g. stopFlag 15

Even when setting flag 15 to either true or 1, by ME trigger or script, the flagFunc seems to continue evaluating.

 

Anyone have any idea how the stopFlag really works?

 

EDIT: Damn. Found my mistake. "stopFlag" should be "stopflag"...capital letter bested me again...tore my hair for 3 hours over this...:doh:


Edited by chrisofsweden

GPU: PALIT NVIDIA RTX 3080 10GB | CPU: Intel Core i7-9700K 4,9GHz | RAM: 64GB DDR4 3000MHz
VR: HP Reverb G2 | HOTAS: TM Warthog Throttle and Stick
OS: Windows 10 22H2

Link to comment
Share on other sites

Wow how cheeky! Sorry I didn't spot this myself :doh:. I imagine you tore your hair for a bit there with error tracing :thumbup:

Updated the wiki documentation for this function to inform about this.

 

Good idea, though I changed it slightly to add more info and added the info to the other functions that it applies to since it depends on the group type.

 

I just sent you a pull request with a bunch of changes! ;)

 

Gonna have a look over of it. Wasn't quite expecting these sort of changes. Thought there might be a new function or something, not a major re-write. Some of these changes make me think that nerve that bursts when reading someone else's code might have been bothering you. :lol:

 

Just some comments on the ideas/suggestions section...

 

I'd suggest to drop the changes file and just commit changes to git with a descriptive commit message.

 

Its mostly from a habit of only making commits when I am done with a series of changes. I often modify the dev file while testing both bugs/issues people are having with mist and while testing DCS in general. So I tend to only commit things when I'm going to post an update after I check the file to make sure there isn't any evidence of testing specific things within mist.

 

Also I would recommend to remove the mist_version_number_here.lua file and rely on tags and releases alone, as it's already the case.

 

I did that once before when I first added mist to github. However people didn't really like it that much because they weren't always sure if they were on the latest revision or not. So I reintroduced the versioned copy.

 

Many functions use a table of vars as parameters. This could make debugging harder and I don't see the benefit from it. I'd suggest to deprecate those.

 

I prefer a table for anything that has more than 5 to 6 possible input variables, might have alternative values that accomplish the same thing, or could see expansion of the function requiring more variables. Include only whats needed instead of having a function call look like someFunction(req1, req2, nil, nil, nil, nil, opt5) sort of thing. Aside for that I do try to use multiple input values for the majority of functions.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

I'm a big fan of the devs versioning their own work in file, once we download the scripts we have no way of knowing what the version is from the oputside or the inside is. I've had to do it twice now with yours Lukrop, go back to the github and re download it and it's pretty annoying.

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Hey guys,

 

Cause I absolutely suck at understanding documentation, can someone please explain to me how spawn an aircraft group using MIST? I've got a group on late activation, (WP's set, and they have no extra tasks apart from the normal ones when the group is created), and what I want to be able to do, is spawn this group using the F10 radio menu (the same group multiple times if the user keeps pressing it). Setting up the menu is easy enough, but I can't get my head around what MIST function to use, and what arguments need to be supplied. Ive tried this and it didn't work. mist.dynAdd(Group.getUnits(group), country, category)

 

Is that the right way to use this function?

 

Edit: Never mind. Got it working

 

Thanks in advance

Steggles


Edited by Steggles

-16AGR- 16th Air Guards Regiment is always looking for pilots - http://www.16agr.com

 

EWRS - Early Warning Radar Script

 

Specs:

 

 

Gigabyte Sniper Z5-S

Intel i5-4670k 3.4GHz OC'd 3.9GHz w/ Thermaltake 120mm Water 3.0 Pro Liquid CPU Cooler

16GB RAM

Gigabyte GTX 1080

TM Hotas Warthog: SN: 06976

Saitek Pro Flight Combat Rudder Pedals

TrackIR5 with TrackClipPro & Oculus Rift

2x 28" 4k UHD Monitors (3840x2160 each) + 1280x1024

 

 

Link to comment
Share on other sites

I'm a big fan of the devs versioning their own work in file, once we download the scripts we have no way of knowing what the version is from the oputside or the inside is. I've had to do it twice now with yours Lukrop, go back to the github and re download it and it's pretty annoying.

 

Why not have the best of both worlds? Keep only one "mist.lua" in the repository. Attach an appropriately-named copy of the file to each GitHub release. That also gives people a direct link to download just the .lua file (without having to right-click the "raw" button on GitHub and selecting "Save As").

Link to comment
Share on other sites

Isn't that what Grimes does? I have Mist_4_0_57.lua sitting on my drive and every time I add it to a mission i have some comfort and time saving. Some of the other guys dont name the outside of the filename but version inside, slower but not as bad as a file name dog.lua and you have no idea because you downloaded it from the dog repository on Github and don't know if the dev updated it or not. Checking linecount doesn't even work.

 

Because of the no direct file access I have a directory of scripts with subdirectorys for each Github repository version if named seperately, or overwrite if not. It's OK really but wow in the days of dialup it woudl have been mad.

Ian;2643135']Why not have the best of both worlds? Keep only one "mist.lua" in the repository. Attach an appropriately-named copy of the file to each GitHub release. That also gives people a direct link to download just the .lua file (without having to right-click the "raw" button on GitHub and selecting "Save As").

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

Definitely agree on the need to indicate version in the filename of the script lua. From the mission builder point of view if I put a script on the action of a trigger and then revisit the mission sometime later I want to be able to tell at a glance from the lua filename in the action list what version it is and do not want to be forced to unzip the mission file and inspect the lua file contents to determine the version. To do otherwise may make slightly less work for the script developer but puts a lot more workload on the user.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...