Difference between revisions of "Mission Scripting Tools Documentation"

From DCS World Wiki - Hoggitworld.com
Line 96: Line 96:
 
|-
 
|-
 
|{{listOfMistVectors}}
 
|{{listOfMistVectors}}
 +
|-
 +
|bgcolor="LightBlue"| <font size="3">Markers</font>
 +
|-
 +
|{{listOfMistMarkerFuncs}}
 
|-
 
|-
 
|bgcolor="LightBlue"| <font size="3">Messages</font>
 
|bgcolor="LightBlue"| <font size="3">Messages</font>

Revision as of 08:12, 16 August 2021


Current release: 4.5

ED Forums Thread For discussion and downloads of current and legacy versions.

GitHub Link Mist is now on github. Suggest your own features, write your own code for merging, or make your own modifications to mist!

MIST Changelog

Introduction

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.

Using Mist in a mission

How to Load It Mist is not a mod of the game files. You include it into your missions simply by using any of the DO SCRIPT FILE trigger actions to load Mist at or near mission start. The screenshot below illustrates trigger logic that loads Mist at mission time = 1 sec (using DO SCRIPT FILE).

(Also note that in the above screenshot the trigger named "Mission Script". This trigger is similar to the trigger activating mist, however the condition is "Time More (2)." The mission script used in this example requires Mist to be loaded first, otherwise a LUA error will occur and the mission will not function correctly.) Once your mission trigger logic loads Mist, Mist exists within the global mission scripting Lua environment, and its components are accessible in all subsequent scripts run with DO SCRIPT, DO SCRIPT FILE, AI Lua stop conditions, etc. The 1.2.4 patch added the "initialization" script or script file option in the triggers list, this also works.

NOTE #1: Due to its size Mist must be loaded using a DO SCRIPT FILE. Mist is simply too large to paste into a DO SCRIPT text box.

NOTE #2: It is best if Mist is loaded into your mission as early as possible. Unlike Slmod, Mist should not be vulnerable to being used too early, and it will be fine if you load it on a MISSION START type trigger.



List of Functions

General Purpose
makeUnitTable, getRandPointInCircle, getRandomPointInZone, getRandomPointInPoly, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, getAvgPoint, getQFE, getWindBearingAndVel, getPathLength, getPathInSegments, getPointAtDistanceOnPath, projectPoint, getGroupsByAttribute, , getUnitsByAttribute, mapValue,
Unit Orientation
getHeading, getNorthCorrection, getAttitude, getPitch, getRoll, getYaw, getAoA, getClimbAngle, getDir
Flag Functions
mapobjs_dead_polygon, Mapobjs_dead_zones, units_in_zones, units_in_moving_zones, units_in_polygon, units_LOS, group_alive, group_dead, group_alive_more_than, group_alive_less_than
Tasks and Events
scheduleFunction, removeFunction, addEventHandler, removeEventHandler
Coordinate Conversion
makeVec2, makeVec3, zoneToVec3, makeVec3GL, vecToWP, unitToWP
Unit Conversion
converter, toDegree, toRadian, round, roundTbl, metersToNM, metersToFeet, NMToMeters, feetToMeters, mpsToKnots, mpsToKmph, knotsToMps, kmphToMps, kelvinToCelsius, FahrenheitToCelsius, celsiusToFahrenheit, hexToRGB
Utilities
deepCopy, dostring, basicSerialize, serialize, serializeWithCycles, oneLineSerialize, tableShow
Debug
writeData, dumpDBs, dump_G, writeGroup, writeTypes, changeSetting
Vectors
add, sub, scalar_mult, dp, cp, mag, getUnitVec, rotateVec2, get2DDist, get3DDist, getHeadingPoints
Markers
markerAdd, drawShape, drawZone, remove, getNextID, markerGet, setDefault
Messages
messageAdd, removeById, remove , msgMGRS, msgLL, msgBR, msgBRA, msgBullseye, msgLeadingLL, msgLeadingMGRS, msgLeadingBR
Group Orders
General goRoute
Ground groupToPoint, groupToRandomZone, groupRandomDistSelf, groupToRandomPoint, buildWP(ground), patrol, patrolRoute
Fixed Wing buildWP(fixedWing)
Helicopter buildWP(helicopter)
Group Data
getGroupData, getCurrentGroupData, getGroupTable getGroupPoints, getGroupRoute, getLeadPos, getAvgPos, getPayload, getGroupPayload, randomizeGroupOrder, groupIsDead
Group Spawning
dynAdd, dynAddStatic, groupTableCheck, getNextUnitId, getNextGroupId, respawnGroup, respawnInZone, cloneGroup, cloneInZone, teleportGroup, teleportInZone, teleportToPoint, spawnRandomizedGroup
Strings
tostringMGRS, tostringLL, tostringBR, getMGRSString, getLLString, getBRString, getLeadingPos, getLeadingMGRSString, getLeadingLLString, getLeadingBRString, getMilString, getClockString, getDateString, stringMatch, stringCondense
Time
getDate, getDHMS, convertToSec, milToGame
Logger
new, setLevel, msg, info, warn, error, alert