Limitar velocidad composicion en todo el escenario
Limitar velocidad composicion en todo el escenario
Saludos compañer@s forer@s.
He visto en algún escenario, que aunque la velocidad de la ruta sea por ejemplo de 180 km, la composicion al rebasar una velocidad determinada, pongamos 120, sale una ventana con un mensaje en el que avisa que la velocidad máxima permitida de esa composición es de 120 km/h.
Estoy preparando un escenario y por ubicación en el tiempo (año donde se realiza el escenario), me encuentro que la ruta tiene tramos de 200 km/h y por hacerlo más real, queria limitar la velocidad máxima de la composición.
Alguien me puede ayudar a realizar esta acción.
Gracias por anticipado y un cordial saludo a tod@s.
Es algo complicadillo, ya que si no me equivoco, se hace mediante LUA scripting.
Gracias Bermudez por la respuesta, ya me temia yo que esto no era cosa de pinchar aqui y poner numeritos.
Muy agradecido, pensaremos que poder hacer más real el escenario.
Saludos
function OnEvent ( event )
if event == "inicio_25" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition1" );
return TRUE;
end
if event == "fin_25" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition1" );
return TRUE;
end -- if event...
if event == "inicio_50" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "fin_50" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "pasas_de_25" then -- Trigger at reached 30mph
-- show html briefing '30mph Reached'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 25 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
if event == "pasas_de_50" then -- Trigger at reached 10mph
-- show html briefing 'Stopped'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 50 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
end
function TestCondition ( condition )
if condition == "SpeedCondition1" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 11.623 then -- 25mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_25", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
if condition == "SpeedCondition2" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 22.799 then -- 50mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_50", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
end
Una vez que se sabe programar LUA, el script necesario para limitar las velocidades es bastante sencillo. Yo tengo un escenario en el Workshop de TS2014 donde utilicé un script para limitar las velocidades en dos fases, una a 25 mph y otra a 50 mph. La sección de limitación es más o menos así:
function OnEvent ( event )
if event == "inicio_25" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition1" );
return TRUE;
end
if event == "fin_25" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition1" );
return TRUE;
end -- if event...
if event == "inicio_50" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "fin_50" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "pasas_de_25" then -- Trigger at reached 30mph
-- show html briefing '30mph Reached'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 25 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
if event == "pasas_de_50" then -- Trigger at reached 10mph
-- show html briefing 'Stopped'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 50 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
end
function TestCondition ( condition )
if condition == "SpeedCondition1" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 11.623 then -- 25mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_25", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
if condition == "SpeedCondition2" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 22.799 then -- 50mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_50", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
end
FALSE = 0
TRUE = 1
-- condition return values
CONDITION_NOT_YET_MET = 0
CONDITION_SUCCEEDED = 1
CONDITION_FAILED = 2
-- 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
------------------------------------------------
-- Fn OnEvent
-- event - name of the event
-- return - TRUE/FALSE if event handled
function OnEvent ( event )
-- Instruction triggers
---------------------------
if event == "camera_start" then
SysCall ( "CameraManager:ActivateCamera", "cam_1", 0 );
SysCall ( "ScenarioManager:LockControls");
return TRUE;
end
if event == "camera_end" then
SysCall ( "CameraManager:CabCamera", 0 );
SysCall ( "ScenarioManager:UnlockControls");
return TRUE;
end
if event == "inicio_25" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition1" );
return TRUE;
end
if event == "fin_25" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition1" );
return TRUE;
end -- if event...
if event == "inicio_50" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "fin_50" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition2" );
return TRUE;
end -- if event...
if event == "snow" then
SysCall("WeatherController:SetCurrentWeatherEventChain", "TheStormChain");
return TRUE;
end -- if event == "StormStart"
-- Timed triggers
---------------------------
if event == "pasas_de_25" then -- Trigger at reached 30mph
-- show html briefing '30mph Reached'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 25 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
if event == "pasas_de_50" then -- Trigger at reached 10mph
-- show html briefing 'Stopped'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 50 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
end -- function OnEvent ( event )
------------------------------------------------
-- Fn TestCondition
-- condition - name of the condition
-- return state of the condition
function TestCondition ( condition )
if condition == "SpeedCondition1" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 11.623 then -- 25mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_25", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
if condition == "SpeedCondition2" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 22.799 then -- 50mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_50", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
end -- function TestCondition ( condition )
El script de escenario funciona solo con las funciones de declaración de eventos ('OnEvent ( event ) '), y declaración de condiciones ('TestCondition ( condition )'). Los eventos se indican como 'triggers' en el editor de escenarios o se toman en el mismo script en la función de condiciones.
Los eventos 'inicio_25', 'fin_25', 'inicio_50', 'fin_50' son tomados del editor de escenarios, mientras que los nombrados 'pasas_de_25' y 'pasas_de_50' son tomados de la funciones de condiciones.
En el script de este escenario hay además eventos para cámaras cinemáticas y meteorología especial, aunque estas propiedades se definen solamente en la función de eventos y se toman de los 'triggers' del editor de escenarios:
FALSE = 0
TRUE = 1
-- condition return values
CONDITION_NOT_YET_MET = 0
CONDITION_SUCCEEDED = 1
CONDITION_FAILED = 2
-- 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
------------------------------------------------
-- Fn OnEvent
-- event - name of the event
-- return - TRUE/FALSE if event handled
function OnEvent ( event )
-- Instruction triggers
---------------------------
if event == "camera_start" then
SysCall ( "CameraManager:ActivateCamera", "cam_1", 0 );
SysCall ( "ScenarioManager:LockControls");
return TRUE;
end
if event == "camera_end" then
SysCall ( "CameraManager:CabCamera", 0 );
SysCall ( "ScenarioManager:UnlockControls");
return TRUE;
end
if event == "inicio_25" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition1" );
return TRUE;
end
if event == "fin_25" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition1" );
return TRUE;
end -- if event...
if event == "inicio_50" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "fin_50" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition2" );
return TRUE;
end -- if event...
if event == "snow" then
SysCall("WeatherController:SetCurrentWeatherEventChain", "TheStormChain");
return TRUE;
end -- if event == "StormStart"
-- Timed triggers
---------------------------
if event == "pasas_de_25" then -- Trigger at reached 30mph
-- show html briefing '30mph Reached'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 25 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
if event == "pasas_de_50" then -- Trigger at reached 10mph
-- show html briefing 'Stopped'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 50 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
end -- function OnEvent ( event )
------------------------------------------------
-- Fn TestCondition
-- condition - name of the condition
-- return state of the condition
function TestCondition ( condition )
if condition == "SpeedCondition1" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 11.623 then -- 25mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_25", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
if condition == "SpeedCondition2" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 22.799 then -- 50mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_50", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
end -- function TestCondition ( condition )
el_pinchos El script de escenario funciona solo con las funciones de declaración de eventos ('OnEvent ( event ) '), y declaración de condiciones ('TestCondition ( condition )'). Los eventos se indican como 'triggers' en el editor de escenarios o se toman en el mismo script en la función de condiciones.De acuerdo, muchisimas gracias. :maestro: Yo de momento solo me habia mirado los scripts del material rodante.
Los eventos 'inicio_25', 'fin_25', 'inicio_50', 'fin_50' son tomados del editor de escenarios, mientras que los nombrados 'pasas_de_25' y 'pasas_de_50' son tomados de la funciones de condiciones.
En el script de este escenario hay además eventos para cámaras cinemáticas y meteorología especial, aunque estas propiedades se definen solamente en la función de eventos y se toman de los 'triggers' del editor de escenarios:
Código:FALSE = 0
TRUE = 1
-- condition return values
CONDITION_NOT_YET_MET = 0
CONDITION_SUCCEEDED = 1
CONDITION_FAILED = 2
-- 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
------------------------------------------------
-- Fn OnEvent
-- event - name of the event
-- return - TRUE/FALSE if event handled
function OnEvent ( event )
-- Instruction triggers
---------------------------
if event == "camera_start" then
SysCall ( "CameraManager:ActivateCamera", "cam_1", 0 );
SysCall ( "ScenarioManager:LockControls");
return TRUE;
end
if event == "camera_end" then
SysCall ( "CameraManager:CabCamera", 0 );
SysCall ( "ScenarioManager:UnlockControls");
return TRUE;
end
if event == "inicio_25" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition1" );
return TRUE;
end
if event == "fin_25" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition1" );
return TRUE;
end -- if event...
if event == "inicio_50" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "fin_50" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition2" );
return TRUE;
end -- if event...
if event == "snow" then
SysCall("WeatherController:SetCurrentWeatherEventChain", "TheStormChain");
return TRUE;
end -- if event == "StormStart"
-- Timed triggers
---------------------------
if event == "pasas_de_25" then -- Trigger at reached 30mph
-- show html briefing '30mph Reached'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 25 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
if event == "pasas_de_50" then -- Trigger at reached 10mph
-- show html briefing 'Stopped'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 50 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
end -- function OnEvent ( event )
------------------------------------------------
-- Fn TestCondition
-- condition - name of the condition
-- return state of the condition
function TestCondition ( condition )
if condition == "SpeedCondition1" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 11.623 then -- 25mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_25", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
if condition == "SpeedCondition2" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 22.799 then -- 50mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_50", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
end -- function TestCondition ( condition )
el_pinchos El script de escenario funciona solo con las funciones de declaración de eventos ('OnEvent ( event ) '), y declaración de condiciones ('TestCondition ( condition )'). Los eventos se indican como 'triggers' en el editor de escenarios o se toman en el mismo script en la función de condiciones.De acuerdo, muchisimas gracias. :maestro: Yo de momento solo me habia mirado los scripts del material rodante.
Los eventos 'inicio_25', 'fin_25', 'inicio_50', 'fin_50' son tomados del editor de escenarios, mientras que los nombrados 'pasas_de_25' y 'pasas_de_50' son tomados de la funciones de condiciones.
En el script de este escenario hay además eventos para cámaras cinemáticas y meteorología especial, aunque estas propiedades se definen solamente en la función de eventos y se toman de los 'triggers' del editor de escenarios:
Código:FALSE = 0
TRUE = 1
-- condition return values
CONDITION_NOT_YET_MET = 0
CONDITION_SUCCEEDED = 1
CONDITION_FAILED = 2
-- 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
------------------------------------------------
-- Fn OnEvent
-- event - name of the event
-- return - TRUE/FALSE if event handled
function OnEvent ( event )
-- Instruction triggers
---------------------------
if event == "camera_start" then
SysCall ( "CameraManager:ActivateCamera", "cam_1", 0 );
SysCall ( "ScenarioManager:LockControls");
return TRUE;
end
if event == "camera_end" then
SysCall ( "CameraManager:CabCamera", 0 );
SysCall ( "ScenarioManager:UnlockControls");
return TRUE;
end
if event == "inicio_25" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition1" );
return TRUE;
end
if event == "fin_25" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition1" );
return TRUE;
end -- if event...
if event == "inicio_50" then
SysCall ( "ScenarioManager:BeginConditionCheck", "SpeedCondition2" );
return TRUE;
end
if event == "fin_50" then
SysCall ( "ScenarioManager:EndConditionCheck", "SpeedCondition2" );
return TRUE;
end -- if event...
if event == "snow" then
SysCall("WeatherController:SetCurrentWeatherEventChain", "TheStormChain");
return TRUE;
end -- if event == "StormStart"
-- Timed triggers
---------------------------
if event == "pasas_de_25" then -- Trigger at reached 30mph
-- show html briefing '30mph Reached'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 25 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
if event == "pasas_de_50" then -- Trigger at reached 10mph
-- show html briefing 'Stopped'
SysCall ( "ScenarioManager:ShowMessage", "Penalty Brake. Remember: max speed permited is 50 MPH" );
SysCall ( "PlayerEngine:SetControlValue", "Regulator", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "Reverser", 0, 0.0);
SysCall ( "PlayerEngine:SetControlValue", "TrainBrakeControl", 0, 1.0);
--return TRUE;
end -- if event == "SpeedReached" then
end -- function OnEvent ( event )
------------------------------------------------
-- Fn TestCondition
-- condition - name of the condition
-- return state of the condition
function TestCondition ( condition )
if condition == "SpeedCondition1" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 11.623 then -- 25mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_25", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
if condition == "SpeedCondition2" then
speed = SysCall ( "PlayerEngine:GetSpeed" );
if speed > 22.799 then -- 50mph
SysCall ( "ScenarioManager:TriggerDeferredEvent", "pasas_de_50", 0.1 );
return CONDITION_NOT_YET_MET;
end -- if speed...
end -- if condition...
end -- function TestCondition ( condition )
Estimados compañeros.
Solo daros las gracias por estas respuestas, que a un "aprendiz" como yo, le animan a enciscarme en esto de los escenarios.
Os pondria miles de [ y otros miles de :maestro: porque sois verdaderos genios.
De verdad, muchisimas gracias, creo que vuestros comentarios ayudaran a muchos creadores.
Un cordial saludo.
Obispo Rojo