Dudas con los scripts de señales luminosas
Dudas con los scripts de señales luminosas
Hola a todos,
Hace unos días me metí a modificar el script de las luminosas para hacer un pequeño cambio (el estado de pre anuncio de amarillo en vez de ser verde y amarillo estaba marcado amarillo y blanco). Y ya que me puse, estoy intentando implementarle las 4 opciones que tienen las luminosas desde hace unas versiones con mis conocimientos básicos de RW.
- Aquí se puede poner una letra o carácter para que este se envíe a paneles luminosos que muestren itinerario. Las señales alemanas ya tienen esta funcionalidad (aunque yo no he conseguido hacerla funcionar), según se aprecia en este vídeo : http://www.youtube.com/watch?v=8N3GOa4nQeg. Simplemente llamando a GetLinkFeatherChar se obtiene el carácter que está introducido en el editor, pero lo que no tengo ni idea es cómo se conectan la señal y el panel porque en el script alemán tampoco lo veo.
Hay un mensaje que se pasa entre señales Call( "SendSignalMessage", SIGNAL_ROUTE_INDICATION, newTheatreChar, -1, 1, 0 ) para que el panel reciba el carácter PERO la constante SIGNAL_ROUTE_INDICATION cuyo código es 21, comparte este código con otras constantes y sigo sin saber, luego el panel cuando recibe el mensaje cómo sabe que es de su señal "padre".
- Este ya funciona con las señales, para una determinada posición de las agujas, aplica la limitación de velocidad que aquí se especifique entre los dos marcadores de la señal.
- Con este tengo algo más de duda, se supone que es para habilitar el control de aproximación que se usa en UK ante desvíos para poner la señal en rojo o amarillo has instantes antes que llegue el tren. Aquí lo explican de forma detallada, http://www.davros.org/rail/signalling/ar...tions.html. Esto por ejemplo creo que en España no se hace y no sé si tendría mucho sentido implementar. Igual se le podría dar otro uso.
- Este es el más fácil de todos y con un par de líneas de código ya lo he hecho. Si se activa esta casilla, este itinerario en lugar de darse en verde se dará en amarillo. Está muy bien para desviadas o vías muertas que hasta ahora se daban en verde.
Si alguno sabéis cómo hacer funcionar las señales alemanas para aunque sea corroborar que su script es correcto sería de gran ayuda.
Saludos y gracias!!
Buenas andertrains, sobre odificar el scrit, yo ni idea, pero sobre lo que comentas de que mostraban mal las indicaciones, reinstala la señales luminosas y se corrige el error.
Tenía las señales en la última versión aunque no sé si alguna ruta pudo haber modificado los colores del script. Volver a poner el anuncio de amarillo con verde y amarillo es una tontería pero ya que me metía con el script por eso comentaba si puede ser interesante meter las nuevas funcionalidades.
AnderTrains Tenía las señales en la última versión aunque no sé si alguna ruta pudo haber modificado los colores del script. Volver a poner el anuncio de amarillo con verde y amarillo es una tontería pero ya que me metía con el script por eso comentaba si puede ser interesante meter las nuevas funcionalidades.
AnderTrains Tenía las señales en la última versión aunque no sé si alguna ruta pudo haber modificado los colores del script. Volver a poner el anuncio de amarillo con verde y amarillo es una tontería pero ya que me metía con el script por eso comentaba si puede ser interesante meter las nuevas funcionalidades.
Alguno ha conseguido alguna vez hacer funcionar los paneles de letras con las señales alemanas? Yo no consigo hacerlo :roll:
Igual te podría ayudar en lo de los scripts, si me dices que tienen que hacer los semáforos igual lo podemos hacer
¿Que scripts son?¿Los que tenemos actualmente?
Os dejo esto por si os pudiera ayudar a definir todas las funciones de las luminosas
HANNIBAL SMITH Igual te podría ayudar en lo de los scripts, si me dices que tienen que hacer los semáforos igual lo podemos hacer![]()
¿Que scripts son?¿Los que tenemos actualmente?
-- ACTIVATE ROUTE INDICATOR
-- Switches speed indicators on and off depending on connected link
--
function ActivateRouteIndicator ( connectedLink )
local newTheatreChar = Call("GetLinkFeatherChar", connectedLink)
-- KJM 18-Mar-2010 turn off indicators when signal red
if newTheatreChar == nil or gSignalState == BLOCKED then
newTheatreChar = ""
else
newTheatreChar = string.char(newTheatreChar)
end
DebugPrint ( ("DEBUG: " .. gId .. " ActivateRouteIndicator() - GetLinkFeatherChar ( " .. connectedLink .. " ) returns '" .. newTheatreChar .. "'" ) )
if newTheatreChar ~= gCurrentTheatreChar then
DebugPrint ( ("DEBUG: " .. gId .. " ActivateRouteIndicator() - SendSignalMessage( " .. SIGNAL_ROUTE_INDICATION .. ", " ..newTheatreChar .. ", -1, 1, 0 )" ) )
Call( "SendSignalMessage", SIGNAL_ROUTE_INDICATION, newTheatreChar, -1, 1, 0 )
gCurrentTheatreChar = newTheatreChar
end
end
-- ACTIVATE SPEED INDICATOR
-- Switches speed indicators on and off depending on connected link
--
function ActivateSpeedIndicator ( connectedLink )
local newIndicator = ""
local newSpeedLimit = -1
-- If we're connected to a valid link and the signal we're attached to isn't red
if connectedLink >= 0 and gSignalState ~= BLOCKED and gPreparedness ~= SIGNAL_UNPREPARED then
-- Check what speed limit indicators (if any) are applicable to that route
newSpeedLimit = Call("GetLinkSpeedLimit", connectedLink)
DebugPrint(("DEBUG: " .. gId .. " ActivateSpeedIndicator() - switch speed limit on connected link " .. connectedLink .. " is " .. newSpeedLimit ))
-- If route has a valid switch speed limit, turn it into a character to activate the appropriate indicator
-- KJM Shouldn't display anything if more than 100
-- if newSpeedLimit[i] > 0 and newSpeedLimit[i] < 130 then
if newSpeedLimit > 0 and newSpeedLimit < 110 then
newIndicator = "" .. math.floor(newSpeedLimit / 10)
-- Speed limits higher than 100km/h ("10") are triggered using a letter
if newIndicator == "10" then newIndicator = "a"
elseif newIndicator == "11" then newIndicator = "b"
elseif newIndicator == "12" then newIndicator = "c"
end
DebugPrint(("DEBUG: " .. gId .. " ActivateSpeedIndicator() - switch speed limit to character " .. newIndicator ))
-- Otherwise, treat as unlimited speed
else
newSpeedLimit = -1
end
end
-- If we have a Zs3 head and the switch speed limit at this signal has changed...
if gCurrentIndicator ~= newIndicator then
if ZS3_SIGNAL_HEAD_NAME ~= nil then
-- Switch new texture on - this should get rid of the old texture too
Call( ZS3_SIGNAL_HEAD_NAME .. "SetText", newIndicator, PRIMARY_TEXT )
end
DebugPrint(("DEBUG: " .. gId .. " ActivateSpeedIndicator() - MAIN switch speed indicator switching from " .. gCurrentIndicator .. " to " .. newIndicator))
DebugPrint( ( "SEND: " .. gId .. " ActivateSpeedIndicator() - SIGNAL_ROUTE_SPEED_LIMIT" ) )
Call( "SendSignalMessage", SIGNAL_ROUTE_SPEED_LIMIT, "" .. newSpeedLimit, -1, 1, 0 )
-- Remember which indicator we just switched on
gCurrentIndicator = newIndicator
end
end
-- ACTIVATE ROUTE INDICATOR
-- Switches route indicators on and off depending on connected link
function ActivateRouteIndicator()
DebugPrint( ("DEBUG: " .. gId .. " ActivateRouteIndicator(" .. gConnectedLink .. " , " .. newTheatreChar .. ")") )
if switchedOff then
Call( "SetText", "", PRIMARY_TEXT )
else
Call( "SetText", newTheatreChar, PRIMARY_TEXT )
end
end
HANNIBAL SMITH Igual te podría ayudar en lo de los scripts, si me dices que tienen que hacer los semáforos igual lo podemos hacer![]()
¿Que scripts son?¿Los que tenemos actualmente?
-- ACTIVATE ROUTE INDICATOR
-- Switches speed indicators on and off depending on connected link
--
function ActivateRouteIndicator ( connectedLink )
local newTheatreChar = Call("GetLinkFeatherChar", connectedLink)
-- KJM 18-Mar-2010 turn off indicators when signal red
if newTheatreChar == nil or gSignalState == BLOCKED then
newTheatreChar = ""
else
newTheatreChar = string.char(newTheatreChar)
end
DebugPrint ( ("DEBUG: " .. gId .. " ActivateRouteIndicator() - GetLinkFeatherChar ( " .. connectedLink .. " ) returns '" .. newTheatreChar .. "'" ) )
if newTheatreChar ~= gCurrentTheatreChar then
DebugPrint ( ("DEBUG: " .. gId .. " ActivateRouteIndicator() - SendSignalMessage( " .. SIGNAL_ROUTE_INDICATION .. ", " ..newTheatreChar .. ", -1, 1, 0 )" ) )
Call( "SendSignalMessage", SIGNAL_ROUTE_INDICATION, newTheatreChar, -1, 1, 0 )
gCurrentTheatreChar = newTheatreChar
end
end
-- ACTIVATE SPEED INDICATOR
-- Switches speed indicators on and off depending on connected link
--
function ActivateSpeedIndicator ( connectedLink )
local newIndicator = ""
local newSpeedLimit = -1
-- If we're connected to a valid link and the signal we're attached to isn't red
if connectedLink >= 0 and gSignalState ~= BLOCKED and gPreparedness ~= SIGNAL_UNPREPARED then
-- Check what speed limit indicators (if any) are applicable to that route
newSpeedLimit = Call("GetLinkSpeedLimit", connectedLink)
DebugPrint(("DEBUG: " .. gId .. " ActivateSpeedIndicator() - switch speed limit on connected link " .. connectedLink .. " is " .. newSpeedLimit ))
-- If route has a valid switch speed limit, turn it into a character to activate the appropriate indicator
-- KJM Shouldn't display anything if more than 100
-- if newSpeedLimit[i] > 0 and newSpeedLimit[i] < 130 then
if newSpeedLimit > 0 and newSpeedLimit < 110 then
newIndicator = "" .. math.floor(newSpeedLimit / 10)
-- Speed limits higher than 100km/h ("10") are triggered using a letter
if newIndicator == "10" then newIndicator = "a"
elseif newIndicator == "11" then newIndicator = "b"
elseif newIndicator == "12" then newIndicator = "c"
end
DebugPrint(("DEBUG: " .. gId .. " ActivateSpeedIndicator() - switch speed limit to character " .. newIndicator ))
-- Otherwise, treat as unlimited speed
else
newSpeedLimit = -1
end
end
-- If we have a Zs3 head and the switch speed limit at this signal has changed...
if gCurrentIndicator ~= newIndicator then
if ZS3_SIGNAL_HEAD_NAME ~= nil then
-- Switch new texture on - this should get rid of the old texture too
Call( ZS3_SIGNAL_HEAD_NAME .. "SetText", newIndicator, PRIMARY_TEXT )
end
DebugPrint(("DEBUG: " .. gId .. " ActivateSpeedIndicator() - MAIN switch speed indicator switching from " .. gCurrentIndicator .. " to " .. newIndicator))
DebugPrint( ( "SEND: " .. gId .. " ActivateSpeedIndicator() - SIGNAL_ROUTE_SPEED_LIMIT" ) )
Call( "SendSignalMessage", SIGNAL_ROUTE_SPEED_LIMIT, "" .. newSpeedLimit, -1, 1, 0 )
-- Remember which indicator we just switched on
gCurrentIndicator = newIndicator
end
end
-- ACTIVATE ROUTE INDICATOR
-- Switches route indicators on and off depending on connected link
function ActivateRouteIndicator()
DebugPrint( ("DEBUG: " .. gId .. " ActivateRouteIndicator(" .. gConnectedLink .. " , " .. newTheatreChar .. ")") )
if switchedOff then
Call( "SetText", "", PRIMARY_TEXT )
else
Call( "SetText", newTheatreChar, PRIMARY_TEXT )
end
end
Por lo que yo entiendo lo que haces con SetText es activar una textura, en este caso la primaria y por otro lado newIndicator es una variable que recoge el texto a poner donde sea, lo puede poner en una señal o en otra, donde se quiera.
Ahora bien, parece como que hay unas texturas predefinidas con las letras que se van a poner en los paneles y se activan a demanda.
Yo lo que entiendo aquí es:
if ZS3_SIGNAL_HEAD_NAME ~= nil then
Call( ZS3_SIGNAL_HEAD_NAME .. "SetText", newIndicator, PRIMARY_TEXT )
Si ZS3_SIGNAL_HEAD_NAME es diferente a nada, si el indicador no está vacío, entonces cambia de textura primaria (SetText) con lo que hay en newIndicator, que puede ser a, b ó c, la velocidad establecida.
Ahora hay que ver que es ZS3_SIGNAL_HEAD_NAME, me imagino que será el nombre del objeto donde sale el numero y la letra.
¿Que ruta es? que me la miro, de todas formas si tienes skype o similar igual mejor, así ponemos en común todo a ver si sacamos algo en claro. :lol:
Ya que estais puestos, os pongo estos GIFs animados, a ver si os sirven.