It is the check on BLOCK_CLEAR which needs to be replaced.
In the script as shown, the signal will only clear if the block ahead is fully clear of trains, i.e. not occupied.
If callon is required, there must be a separate check on BLOCK_OCCUPIED.
The most simple form of the script would be :
SCRIPT UKSemHome
extern float block_state ();
extern float route_set ();
extern float def_draw_state ();
extern float state;
extern float draw_state;
extern float enabled;
if (!enabled ||
block_state() ==# BLOCK_JN_OBSTRUCTED ||
!route_set())
{
// route is not available
state = SIGASP_STOP;
}
else if (block_state() ==# BLOCK_CLEAR)
{
// route is clear
state = SIGASP_CLEAR_2;
}
else
// block_state is now BLOCK_OCCUPIED, this is the call on situation
{
state = SIGASP_RESTRICTED;
}
draw_state = def_draw_state (state);
In the above script, any train will always proceed on block occupied.
That's probably not what you want, so an additional check must be inserted to ensure trains will only be allowed to pass if the block is occupied if they have a reason to do so, e.g. when attaching.
This check can be do with the function
TrainHasCallOn().
The final 'else' would then be :
else
// block_state is now BLOCK_OCCUPIED, this is the callon situation
{
state = SIGASP_STOP; // default state is stop
if (TrainHasCallOn()) // if train has callon allowed, it may pass this signal
{
state = SIGASP_RESTRICTED;
}
}
You can find full description of the TrainHasCallOn function in the manual.
Regards,
Rob Roeterdink