Difference between revisions of "MIST markerAdd"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Mission Scripting |fName= mist.marker.add |vNum = Mist 4.5 |desc= Used to create mark panels and shapes on the F10 map. This is a master function that is capable of creat...")
 
(No difference)

Latest revision as of 09:02, 16 August 2021


mist.marker.add

Added with: Mist 4.5
Description
Used to create mark panels and shapes on the F10 map. This is a master function that is capable of creating marks, circles, lines, arrows, polygons, and quad shapes. Output and functionality depends on the input values as different shapes require different parameters.
Syntax
table mist.marker.add(table vars )
Valid Input Values:

vars tables have the following recognized fields( required entries in blue, optional in green):

 vars = 
 {
 pos = table pos,
 name/id = string/number name/id, 
 markType = number/string markType, 
 radius = number radius, 
 text = string text, 
 markFor = table markFor,
 markForCoa = number/string markForCoa, 
 color = table color,
 fillColor = table fillColor, 
 lineType = number lineType,
 readOnly = boolean readOnly,
 message = text message,
 fontSize = number fontSize,
 }

pos vec3 or table of vec3 points indexed numerically to define the shapes.

name/id is used to identify the mark, can be used to replace marks already created.

markType is an identifier for the type of mark or shape to be created.

 0 ; panel    : mark panel (the circles with text that can appear on the map
 1 ; line     : line drawn between two points
 2 ; circle   : circle of a given radius drawn at a point
 3 ; rect     : rectangle with the two points defining two opposite corners
 4 ; arrow    : arrow with the first point being where the arrow is pointing
 5 ; text     : text drawn on the map
 6 ; quad     : a 4 point polygon
 7 ; freeform : a n point polygon. Do not recommend going over 50 points. 

radius is only relevant if a circle is passed. Radius of the circle to be drawn in meters

text is relevant to panels and text. Is a string of the text that is to be displayed

markFor accepts a string or a table of strings as keywords to define which groups will receive the message. This table can be use a variety of values to send the message to a very specific group of players. Acceptable values are in a table forma similar to the following:

{ 
  units = {...},  -- unit names. 
  coa = {...}, -- coa names 
  countries = {...}, -- country names 
  CA = {...}, -- looks just like coa. 
  unitTypes = { red = {TYPENAME}, blue = {}, all = {}, Russia = {},} 
}

markForCoa is simplified entry more meant for the shapes because the shapes can only be displayed to all or a specific coalition

color is the color of the outline of a shape in {r, g, b, alpha} table format. Values can are between 0 to 1. However mist supports 0-255 format. If the number is greater than 1 mist will assume it is in 0-255 format. By default if color is not defined mist will generate a color automatically based on who is to see the mark. 80% Red or Blue.

fillColor is the fill color for the shape. Same rules as stated above apply

lineType is the format the outline will be in. By default if not present the value used is 2.

LineTypes:

0  No Line
1  Solid
2  Dashed
3  Dotted
4  Dot Dash
5  Long Dash
6  Two Dash

readOnly is a boolean value for whether or not the mark or shapes can be deleted by users. At present only applies to mark panels. If not present defaults to true.

message is text that will be displayed when the mark is created

fontSize is only relevant to the text shape. Defines how large of font will be used when displaying the text on the F10 map. If not present the default font size is 16.

Return value:
table
Return example:
Usage Examples:
The following draws a shape based on the route of a group placed in the mission editor.
   local v = {}
   v.pos = mist.getGroupPoints('poly')
   v.mType = 'freeform'
   mist.marker.add(v)

The following creates a 3000 meter radius circle around airbases belonging to the red coalition for the red team.

     
    local ab = coalition.getAirbases(1)
    for i = 1, #ab do
       local v = {}
       v.pos = ab[i]:getPoint()
       v.markFor = {coa = {'red'}}
       v.radius = 3000
       v.mType = 'circle'
       mist.marker.add(v)
    end

The following would create a circle with a radius of 10km around the unit "update" and if called again it would delete the previous mark and create a new one.

   local v = {}
   v.pos = Unit.getByName('update'):getPoint()
   v.id = 5
   v.markForCoa = 2
   v.mType = 2
   v.radius = 10000
   mist.marker.add(v)
Notes:
Related Functions
markerAdd, drawShape, drawZone, remove, getNextID, markerGet, setDefault

Scripting Engine

MIST Root Page