Elvas Tower: SigCfg and SigScr files for OpenRails - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

SigCfg and SigScr files for OpenRails Authors of OpenRails, please, help! Rate Topic: -----

#1 User is offline   APK-LVDZ 

  • Apprentice
  • Group: Status: Inactive
  • Posts: 44
  • Joined: 10-November 12
  • Gender:Male
  • Location:Riga, Latvia
  • Simulator:MSTS, OpenRails
  • Country:

Posted 10 November 2012 - 12:22 PM

Hello, I'm from Latvia, my primary language is russian and latvian, please sorry if I will write with errors.

Signal problem: I have experience of signal making, and good to know scripts commands and structure. Please increase signal working!


1. Any signal has several different subsignals. Types are:

- NORMAL - in a track monitor, set speed, have or havent signal light in signal

- DISTANCE - no watched, but very good for programming, increase opportunities, have or havent signal light in signal

- REPEATER - no watched, but very good for programming, increase opportunities, have or havent signal light in signal

- INFO - no watched, but very good for programming, increase opportunities, have or havent signal light in signal

- SHUNTING - no watched, but very good for programming, increase opportunities, have or havent signal light in signal

Any of this types save one number (for convenience this have a reserved word, but number is not error for use):

0 - STOP

1 - STOP_AND_PROCEED

2 - RESTRICTING

3 - APPROACH_1

4 - APPROACH_2

5 - APPROACH_3

6 - CLEAR_1

7 - CLEAR_2

For any of this number programmer assign signal lights.


2. The simulator has some functions (I will write who know):

block_state() ==# BLOCK_JN_OBSTRUCTED - return true, if in route to next signal, with contain type NORMAL, has wrong junction. Else - false.

block_state() ==# BLOCK_BLOCK_CLEAR - return true, if one block in route to next signal, with contain type NORMAL, hasn't wrong junction and hasn't a train.

block_state() ==# BLOCK_OCCUPIED - return true, if in route to next signal, with contain type NORMAL, has train.


3. next_sig_lr ( SIGFN_*** ) - return most above of subsignal number in first signal than contain this subsignal type

next_sig_mr ( SIGFN_*** ) - return most restricted of subsignal number in first signal than contain this subsignal type

Example:

In file SigCfg:

SignalFnType ( NORMAL )
SignalFnType ( NORMAL )
SignalFnType ( DISTANCE )
SignalFnType ( NORMAL )
....
SignalShape (
"***.s"
"***"
SignalSubObjs ( 4
SignalSubObj ( 0
"SIGNAL" "***"
SigSubType ( SIGNAL_HEAD )
SigSubSType ( "****" )
)
SignalSubObj ( 1
"SIGNAL" "***"
SigSubType ( SIGNAL_HEAD )
SigSubSType ( "****" )
)
SignalSubObj ( 2
"SIGNAL" "***"
SigSubType ( SIGNAL_HEAD )
SigSubSType ( "****" )
)
SignalSubObj ( 3
"SIGNAL" " "
SigSubType ( SIGNAL_HEAD )
SigSubSType ( "***" )
)
)
)








Next signal has 4 subsignal:

NORMAL=STOP_AND_PROCEED

NORMAL=APPROACH_2

DISTANCE=STOP

NORMAL=APPROACH_1

First function returns:

next_sig_lr ( SIGFN_NORMAL ) = APPROACH_2 (4 in type NORMAL is above 1)

next_sig_mr ( SIGFN_NORMAL ) = STOP_AND_PROCEED (1 in type NORMAL is restricted of 4)

next_sig_lr ( SIGFN_DISTANCE ) = STOP (signal has one subtype, because STOP, because DISTANCE=STOP)

next_sig_mr ( SIGFN_DISTANCE ) = STOP (signal has one subtype, because STOP, because DISTANCE=STOP)

others types INFO, SHUNTING and REPEATER searchs its type in next signals, because this can't find in example signal. If signal with this type can't find, then return STOP, because this is most restricted.

