Jump to content

MIssion Scripting Tools (Mist)- enhancing mission scripting Lua


Recommended Posts

MIST location

 

Hi all, sorry stupid question. Im new to this. I just downloaded MIST and unzipped it but where do I need to place the files? I want to play the MP nellis defence mission but it says it requires MIST to work.

INTEL i9 9900k @ 5Ghz, Asus Z390 strix ROG, 32gb 3200mhz Ram, Nvidia GTX 1080Ti, Corsair RM850i, Corsair H110i,, HP REVERB, Win 10 64bit.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Mist is something that cones with the mission. This is a mission editor task. So you should not touch anything.

 

On the other hand if you eant to design a mission, using a script that needs Mist, then you do have to load first. But only if you ae making your own mission.

 

You can see the triggers loaded through the ME. Left panel, clic on triggers. A window will pop up with all triggers conditions and actios. I suggest you to read the manual.

Link to comment
Share on other sites

Like ESAc_matador said, a DCS mission will include any scripts it depends on in the mission file itself.

 

I guess the mission author has mentioned those dependencies to make you aware that if some future version of DCS is incompatible with the version of MiST or CTLD that come with the mission, the mission may fail to work because of that.

Link to comment
Share on other sites

Oh i see. Thanks for the replies guy's. That now makes sense.

INTEL i9 9900k @ 5Ghz, Asus Z390 strix ROG, 32gb 3200mhz Ram, Nvidia GTX 1080Ti, Corsair RM850i, Corsair H110i,, HP REVERB, Win 10 64bit.

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 2 weeks later...

Isn't it working with 1.5? After try to respawn my units it does give a error on my server...

 

 

[string "mist.respawnGroup('MyGroup', true)"]:1:attempeted to index global 'mist' (a nil value)

 

Where do i get the commands to use with MIST? Restart server for example, make units jump from last to fisrt waypoints... etc...

Who cares...

Link to comment
Share on other sites

That error usually indicates that mist isn't loaded. Check the DCS.log for an error message or check the mission file to ensure the trigger that loads mist is working correctly.

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

Released version 4.2. This version has been on development branch for a while now, just never got around to doing the documentation and merging the release. I still need to do the wiki documentation for it, but the pdf should have enough to be usable.

 

Get Here

 

The changelog is pretty short, just a minor bug fix and the new mist.Logger functionality that Lukrop created.


Edited by Grimes
  • 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

No i guess that is not the problem.

 

Take a look into those images...

Evn Clicking on Load script, pointing to MISTxxx.lua file, i doesn't show up into box. Strange fact because, a few days ago it was working and spawning my units.

 

?cid=A0D08A119EAA746A&id=A0D08A119EAA746A%2148063&parId=A0D08A119EAA746A%2144813&o=OneUp

 

?cid=A0D08A119EAA746A&id=A0D08A119EAA746A%2148064&parId=A0D08A119EAA746A%2144813&o=OneUp

 

thanks in advance

 

if image doesnt load::

 

Img1: https://onedrive.live.com/?cid=A0D08A119EAA746A&id=A0D08A119EAA746A%2148063&parId=A0D08A119EAA746A%2144813&o=OneUp

img2: https://onedrive.live.com/?cid=A0D08A119EAA746A&id=A0D08A119EAA746A%2148064&parId=A0D08A119EAA746A%2144813&o=OneUp

Who cares...

Link to comment
Share on other sites

I bumped into to something like that the other night. Try deleting that specific load script file action and then re-adding it.

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

  • 3 weeks later...

I do not understand why my AWACS-es are not re-spawning once groups are destroyed, and when I destroy group "BLUE Tanker", this error pops up. Kindly please help me understand it.

Farewell Caucasus.rar

Untitled.png.e8886137580920ccdae35c59f0109858.png

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 do not understand why my AWACS-es are not re-spawning once groups are destroyed, and when I destroy group "BLUE Tanker", this error pops up. Kindly please help me understand it.

 

The AWACs spawned for me, at least the Blue team awacs did, didn't test the Red since it looked like it would work. The tanker generates an error due to a mismatch with the group name.

 

The script call: mist.respawnGroup('Blue TANKER', true)

 

The actual name of the tanker: BLUE Tanker

 

The casing matters. It took me longer than I care to admit to notice that. :cry: Now that mist has a logger, I think it is about time I go in and add some decent error messages and better error handling overall. The only part I'm hesitant about is that in doing so I think it would remove the "traceback" of the functions called to get to that error.

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 have been testing Blue AWACS if it re-spawn by placing for debug only a Red tank behind a structure near taxiway, taking control of it, and destroying Blue AWACS with HE round before it took off. AWACS didn't re-spawn, little wreckage was all that remained. It must be destroyed in air then?

 

