albinopigeon wrote:What works depends on what link is in front. Either the arms work for the set routes and the indicator does nothing, or the indicator works and only the highest-numbered arm rises.
New elephant in the room: The logic wants the indicator routes to be the highest numbered. So despite the locality, it will be necessary to arrange the routes like this:
Route 1 goes to down siding, associated with arm 1 on the left.
Route 2 goes the up sidings, associated with arm 2 on the right.
Routes 3 to 8 go to the platforms, associated with arm 3 in the middle. So the indicator ID is __123456. The two _ are important, of course, telling the indicator to shut up for route 1 and 2.
I would try that before taken any other step.
(The indicator link always goes in advance of the signal link no. 0, so the signal link's arrow points to the indicator link. Otherwise, the indicator becomes an indicator of the signal in approach and if that exists, it does nothing there, as there is no junction to signal there.)
albinopigeon wrote:I have it set up as an Animated Signal Blueprint; is that correct for what we are trying to achieve?
Sure.
albinopigeon wrote:I may have to go back to my original method of coding it as a co-acting arm. Is there anything I can do to the indicator script beyond setting the closedCharacter at 0 (to represent a blank indicator)?
No. And having an explicit closedCharacter rules out another option to fail, that may be a red herring. So basically, I am just puzzled you have this 2 in the name of the .out file but that may be because there was an update in 2017 adding this closedCharacter feature.
Anyway I put enclose the version of the file lying around on my disk here. You may want to stick that into FP External Text-based Indicator.lua and change the require line accordingly and see whether it does anything. But I can't figure out how it would make a difference.
- Code: Select all
--------------------------------------------------------------------------------------
-- A theater box type indicator in a separate slave object controlled by the master stop signal
-- The current implementation is based on texture set switching.
--
require "Assets/AndiS/FPSignals/scripts/Shared by All.out"
function Initialise ()
InitialiseId()
InitialiseConstantsAndArrays()
gConnectedLink = 0
gAnimState = -1
gInitialised = false -- has the route finished loading yet?
ResetSignalState ()
end
function ResetSignalState ( )
gId = Call ("GetId") -- TODO: insert parsing for special codes in ID here
if gId == nil or gId == "" then
ErrorPrint("ResetSignalState", "Indicator without ID shows nothing")
gInitialised = true -- do nothing on update (a bit redundant since BeginUpdate is not called)
else
gInitialised = false -- induce resending of SIGNAL_I_AM_ARM
Call( "BeginUpdate" )
end
end
function OnConsistPass ( prevFrontDist, prevBackDist, frontDist, backDist, linkIndex )
-- don't care about trains
end
--------------------------------------------------------------------------------------
-- UPDATE
--
function Update (time)
if gInitialised then
else
SimpleSendTestMessageWithinLinks()
-- new 21 Sept 2017
if closedCharacter == nil then
Call( "SetText", "", 0 )
else
Call( "SetText", closedCharacter, 0 )
end
Call( "SendSignalMessage", SIGNAL_I_AM_INDICATOR, gId, -1, 1, 0 )
gInitialised = true
Call ("EndUpdate")
end
end
-------------------------------------------------------------------------------------
-- ON SIGNAL MESSAGE
-- Shunt signals just forward the signal messages on to other signals
--
function OnSignalMessage( message, parameter, direction, linkIndex )
MessageLog( message, parameter, direction, linkIndex )
if (message == RESET_SIGNAL_STATE) then
ResetSignalState()
elseif (message == SHOW) then
-- new 21 Sept 2017
if closedCharacter == nil or parameter ~= "" then
Call( "SetText", parameter, 0 )
else
Call( "SetText", closedCharacter, 0 )
end
elseif message == OPEN_LOG then
OpenLog(parameter, direction, linkIndex)
-- Ignore initialisation messages from trains straddling a link - these will have the "DoNotForward" parameter
-- Otherwise forward on the message
elseif parameter ~= "DoNotForward" then
Call( "SendSignalMessage", message, parameter, -direction, 1, linkIndex )
end
end
albinopigeon wrote:Also the FP Route.lua script you mentioned is different to the one required in the script I wrote (literally two lines) for the indicator, so that might hold the answer. Ken and I might just not be looking into this hard enough!
FP Route.lua is what drives the editor-only object Ken put near the buffer stops (called Route Token in the manual). This is the sender and your two-line script is the receiver.