Module Message
Core -- MESSAGE class takes are of the real-time notifications and messages to players during a simulation.
Global(s)
MESSAGE |
MESSAGE class, extends Base#BASEMessage System to display Messages to Clients, Coalitions or All. |
Type MESSAGE
MESSAGE.MessageCategory | |
MESSAGE.MessageDuration | |
MESSAGE:New(MessageText, MessageDuration, MessageCategory) |
Creates a new MESSAGE object. |
MESSAGE:NewType(MessageText, MessageType) |
Creates a new MESSAGE object of a certain type. |
MESSAGE:ToAll() |
Sends a MESSAGE to all players. |
MESSAGE:ToAllIf(Condition) |
Sends a MESSAGE to all players if the given Condition is true. |
MESSAGE:ToBlue() |
Sends a MESSAGE to the Blue coalition. |
MESSAGE:ToClient(Client, Settings) |
Sends a MESSAGE to a Client Group. |
MESSAGE:ToCoalition(CoalitionSide, Settings) |
Sends a MESSAGE to a Coalition. |
MESSAGE:ToCoalitionIf(CoalitionSide, Condition) |
Sends a MESSAGE to a Coalition if the given Condition is true. |
MESSAGE:ToGroup(Group, Settings) |
Sends a MESSAGE to a Group. |
MESSAGE:ToRed() |
Sends a MESSAGE to the Red Coalition. |
MESSAGE.Type |
Type MESSAGE.Type
MESSAGE.Type.Briefing | |
MESSAGE.Type.Detailed | |
MESSAGE.Type.Information | |
MESSAGE.Type.Overview | |
MESSAGE.Type.Update |
Global(s)
- #MESSAGE MESSAGE
-
MESSAGE class, extends Base#BASE
Message System to display Messages to Clients, Coalitions or All.
Messages are shown on the display panel for an amount of seconds, and will then disappear. Messages can contain a category which is indicating the category of the message.
MESSAGE construction
Messages are created with Message#MESSAGE.New. Note that when the MESSAGE object is created, no message is sent yet. To send messages, you need to use the To functions.
Send messages to an audience
Messages are sent:
- To a Client using Message#MESSAGE.ToClient().
- To a Group using Message#MESSAGE.ToGroup()
- To a coalition using Message#MESSAGE.ToCoalition().
- To the red coalition using Message#MESSAGE.ToRed().
- To the blue coalition using Message#MESSAGE.ToBlue().
- To all Players using Message#MESSAGE.ToAll().
Send conditionally to an audience
Messages can be sent conditionally to an audience (when a condition is true):
- To all players using Message#MESSAGE.ToAllIf().
- To a coalition using Message#MESSAGE.ToCoalitionIf().
Author: FlightControl
Contributions:
Type Message
Type MESSAGE
The MESSAGE class
Field(s)
- #string MESSAGE.MessageCategory
-
self.MessageType .. ": "
- MESSAGE:New(MessageText, MessageDuration, MessageCategory)
-
Creates a new MESSAGE object.
Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions ToClient or ToCoalition or ToAll to send these Messages to the respective recipients.
Parameters
-
#string MessageText
: is the text of the Message. -
#number MessageDuration
: is a number in seconds of how long the MESSAGE should be shown on the display panel. -
#string MessageCategory
: (optional) is a string expressing the "category" of the Message. The category will be shown as the first text in the message followed by a ": ".
Return value
Usage:
-- Create a series of new Messages. -- MessageAll is meant to be sent to all players, for 25 seconds, and is classified as "Score". -- MessageRED is meant to be sent to the RED players only, for 10 seconds, and is classified as "End of Mission", with ID "Win". -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score". -- MessageClient1 is meant to be sent to a Client, for 25 seconds, and is classified as "Score", with ID "Score". MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", 25, "End of Mission" ) MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", 25, "Penalty" ) MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", 25, "Score" ) MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", 25, "Score")
-
- MESSAGE:NewType(MessageText, MessageType)
-
Creates a new MESSAGE object of a certain type.
Note that these MESSAGE objects are not yet displayed on the display panel. You must use the functions ToClient or ToCoalition or ToAll to send these Messages to the respective recipients. The message display times are automatically defined based on the timing settings in the Settings menu.
Parameters
-
#string MessageText
: is the text of the Message. -
#MESSAGE.Type MessageType
: The type of the message.
Return value
Usage:
MessageAll = MESSAGE:NewType( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", MESSAGE.Type.Information ) MessageRED = MESSAGE:NewType( "To the RED Players: You receive a penalty because you've killed one of your own units", MESSAGE.Type.Information ) MessageClient1 = MESSAGE:NewType( "Congratulations, you've just hit a target", MESSAGE.Type.Update ) MessageClient2 = MESSAGE:NewType( "Congratulations, you've just killed a target", MESSAGE.Type.Update )
-
- MESSAGE:ToAll()
-
Sends a MESSAGE to all players.
Return value
Usage:
-- Send a message created to all players. MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll() or MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ):ToAll() or MessageAll = MESSAGE:New( "To all Players: BLUE has won! Each player of BLUE wins 50 points!", "End of Mission", 25, "Win" ) MessageAll:ToAll()
- MESSAGE:ToAllIf(Condition)
-
Sends a MESSAGE to all players if the given Condition is true.
Parameter
-
Condition
:
Return value
-
- MESSAGE:ToBlue()
-
Sends a MESSAGE to the Blue coalition.
Return value
Usage:
-- Send a message created with the @{New} method to the BLUE coalition. MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue() or MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToBlue() or MessageBLUE = MESSAGE:New( "To the BLUE Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ) MessageBLUE:ToBlue()
- MESSAGE:ToClient(Client, Settings)
-
Sends a MESSAGE to a Client Group.
Note that the Group needs to be defined within the ME with the skillset "Client" or "Player".
Parameters
-
Wrapper.Client#CLIENT Client
: is the Group of the Client. -
Settings
:
Return value
Usage:
-- Send the 2 messages created with the @{New} method to the Client Group. -- Note that the Message of MessageClient2 is overwriting the Message of MessageClient1. ClientGroup = Group.getByName( "ClientGroup" ) MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup ) MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup ) or MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ):ToClient( ClientGroup ) MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ):ToClient( ClientGroup ) or MessageClient1 = MESSAGE:New( "Congratulations, you've just hit a target", "Score", 25, "Score" ) MessageClient2 = MESSAGE:New( "Congratulations, you've just killed a target", "Score", 25, "Score" ) MessageClient1:ToClient( ClientGroup ) MessageClient2:ToClient( ClientGroup )
-
- MESSAGE:ToCoalition(CoalitionSide, Settings)
-
Sends a MESSAGE to a Coalition.
Parameters
-
CoalitionSide
: needs to be filled out by the defined structure of the standard scripting engine coalition.side. -
Settings
:
Return value
Usage:
-- Send a message created with the @{New} method to the RED coalition. MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED ) or MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToCoalition( coalition.side.RED ) or MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ) MessageRED:ToCoalition( coalition.side.RED )
-
- MESSAGE:ToCoalitionIf(CoalitionSide, Condition)
-
Sends a MESSAGE to a Coalition if the given Condition is true.
Parameters
-
CoalitionSide
: needs to be filled out by the defined structure of the standard scripting engine coalition.side. -
Condition
:
Return value
-
- MESSAGE:ToGroup(Group, Settings)
-
Sends a MESSAGE to a Group.
Parameters
-
Wrapper.Group#GROUP Group
: is the Group. -
Settings
:
Return value
-
- MESSAGE:ToRed()
-
Sends a MESSAGE to the Red Coalition.
Return value
Usage:
-- Send a message created with the @{New} method to the RED coalition. MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed() or MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ):ToRed() or MessageRED = MESSAGE:New( "To the RED Players: You receive a penalty because you've killed one of your own units", "Penalty", 25, "Score" ) MessageRED:ToRed()
Type MESSAGE.Type
Message Types
Field(s)
- #string MESSAGE.Type.Briefing
- #string MESSAGE.Type.Detailed
- #string MESSAGE.Type.Information
- #string MESSAGE.Type.Overview
- #string MESSAGE.Type.Update