!!! The track monitor draw and set speed of next_sig_lr ( SIGFN_NORMAL ) function returned number.


4. opp_sig_lr ( SIGFN_*** ) - return most above of subsignal number in back first signal than contain this subsignal type

opp_sig_mr ( SIGFN_*** ) - return most restricted of subsignal number in back first signal than contain this subsignal type

In Microsoft Trains Simulator this option work not good, with NORMAL, and after junctions working, but if will works any time and with any signal subtype - this will very good.


5. enabled - return true, if there was a train before of "N" the signal. Number "N" indicated in scripts line SignalNumClearAhead ( 10 ) in file SigCfg.

For example if N=1:

train -> SIGNAL (true) next SIGNAS (false) next SIGNAL (false) next SIGNAL (false)....

For example if N=3:

train -> SIGNAL (true) next SIGNAS (true) next SIGNAL (true) next SIGNAL (false)....


6. route_set () - return true, if route creator in signal have applyed one route way, and with junctions train will go in this way. If any junction in train route is other of applyed route way, then false. This function work for drawing direction in signal.

7. sig_feature( SIGFEAT_***) - allow set in route editor specials functions for signal universalism. Return true, if in signal the user option in route editor has applyed.

User options:

USER1, USER2, USER3, USER4, GRADIENT_PLATE, NUMBER_PLATE.


I give full manual of signals, if you will have any questions - write me. Thanks!

In my signal is worked script of one way rail, that the train did not go to meet.


Signals in OR-13.17 types DISTANCE, REPEATER, SHUNTING and INFO did not work. Did not work functions next_sig_lr(), next_sig_mr(). They should work with any NORMAL, REPEATER, DISTANCE, SHUNTING and INFO signal's types in any signal type. In track monitor and in the train draw NORMAL state from next_sig_lr() function. The most restrictable not watch, but in memory is saved and can used by signalist. For me 8 signal states is very small, and in my signal combination increase signal functions.

In one signal may have some signal types, and some one type signal. For this next_sig_lr() search the most permissive signal of one type signal in one signal, and next_sig_mr() - most restrictable.

I have good idea how best to open and close the signals. We have a problem, because RESTRICTING in my signal is not red signal (this is not coded rail, watch in out cab signal), and STOP is not red (I use STOP_AND_PROCEED with 0 and 20 km/h speed), but help support one way train running in one rail up stations junctions. The best function for use is block_state() ==# BLOCK_CLEAR )... If You artificially makes in block_state() function returned "BLOCK_JN_OBSTRUCTED" - any signal of any country will be red, and do not set any signal state STOP, APPROACH, or any other. This is very easy and goody.

Attached thumbnail(s)

  • Attached Image: prw2.jpg
  • Attached Image: prw3.jpg
  • Attached Image: prw4.jpg


#2 User is offline   APK-LVDZ 

  • Apprentice
  • Group: Status: Inactive
  • Posts: 44
  • Joined: 10-November 12
  • Gender:Male
  • Location:Riga, Latvia
  • Simulator:MSTS, OpenRails
  • Country:

Posted 10 November 2012 - 06:48 PM

SigCfg line explanation (short):

SIMISA@@@@@@@@@@JINX0G0t______

LightTextures ( 1 - quantity of all signal textures, then they are lists
LightTex ( "ltex" "SigLight.ace" 0 0 1 1 ) - name of textures, that will be used in this script; file, or path with file of signal textures; 0 0 1 1 - this is a coordinates x and y, that draw textures (0 - begin; 1 - all of texture, end)
)

LightsTab ( 3 - number of all colors, that will be used in light textures, then they are lists
LightsTabEntry ( "Red Light" colour ( 255 255 40 40 ) ) - light name (any), color in RGB table, the last number is brightness
...
)
)

