(info) Other great resources: Official JS API docs, Scripting Forum

getMissionTime()

Get the current value of the mission timer...

 

Syntax

var time = getMissionTime();

Parameters

No parameters.

Return value

ValueTypeNotesGame Version
<time>NumberThe amount of mission time remaining, in seconds.3.2
-1NumberThe timer is not active.3.2
<error>ErrorInvalid parameters.3.2

Notes

When the mission timer reaches 0, eventMissionTimeout() is triggered and the game will continue unless instructed otherwise within the event handler.

It's common to play audio prompts (using playSound() function) to let the user know how long is left on the timer – a list of audio files can be found in the sidebar to the right... →

Examples

var timeRemaining = getMissionTime();
 
if (timeRemaining == -1) {
	// timer is not active
} else if (timeRemaining == 0) {
	// mission timed out, eventMissionTimeout() will have been triggered
} else {
	// there is timeRemaining seconds left on the timer
}
Availability 3.2+

Requires:

  • Warzone 3.2 or above
Contents

Jump to:

See also

Related articles:

Audio files for countdowns:

  • countdown – missile launch and detonation countdowns
  • missmesg – generic countdown
  • trnsppil – transporter landing countdown