Difference between revisions of "MIST messageAdd"
(No difference)
|
Revision as of 23:22, 13 April 2018
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 = { text = string text, displayTime = number displayTime, msgFor = table msgFor, name = string name, sound = string sound, multSound = table multSound, } text is a string of text that will be displayed via the message box 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'} } |
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 |