SignalTypes ( 2 - subsignal quantity. This will be used in signal. They are subsignals.

SignalType ( "UKSemHome" - any name of subsignal

SignalFnType ( NORMAL ) - type of subsignal (NORMAL, DISTANCE, REPEATER, INFO, SHUNTING)
SignalLightTex ( "ltex" ) - used texture for subsignal (one)
SigFlashDuration ( 0.7 0.5 ) - signal flashing in seconds (on and off)

SignalLights ( 11 - - subsignal lights quantity, that can draw this subsignal.
SignalLight ( 0 "Red Light" Position ( -0.356 1.686 0 ) Radius ( 0.10 ) ) -
0 - number of quantity (0, 1, 2, 3,...)
"Red Light" - light textures color
Position ( -0.356 1.686 0 ) - textures drawing position of signal model (x,y,z)
Radius ( 0.10 ) - radius of signal textures (in meters?)

...
)

SignalDrawStates ( 3 - subsignal grouped lights quantity, that can draw this subsignal.
SignalDrawState ( 0 "Clear" DrawLights ( 2 DrawLight ( 5 ) DrawLight ( 6 ) ) )
0 - the first signal
"Clear" - name of light, for linking with signal aspects (STOP, RESTRICTING, ...) in this subsignal
DrawLights ( 2 .... ) - draws two lights, that writed: DrawLight ( 5 ) DrawLight ( 6 ). 5 and 6 are numbers of used colors from "SignalLights" category in this subsignal.


SignalDrawState ( 1 "No" ) - if don't draw signal light, then line is short
SignalDrawState ( 2 "YellowF" DrawLights ( 1 DrawLight ( 0 SignalFlags ( FLASHING ) ) ) )
for this light programmed flashing. For each flashing lights need to write "SignalFlags ( FLASHING )"

)
)
SignalAspects ( 4 - signal aspects (STOP, STOP_AND_PROCEED, RESTRICTING, APPROACH_1, APPROACH_2, APPROACH_3, CLEAR_1, CLEAR_2 ). If this subsignal is NORMAL type, then this will be in track monitor (if in one signal are some NORMAL types, then drawed most permissived speed, but all signals will be drawed in model)
SignalAspect ( STOP "No" ) - for signal aspects STOP is set light with name "No" (for example - not draw, but value will be used for other functions)
SignalAspect ( RESTRICTING "YellowF" SpeedKPH( 60 ) ) - for signal aspects RESTRICTING is set light with name "YellowF" with speed limit in KPH 60 km/h. If signal type is not NORMAL, then this speed will be ignored and no drawed.
)
SignalNumClearAhead ( 5 ) - for function "enabled" in sigscr.dat. 5 block has enabled=true, others enabled=false. The standart MSTS work with junctions by this number (not a good).
)
)



SignalShapes ( 1 - quantity of signals in route
SignalShape (
"APK_4AB_YG_RG_Old.s" - models name or path with name (may be repeated)
"APK_4AB_YG_RG_Old" - unical name for route building
SignalSubObjs ( 12 - subsignal quantity, that used in this model (perchance some one type of NORMAL or others)
SignalSubObj ( 0 - first subsignal
"SIGNAL" "Nastrojki predidusego signala:" - "SIGNAL" - is name of signal, that specified in TrainSim Modeler, or 3D Studio Max models. This name need to primary part of model; "......" - is my text, that writed in signal options in route editor.
SigSubType ( SIGNAL_HEAD ) - this explains - this is primary signal or other feature
SigSubSType ( "APK_3AB_YGR_GW_DISTANCE" ) - name of signal subtype. If this is not a signal, this line is skipped (look the next lines)
)
SignalSubObj ( 1 - next subsignal
"SIGNAL" " - Datj zelenij (inace 2 zeltih)"
SigSubType ( USER1 ) - this is not a signal. This is feature (USER1, USER2, USER3, USER4, GRADIENT_PLATE, NUMBER_PLATE). Signal's routes authors setup.
SignalFlags ( OPTIONAL ) - I can enable or disable it. Default is disabled.
)
SignalSubObj ( 4
"SIGNAL" " - Videlitj, esli ALSN kodiruetsa"
SigSubType ( USER2 )
SignalFlags ( OPTIONAL DEFAULT ) - I can enable or disable it. Default is enabled
)
SignalSubObj ( 3
"SIGNAL" " - Ukazatel '2'"
SigSubType ( SIGNAL_HEAD )
SigSubSType ( "APK_Linza_2" )
SignalFlags ( OPTIONAL JN_LINK ) - I can enable or disable it. Default is disabled. If I enable it, then I need to setup a route path. Then this wiil be used for function "route_set" in sigscr.dat
)
)
)
)

