Difference between revisions of "MIST messageAdd"

From DCS World Wiki - Hoggitworld.com
 
 
Line 22: Line 22:
 
|varExamples= {{varsTable
 
|varExamples= {{varsTable
  
|r1T= string
+
|r1T= number
|r1N= text
+
|r1N= displayTime
  
|r2T= number
+
|r2T= table
|r2N= displayTime
+
|r2N= msgFor
  
|r3T= table
+
|r3T=  
|r3N= msgFor
+
|r3N=  
  
 
|r4T=  
 
|r4T=  
Line 49: Line 49:
 
|o3N= multSound
 
|o3N= multSound
  
|o4T=  
+
|o4T= string
|o4N=  
+
|o4N= text
  
 
|o5T=  
 
|o5T=  
 
|o5N=  
 
|o5N=  
  
|r1D= is a string of text that will be displayed via the message box
+
|r1D= is the time in seconds the message will be displayed for
|r2D= is the time in seconds the message will be displayed for
+
|r2D= 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:
|r3D= 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:
 
 
<pre>{  
 
<pre>{  
 
   units = {...},  -- unit names.  
 
   units = {...},  -- unit names.  
Line 66: Line 65:
 
}
 
}
 
</pre>
 
</pre>
 +
|r3D=
 
|r4D=
 
|r4D=
 
|r5D=
 
|r5D=
Line 81: Line 81:
 
</pre>
 
</pre>
  
|o4D=  
+
|o4D= is a string of text that will be displayed via the message box
  
 
}}
 
}}

Latest revision as of 21:38, 1 April 2022


mist.message.add

Added with: Mist 2.0
Description
Displays a text message and plays a corresponding sound file to the specified aircraft. The msgFor variable allows for a flexible definition of which aircraft receives a message. Multiple messages can be displayed a the same time and are all managed by mist.

Mist 3.7 added the multSound variable and functionality.

Syntax
number mist.message.add(table vars )
Valid Input Values:

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

 vars = 
 {
 displayTime = number displayTime, 
 msgFor = table msgFor,
 name = string name, 
 sound = string sound, 
 multSound = table multSound, 
 text = string text,
 }

displayTime is the time in seconds the message will be displayed for

msgFor 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 = {},} 
}

name is used to name the message, if another message already exists with the same name it will automatically replace the older message.

sound a valid sound file embedded into the mission, the message will play the sound file once for the receiving groups.

multSound is a table of sound files and times to play each sound file during the message.

 
  multSound = {
    [1] = {time = 2, file = 'Hello Everybody.wav'}
    [2] = {time = 4, file = 'Hi_Dr_Nick.wav'}
  }

text is a string of text that will be displayed via the message box

Return value:
number
Return example:
2
Usage Examples:
  do
    local msg = {} 
    msg.text = 'Hello World' 
    msg.displayTime = 25  
    msg.msgFor = {coa = {'all'}} 
    mist.message.add(msg)
  end
Notes:
  msg.msgFor = {coa = {'all'}} will send the message to all players including CA players 
 
  msg.msgFor = {countries = {'Russia', 'Georgia'}} will send the message to all players in Russian or 
Georgian aircraft. (no CA player receives a message) 
 
  msg.msgFor = {countries = {'Russia', 'Georgia'}, CA = 'red'} will send the message to all players in 
Russian or Georgian aircraft and red CA roles. 
  
  msg.msgFor = {units = {'Pilot #1', 'Pilot #5'}} will send the message to the units 'Pilot #1' and 'Pilot #5'.
  
  msg.msgFor = {unitTypes = {red = {'Su-25T'}}} will send to the message to all players on the red 
team in Su-25Ts 
 
  msg.msgFor = {unitTypes = {all = {'Su-25T'}}} will send to the message to all players in Su-25Ts 
   
  msg.msgFor = {unitTypes = {Russia = {'Su-25T'}, Georgia = {'Su-25T'}}} will send to the message to 
all players in Su-25Ts that belong to Georgia and Russia 
  
  msg.msgFor = {unitTypes = {Russia = {'Su-25T'}, Georgia = {'Su-25T'}}, CA = {'red'}}  will send to 
the message to all players in Su-25Ts that belong to Georgia and Russia and to Combined Arms 
players on red. 
Related Functions
messageAdd, removeById, remove , msgMGRS, msgLL, msgBR, msgBRA, msgBullseye, msgLeadingLL, msgLeadingMGRS, msgLeadingBR

Scripting Engine

MIST Root Page