Regarding that casing matters. Thanks for spotting this. I have spent 1 hour plus trying to find out what I am doing wrong last night, I feel like an idiot now really, oh well! Appreciate it, Grimes!

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

Hi,

I'm trying to build a mission where an enemy AI aircraft is attacking a ground target from one of few possible (random) directions.

To do this, I'm trying to set the AI aircraft (activated on a remote corner of the map) to teleport into one of two zones (mist.teleportInZone) and execute the group's task.

 

My problem is that the group is RTB after teleporting.

Tried to add an additional AI-task-push trigger (activated after the teleporting) but it doesn't work.

Also tried the mist.getGroupRoute but again - didn't seem to work.

What am I missing?

Thanks,

Assaf.

Link to comment
Share on other sites

I have been testing Blue AWACS if it re-spawn by placing for debug only a Red tank behind a structure near taxiway, taking control of it, and destroying Blue AWACS with HE round before it took off. AWACS didn't re-spawn, little wreckage was all that remained. It must be destroyed in air then?

 

Its just down to satisfying the conditions of the trigger, if the group isn't completely dead then the trigger might not fire. Its easier to "kill" an aircraft by shooting it down than it is to just damage it when its already on the ground. Helicopters are they only type of AI that stand a chance of successfully crash landing.

 

 

I'm trying to build a mission where an enemy AI aircraft is attacking a ground target from one of few possible (random) directions.

To do this, I'm trying to set the AI aircraft (activated on a remote corner of the map) to teleport into one of two zones (mist.teleportInZone) and execute the group's task.

 

My problem is that the group is RTB after teleporting.

Tried to add an additional AI-task-push trigger (activated after the teleporting) but it doesn't work.

Also tried the mist.getGroupRoute but again - didn't seem to work.

What am I missing?

 

mist.getGroupRoute just returns the data needed to modify/assign the route. Once you get it you need to use mist.goRoute() for it to be assigned. It is worth noting that if you get the groups route it will fly back to wherever it starts in the mission editor and will continue from there. So its not all that randomized.

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

Just an FYI I pushed some updates to the development branch. It contains mostly changes to how the DBs update. Consider this to be a proper WIP as I have yet to test every possible way DBs may have to be updated, so there could be some major errors where it fails to update DBs accordingly. I was able to successfully build DBs with dynamically added groups and static objects, so it should be functional enough to test. The big reason for the changes is two fold:

 

1. To update relevant entries in other tables when a groupName/unitName are used to write over groups/units.

2. The code was a little convoluted in places, so I tried to simplify it.

 

So the DBs used to update the "byId" and "byName" tables whenever the entry was used again, the problem was that other tables were simply added to. As a result if a groupName or unitName were used more than once that unit could exist multiple times in other databases. It now searches for specific criteria to determine whether or not it will update every instance of a group/units DB entry. It takes any one of these to change to prompt an update. For groups if the name is in use and the groupID, country, or coalition changed it will update. For units if the unitID or object type.

 

Other changes/fixes so far:

-Fixed typo in mist.utils.NMToMeters which caused error

-added Logger 'dbLog' to mist DB code. This is meant for internal use in mist so I can have more verbose debug messages for DB updates without enabling messages elsewhere

-inserted do-end blocks to make DB code block shorter in length

-Dynamically generated names will now be indexed accordingly to their category. There used to be just a single counter shared between all.

-Several changes/fixes to mist.dynAddStatic

-- The function was broken under certain parameters. I fixed it.

-- Removed excess code.

-- Will now accept country names that have spaces, this was previously fixed for dynAdd but never made its way to dynAddStatic

 

 

Gonna run some more tests to make sure DBs and related functions that use them are working correctly. I also plan on adding decent error logging messages throughout the code.

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

Grimes, is it correct way to clean up and respawn landed airplane of group of four if for example three out of four were destroyed and fourth landed?

1. 'Deactivate' group once all four units in this flight group speed condition is below 1m/s.

2. Respawn group with MISC command.

3. 'Activate' group again

?

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

Yeah you can get the velocity, check if they are alive an inAir() == false, or do all sorts of fun stuff to decide if is time to "reactivate" the group via spawning. Technically speaking you don't even have to deactivate them first. Whenever you spawn a unit that has the same name as another unit the old one disappears and the new one takes its place. The respawn and "teleport" functions do it that way, the only difference is teleport is dependent on whichever units in the group are alive at the time it is called.

 

