IfSpawned
  tmpargument = 12
  tmpdistance = 0
  PlayMusic
  
  ShowMap
  ShowYouAreHere
  
  tmpdistance = BLAHFRIENDS + BLAHENEMIES + BLAHQUEST
  tmpturn = [IMPA]
  SetTargetToNearestBlahID
  IfTargetHasQuest                  //Get the current quest level
    tmpargument = tmpdistance       //quest level = time left
  Else
    tmpargument = 50*60*40          //Default to 40 minutes
  SetContent

//Update the game timer
tmpx = selfcontent
tmpy = 0
IfXIsMoreThanY
  tmpargument = selfcontent - 1
  SetContent
  ShowTimer
  
IfOrdered
  tmpx = selforder
  tmpy = [BEAT]
  IfXIsEqualToY
    tmpargument = [IMPB]          //Imprisoned one level 2
    tmpdistance = selfcontent     //Store time left on this level
    AddQuestAllPlayers
    BeatModule
    EnableExport
    EndModule
    ClearEndMessage
    tmpy = selfcontent / 60 / 50      //Calculate amount of time left from the ticks
    tmpx = selfcontent / 50
    tmpx = tmpx % 60
    tmpargument = 0
    AddEndMessage
    tmpargument = 1
    AddEndMessage
    tmpargument = 2
    AddEndMessage
    tmpargument = 3
    AddEndMessage
    tmpargument = 4
    AddEndMessage
  
//------------------------------------------------------------------------------------
End					// All done
//------------------------------------------------------------------------------------
