1. // globals to keep track of scheduled tasks
  2. //$tempCheckId = 0;
  3. //$thirstCheckId = 0;
  4. //$hungerCheckId = 0;
  5.  
  6. // default script name
  7. $scriptName = "";
  8.  
  9. function RunLevelScripts()
  10. {
  11.   echo(" ++ Begin - Run Level Scripts ++");
  12.  
  13.   sfxStopAll(AudioGui);
  14.  
  15.   // cancel any scheduled checks
  16.   if (IsEventPending($tempCheckId))
  17.       cancel($tempCheckId);
  18.   if (IsEventPending($thirstCheckId))
  19.       cancel($thirstCheckId);
  20.   if (IsEventPending($hungerCheckId))
  21.       cancel($hungerCheckId);
  22.   if (IsEventPending($timeLogId))
  23.       cancel($timeLogId);      
  24.  
  25.   // load the survival related scripts
  26.   exec("scripts/levels/gameUpdates.cs");
  27.   exec("scripts/levels/survival.cs");  
  28.  
  29.   $Game::speed=1; // 1=100%
  30.      
  31.   // JY - updated to get the scripts name from the level info in mission file
  32.   $scriptName = theLevelInfo.scriptName;
  33.  
  34.   echo($scriptName);
  35.  
  36.   if($scriptName $= "")
  37.     echo(" ++ No Script Name ++");
  38.   else
  39.   {
  40.     echo("scripts/levels/" @ $scriptName);
  41.     exec("scripts/levels/" @ $scriptName @ ".cs");
  42.   }
  43.    
  44.   // call the script to update players health every 1 second
  45.   // but check first to make sure another is not already running
  46.   if (IsEventPending($tickId))
  47.       cancel($tickId);      
  48.   Tick();
  49.  
  50.   // run the level specific script for survival checks
  51.   if(isFunction("activateLevelTick"))
  52.         activateLevelTick();
  53.        
  54.   echo(" ++ End - Run Level Scripts ++");
  55. }
  56.  
  57. function GiveLevelScriptFileName(%fileName)
  58. {
  59.     $scriptName = %fileName;
  60.     $scriptName = %filename @ ".cs";
  61.     echo(" ++ GiveLevelScriptFileName - " @ $scriptName @ "++");
  62. }