-- true/false defn FALSE = 0 TRUE = 1 -- condition return values CONDITION_NOT_YET_MET = 0 CONDITION_SUCCEEDED = 1 CONDITION_FAILED = 2 --Video options FULLSCREEN = 0; FRONT_AND_CENTER = 1; CALL = 2; NO_CONTROLS = 0; PLAYPAUSE = 1; STOP = 2; SEEK = 4; -- Message types MT_INFO = 0 -- large centre screen pop up MT_ALERT = 1 -- top right alert message MSG_TOP = 1 MSG_VCENTRE = 2 MSG_BOTTOM = 4 MSG_LEFT = 8 MSG_CENTRE = 16 MSG_RIGHT = 32 MSG_SMALL = 0 MSG_REG = 1 MSG_LRG = 2 gweight=0; tmpd1=0; tmpd2=0; -- Recorded Messages function DisplayRecordedMessage( messageName ) SysCall("RegisterRecordedMessage", "StartDisplay" .. messageName, "StopDisplay" .. messageName, 1); end function StartDisplayInfoText() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "info.html", 0, MSG_TOP + MSG_LEFT, MSG_LRG, TRUE ); end function StopDisplayInfoTextText() end function StartDisplayIntroText() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "intro.html", 0, MSG_TOP + MSG_LEFT, MSG_REG, TRUE ); end function StopDisplayIntroText() end function StartDisplayShuntbdrText() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "shunt.html", 0, MSG_TOP + MSG_LEFT, MSG_REG, TRUE ); end function StopDisplayShuntbdrText() end function StartDisplayTEE103Text() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "tee103.html", 0, MSG_TOP + MSG_LEFT, MSG_LRG, TRUE ); end function StopDisplayTEE103Text() end function StartDisplayFreight151Text() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "freight151.html", 0, MSG_TOP + MSG_LEFT, MSG_LRG, TRUE ); end function StopDisplayFreight151Text() end function StartDisplayIR120Text() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "ir120.html", 0, MSG_TOP + MSG_LEFT, MSG_LRG, TRUE ); end function StopDisplayIR120Text() end function StartDisplayRegional111Text() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "regional111.html", 0, MSG_TOP + MSG_LEFT, MSG_LRG, TRUE ); end function StopDisplayRegional111Text() end function StartDisplayParkText() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "park.html", 0, MSG_TOP + MSG_LEFT, MSG_REG, TRUE ); end function StopDisplayParkText() end function StartDisplayExitText() SysCall("ScenarioManager:ShowInfoMessageExt", "INTERCOM", "exit.html", 0, MSG_TOP + MSG_LEFT, MSG_REG, TRUE ); end function StopDisplayExitText() end -- Cameras function ShowCamera(camera) SysCall("CameraManager:ActivateCamera",camera,0); end -- Events function OnEvent(event) return _G["OnEvent" .. event](); end function OnEventCheck() SysCall("ScenarioManager:BeginConditionCheck","Check"); end function OnEventLimits() SysCall("ScenarioManager:BeginConditionCheck","Limits"); SysCall("ScenarioManager:ShowMessage", "INFO","Shunting Limits active",1) end function OnEventLights() SysCall("PlayerEngine:SetControlValue","Headlights",0,1); end function OnEventIntroCine() SysCall("ScenarioManager:PlayDialogueSound","../epic.wav"); ShowCamera("IntroCine"); end function OnEventIntroVid() SysCall("ScenarioManager:PlayVideoMessage", "../DB323.ogv", CALL, FALSE, NO_CONTROLS,0); end function OnEventInfoText() DisplayRecordedMessage("InfoText"); end function OnEventStopIntro() SysCall("ScenarioManager:StopDialogueSound","../epic.wav"); SysCall("ScenarioManager:StopVideoMessage", "../DB323.ogv"); end function OnEventIntroText() DisplayRecordedMessage("IntroText"); end function OnEventShuntbdrText() DisplayRecordedMessage("ShuntbdrText"); end function OnEventTEE103Text() DisplayRecordedMessage("TEE103Text"); end function OnEventFreight151Text() DisplayRecordedMessage("Freight151Text"); end function OnEventIR120Text() DisplayRecordedMessage("IR120Text"); end function OnEventRegional111Text() DisplayRecordedMessage("Regional111Text"); end function OnEventParkText() DisplayRecordedMessage("ParkText"); end function OnEventExitText() DisplayRecordedMessage("ExitText"); end -- Testconditions function TestCondition(condition) return _G["TestCondition" .. condition](); end function TestConditionCheck() mas=math.floor(SysCall("PlayerEngine:GetConsistTotalMass")); rev=SysCall("PlayerEngine:GetControlValue","Reverser",0); if(rev==-1) then SysCall("PlayerEngine:SetControlValue","Headlights",0,2); elseif(rev==1)then SysCall("PlayerEngine:SetControlValue","Headlights",0,1); end if (mas~=gweight) then SysCall("ScenarioManager:ShowMessage", "INFO","Consist weight: " .. mas .. "t",1); gweight=mas; end return CONDITION_NOT_YET_MET; end function TestConditionLimits() dst1=SysCall("ScenarioManager:IsAtDestination","DB323","Shunting Boundary SW"); dst2=SysCall("ScenarioManager:IsAtDestination","DB323","Shunting Boundary NW"); dst3=SysCall("ScenarioManager:IsAtDestination","DB323","SBSW Stop"); dst4=SysCall("ScenarioManager:IsAtDestination","DB323","SBNW Stop"); if (dst1==1 and tmpd1==0) then SysCall("ScenarioManager:ShowMessage", "Warning","Shunting Limits reached",1); tmpd1=1; end if (dst2==1 and tmpd2==0) then SysCall("ScenarioManager:ShowMessage", "Warning","Shunting Limits reached",1); tmpd2=1; end if (dst1==0 and tmpd1==1) then tmpd1=0; end if (dst2==0 and tmpd2==1) then tmpd2=0; end if (dst3==1 or dst4==1)then SysCall("ScenarioManager:TriggerScenarioFailure", "Shunting Limits exceeded"); return CONDITION_FAILED; end return CONDITION_NOT_YET_MET; end