ScriptFiles ( - used script files, where simulator can find requested scripts
ScriptFile ( sigscr.dat )
)

#3 User is offline   APK-LVDZ 

  • Apprentice
  • Group: Status: Inactive
  • Posts: 44
  • Joined: 10-November 12
  • Gender:Male
  • Location:Riga, Latvia
  • Simulator:MSTS, OpenRails
  • Country:

Posted 10 November 2012 - 07:15 PM

SigScr line explanation (short):



SCRIPT APK_ALSN_KZ_0_B_0 - name of script. This need to check with subsignal name, and end-state need to check with writed signal aspects. Otherwise will be error, because not programmed situation.

extern float block_state (); - external variables or functions, that return value in the simulator
block_state (); - return occupied (train, before not a my junction), jn_obstructed (is not my junction) or clear (my junction and cleared one block to next signal with NORMAL type).
extern float def_draw_state (); - ???
extern float state; - variable of signal aspect
extern float draw_state; - ???
extern float next_sig_lr (); - return most permissive of signal aspect
extern float next_sig_mr (); - return most restrictable of signal aspect
extern float opp_sig_lr (); - return most permissive of signal aspect of the first back signal
extern float opp_sig_mr (); - return most restrictable of signal aspect of the first back signal
extern float sig_feature (); - for user options (USER1, USER2, ...)
float WORK1; float ONE_WAY; float SVET; float POEZD; float next_INFO; float opp_ONE_WAY; float opp_POEZD; - programmer variables, that will be deleted when script is finished