You won't need to activate the group again unless they start inactive. When mist respawns the group they will be in whatever state you set them to be in the mission editor.

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

  • 2 weeks later...

why this does not work?? it always return false???

 

mist.flagFunc.units_in_moving_zones{
		units = {'[blue][plane]','[blue][helicopter]'},
		zone_units = {'[g]sam1'},
		flag = 500,
		radius = 15000,
		stopflag = 9999,
		req_num = 1,
		zone_type = 'sphere',
		interval = 10,
		toggle = true
		}-- with
if trigger.misc.getUserFlag('500',true) == true
then trigger.action.outText("In zone", 30)

elseif trigger.misc.getUserFlag('500',true) ~= true
then trigger.action.outText("outzone", 30)
end

Link to comment
Share on other sites

User Flags store numbers, so getUserFlag will return the number 0 or 1, not false or true.

 

With that in mind, the answer can be found in the Lua Reference Manual, section 2.5.2: Relational Operators:

Equality (==) first compares the type of its operands. If the types are different, then the result is false. Otherwise, the values of the operands are compared.

 

Because you are comparing a boolean to a number, the result is always false.

 

Also, trigger.misc.getUserFlag only accepts one parameter, I don't know why you have added "true" as a second parameter; but that should not matter, as far as I know Lua functions just ignore extra parameters, just like in JavaScript.

 

The following should work:

-- instead of "if trigger.misc.getUserFlag('500', true) == true"
if trigger.misc.getUserFlag('500') == 1

-- instead of "trigger.misc.getUserFlag('500',true) ~= true"
if trigger.misc.getUserFlag('500') ~= 1
if trigger.misc.getUserFlag('500') == 0

 

Note that the following would not work, because according to section 2.2 "Both nil and false make a condition false; any other value makes it true."

if trigger.misc.getUserFlag('500') -- always true
if not trigger.misc.getUserFlag('500') -- always false

Link to comment
Share on other sites

I wrote true because I made thousands of conbinations wtong... I also did not kno about the value! 1 and 0! Ill try now! Thanks. I put the second value because, i thought true and false are like values...concept mistake.

 

PS i am reading and re-reading the lua manual! But i am just a begginer. This helps a lot! Thanks again!


Edited by ESAc_matador
Link to comment
Share on other sites

Hi everyone,

 

I have been running a scenario on multiplayer server and this bug and error occured. I have looked into the dump file and it appears to be MISC script. Attached screenshots of the bug and possibly the code line, not sure which one though and why this happened.

CaptureB4.JPG.05a30f2801fc8c7f1ef50f0f5f3986be.JPG

CaptureB3.thumb.JPG.d931d5ca83353599d9251876da4390dc.JPG

CaptureB2.JPG.2a8fb0fe6b3dae2c8cc6e786c1dd6378.JPG

CaptureB1.JPG.6229987485ae6f675942c653f6f55959.JPG

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

It is occurring with the function mist.getGroupRoute() and it is being passed a string value for a group name. Routes are only accessible for groups that are placed in the mission editor, so this function only checks the mist.DBs.MEGroupsByName table. The value passed wasn't found, thus an error.

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

Hmm, I still wonder what has caused this. Is there a way to check what specific value asked caused this?

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

Hmm, I still wonder what has caused this. Is there a way to check what specific value asked caused this?

 

Error messages like that are added to your DCS.log and they generally have a "traceback" showing the steps and functions that were called before that. From that you might be able to figure it out.

 

I have added a few extra checks on the mist development branch to better avoid errors and to provide more detailed explanation of what might have gone wrong. Keep in mind I did re-do a bunch of the DB update code so anything related to that might have errors as I haven't fully tested every thing yet.

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

Mist 4.3

 

I have released a relatively minor update for mist. The 3 big changes are that I refactored how DBs update, added some error checking into common mist functions, and fixed up the example DBs so some data is a little more clear.

 

Download

 

 

Changelog:

 

-Refactored DB update code. If a groupName or unitName is duplicated it will now overwrite the older DB entry for all "live" DBs

-Several fixes for dnyAddStatic function

--Optimized it by trimming excess code out.

--fixed country checker to better account for country names with spaces

--fixed function was broken if given certain params

-dynAdd functions now index names by category.

-Added mist.DBs.const.shapeNames DB. This is simply a table of static object names and their corresponding shape names.

-Added some error checking for some 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

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...