// globals to keep track of scheduled tasks
//$tempCheckId = 0;
//$thirstCheckId = 0;
//$hungerCheckId = 0;
// default script name
$scriptName = "";
function RunLevelScripts()
{
echo(" ++ Begin - Run Level Scripts ++");
sfxStopAll(AudioGui);
// cancel any scheduled checks
if (IsEventPending($tempCheckId))
cancel($tempCheckId);
if (IsEventPending($thirstCheckId))
cancel($thirstCheckId);
if (IsEventPending($hungerCheckId))
cancel($hungerCheckId);
if (IsEventPending($timeLogId))
cancel($timeLogId);
// load the survival related scripts
exec("scripts/levels/gameUpdates.cs");
exec("scripts/levels/survival.cs");
$Game::speed=1; // 1=100%
// JY - updated to get the scripts name from the level info in mission file
$scriptName = theLevelInfo.scriptName;
echo($scriptName);
if($scriptName $= "")
echo(" ++ No Script Name ++");
else
{
echo("scripts/levels/" @ $scriptName);
exec("scripts/levels/" @ $scriptName @ ".cs");
}
// call the script to update players health every 1 second
// but check first to make sure another is not already running
if (IsEventPending($tickId))
cancel($tickId);
Tick();
// run the level specific script for survival checks
if(isFunction("activateLevelTick"))
activateLevelTick();
echo(" ++ End - Run Level Scripts ++");
}
function GiveLevelScriptFileName(%fileName)
{
$scriptName = %fileName;
$scriptName = %filename @ ".cs";
echo(" ++ GiveLevelScriptFileName - " @ $scriptName @ "++");
}