ONE_WAY = 0; SVET = 0; POEZD = 0; next_INFO = 8; opp_POEZD = 0; opp_ONE_WAY = 0;
if ( block_state() !=# BLOCK_JN_OBSTRUCTED ) { - script begin, if in my route is my junctions to next signal with NORMAL type
WORK1 = next_sig_mr ( SIGFN_NORMAL ); - most restrictable of next NORMAL type
if ( WORK1 ==# SIGASP_STOP_AND_PROCEED ) { ONE_WAY = 1; }
WORK1 = next_sig_lr ( SIGFN_DISTANCE ); - most permissive of next DISTANCE type (can be in other signal, or can't be)
if ( WORK1 ==# SIGASP_CLEAR_2 ) { SVET = 5; } if ( WORK1 ==# SIGASP_CLEAR_1 ) { SVET = 4; }
if ( WORK1 ==# SIGASP_APPROACH_3 ) { SVET = 3; } if ( WORK1 ==# SIGASP_APPROACH_2 ) { SVET = 2; }
if ( WORK1 ==# SIGASP_APPROACH_1 ) { SVET = 1; }
if ( WORK1 ==# SIGASP_RESTRICTING ) { POEZD = 2; } if ( WORK1 ==# SIGASP_STOP_AND_PROCEED ) { POEZD = 1; }
WORK1 = next_sig_mr ( SIGFN_INFO ); - most permissive of next INFO type (can be in other signal, or can't be)
if ( WORK1 ==# SIGASP_CLEAR_1 ) { next_INFO = 7; } if ( WORK1 ==# SIGASP_APPROACH_3 ) { next_INFO = 6; }
if ( WORK1 ==# SIGASP_APPROACH_2 ) { next_INFO = 5; } if ( WORK1 ==# SIGASP_APPROACH_1 ) { next_INFO = 4; }
if ( WORK1 ==# SIGASP_STOP_AND_PROCEED ) { next_INFO = 2; } if ( WORK1 ==# SIGASP_RESTRICTING )
{ next_INFO = 3; } if ( WORK1 ==# SIGASP_STOP ) { next_INFO = 0; }
}
if ( !sig_feature( SIGFEAT_GRADIENT_PLATE ) && !sig_feature( SIGFEAT_NUMBER_PLATE ) ) {
this part of script will be beginned, if my two options, that named GRADIENT_PLATE and NUMBER_PLATE will be disabled (! = not, && = and, || - or)

WORK1 = opp_sig_mr ( SIGFN_NORMAL );
if ( WORK1 ==# SIGASP_STOP_AND_PROCEED ) { opp_ONE_WAY = 1; }
WORK1 = opp_sig_lr ( SIGFN_DISTANCE );
if ( WORK1 ==# SIGASP_RESTRICTING ) { opp_POEZD = 2; } if ( WORK1 ==# SIGASP_STOP_AND_PROCEED ) { opp_POEZD = 1; }
}
if ( next_INFO ==# 3 && sig_feature( SIGFEAT_NUMBER_PLATE ) ) { next_INFO = 8; }


state = SIGASP_STOP; - setup the start aspects for situation if no scripts parts will be worked
if ( sig_feature( SIGFEAT_NUMBER_PLATE ) && POEZD !=# 1 ) {
script part will be started if NUMBER_PLATE is enabled in route editor, and variable POEZD is not = 1 (!= = not)
if ( block_state() !=# BLOCK_CLEAR || POEZD ==# 2 || ONE_WAY ==# 1 ) { state = SIGASP_STOP_AND_PROCEED; }
}
script part will be started if in my block are any train or any "not my" junction to next signal with NORMAL type; or variable POEZD = 2, or variable ONE_WAY = 1.

if ( block_state() ==# BLOCK_CLEAR ) {
if ( POEZD !=# 0 || next_INFO ==# 7 ) {
state = SIGASP_STOP_AND_PROCEED;
if ( !sig_feature( SIGFEAT_USER2 ) ) { state = SIGASP_RESTRICTING; }
if ( sig_feature( SIGFEAT_NUMBER_PLATE ) && POEZD ==# 1 && next_INFO ==# 7 ) { state = SIGASP_RESTRICTING; }
if ( sig_feature( SIGFEAT_GRADIENT_PLATE ) && !sig_feature( SIGFEAT_NUMBER_PLATE ) ) {
if ( opp_POEZD ==# 2 || opp_ONE_WAY ==# 1 ) { state = SIGASP_RESTRICTING; }
}
}
} else { - if I need for instruction in otherwise, if script didn't work
state = SIGASP_STOP_AND_PROCEED;
if ( !sig_feature( SIGFEAT_USER2 ) ) { state = SIGASP_RESTRICTING; }
if ( sig_feature( SIGFEAT_NUMBER_PLATE ) && POEZD ==# 1 ) { state = SIGASP_RESTRICTING; }
if ( sig_feature( SIGFEAT_GRADIENT_PLATE ) && !sig_feature( SIGFEAT_NUMBER_PLATE ) ) {
if ( opp_POEZD ==# 2 || opp_ONE_WAY ==# 1 ) { state = SIGASP_RESTRICTING; }
}
}
if ( next_INFO ==# 3 ) { state = SIGASP_STOP; }
draw_state = def_draw_state (state); - end line, that draw aspect signal of state value


In the script can be this lines:
if ( route_set () ) { state = SIGASP_CLEAR_2; }
else { state = SIGASP_APPROACH_3; }
if my route by junctions is one with applyed with author, then state = CLEAR_2 or state = 7. Else state = APPROACH_3, or state = 5.

#4 User is offline   wacampbell 

  • Member since Nov. 2003
  • Group: Fan: Traction Nuts
  • Posts: 2,347
  • Joined: 22-November 03
  • Gender:Male
  • Location:British Columbia, Canada
  • Country:

Posted 10 November 2012 - 07:23 PM

Thanks for this info. There's also a good reference in the TECHDOCS folder on the MSTS CD.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users