# Module `Scoring`

Scoring system for MOOSE.

This scoring class calculates the hits and kills that players make within a simulation session. Scoring is calculated using a defined algorithm. With a small change in MissionScripting.lua, the scoring can also be logged in a CSV file, that can then be uploaded to a database or a BI tool to publish the scoring results to the player community.

## Global(s)

ClientGroup |
SCORING |
nHours |
nMins |
nSecs |

## Type `SCORING`

SCORING.AllScoresMenu |
SCORING.ClassID |
SCORING.ClassName |
SCORING:CloseCSV() |
SCORING.Menu |
SCORING:New(GameName) | Creates a new SCORING object to administer the scoring achieved by players.
SCORING:OpenCSV(ScoringCSV) | Opens a score CSV file to log the scores.
SCORING.Players | A collection of the current players that have joined the game.
SCORING:ReportScoreAll() |
SCORING:ReportScorePlayer() |
SCORING.RunTime |
SCORING:ScoreCSV(PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType) | Registers a score for a player.
SCORING:ScoreMenu() | Creates a score radio menu.
SCORING.ScoringCSV |
SCORING:SecondsToClock(sSeconds) |
SCORING:_AddMissionScore(MissionName, Score) | Registers Mission Scores for possible multiple players that contributed in the Mission.
SCORING:_AddMissionTaskScore(PlayerUnit, MissionName, Score) | Registers Scores the players completing a Mission Task.
SCORING:_AddPlayerFromUnit(UnitData) | Add a new player entering a Unit.
SCORING:_EventOnDeadOrCrash(Event) | Track DEAD or CRASH events for the scoring.
SCORING:_EventOnHit(Event) | Handles the OnHit event for the scoring.
SCORING:_FollowPlayersScheduled() | Follows new players entering Clients within the DCSRTE.

## Global(s)

ClientGroup

#SCORING SCORING

nHours

nMins

nSecs

## Type `Scoring`

The Scoring class

### Field(s)

SCORING.AllScoresMenu

#number SCORING.ClassID

#string SCORING.ClassName

SCORING:CloseCSV()

SCORING.Menu

SCORING:New(GameName)

  Creates a new SCORING object to administer the scoring achieved by players.

  ### Parameter

  - `#string GameName` : The name of the game. This name is also logged in the CSV score file.

  ### Return value

  #SCORING: self

  ### Usage:

      -- Define a new scoring object for the mission Gori Valley.
      ScoringObject = SCORING:New( "Gori Valley" )

SCORING:OpenCSV(ScoringCSV)

  Opens a score CSV file to log the scores.

  ### Parameter

  - `#string ScoringCSV` :

  ### Return value

  #SCORING: self

  ### Usage:

      -- Open a new CSV file to log the scores of the game Gori Valley. Let the name of the CSV file begin with "Player Scores".
      ScoringObject = SCORING:New( "Gori Valley" )
      ScoringObject:OpenCSV( "Player Scores" )

SCORING.Players

  A collection of the current players that have joined the game.

SCORING:ReportScoreAll()

SCORING:ReportScorePlayer()

SCORING.RunTime

SCORING:ScoreCSV(PlayerName, ScoreType, ScoreTimes, ScoreAmount, PlayerUnitName, PlayerUnitCoalition, PlayerUnitCategory, PlayerUnitType, TargetUnitName, TargetUnitCoalition, TargetUnitCategory, TargetUnitType)

  Registers a score for a player.

  ### Parameters

  - `#string PlayerName` : The name of the player.

  - `#string ScoreType` : The type of the score.

  - `#string ScoreTimes` : The amount of scores achieved.

  - `#string ScoreAmount` : The score given.

  - `#string PlayerUnitName` : The unit name of the player.

  - `#string PlayerUnitCoalition` : The coalition of the player unit.

  - `#string PlayerUnitCategory` : The category of the player unit.

  - `#string PlayerUnitType` : The type of the player unit.

  - `#string TargetUnitName` : The name of the target unit.

  - `#string TargetUnitCoalition` : The coalition of the target unit.

  - `#string TargetUnitCategory` : The category of the target unit.

  - `#string TargetUnitType` : The type of the target unit.

  ### Return value

  #SCORING: self

SCORING:ScoreMenu()

  Creates a score radio menu.

  Can be accessed using Radio -> F10.

  ### Return value

  #SCORING: self

SCORING.ScoringCSV

SCORING:SecondsToClock(sSeconds)

  ### Parameter

  - `sSeconds` :

SCORING:_AddMissionScore(MissionName, Score)

  Registers Mission Scores for possible multiple players that contributed in the Mission.

  ### Parameters

  - `MissionName` :

  - `Score` :

SCORING:_AddMissionTaskScore(PlayerUnit, MissionName, Score)

  Registers Scores the players completing a Mission Task.

  ### Parameters

  - `PlayerUnit` :

  - `MissionName` :

  - `Score` :

SCORING:_AddPlayerFromUnit(UnitData)

  Add a new player entering a Unit.

  ### Parameter

  - `UnitData` :

SCORING:_EventOnDeadOrCrash(Event)

  Track DEAD or CRASH events for the scoring.

  ### Parameter

  - `Event#EVENTDATA Event` :

SCORING:_EventOnHit(Event)

  Handles the OnHit event for the scoring.

  ### Parameter

  - `Event#EVENTDATA Event` :

SCORING:_FollowPlayersScheduled()

  Follows new players entering Clients within the DCSRTE.

  TODO: Need to see if i can catch this also with an event. It will eliminate the schedule ...