Elvas Tower: Odd signal script error - Elvas Tower

Jump to content

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

Odd signal script error Can't find the cause Rate Topic: -----

#1 User is offline   ebnertra000 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,234
  • Joined: 27-February 17
  • Gender:Male
  • Location:East-Central Minnesota
  • Simulator:OR/TSRE
  • Country:

Posted 06 August 2020 - 04:34 PM

I've been attempting to find the cause of the following error in the logfile:

Warning: Error reading signal script - C:\MSTS\ROUTES\Sig_Test\OpenRails\sigscr.dat : System.NullReferenceException: Object reference not set to an instance of an object.
   at Orts.Formats.Msts.Signalling.Parser.<GetEnumerator>d__5.MoveNext() in F:\ADRIANA\Carlo\OR_Work\Git_ORTS_source_mio\Source\Orts.Formats.Msts\Signalling\Parser.cs:line 103
   at Orts.Formats.Msts.SignalScripts..ctor(String routePath, IList`1 scriptFiles, IDictionary`2 signalTypes, IList`1 orSignalTypes, IList`1 orNormalSubtypes) in F:\ADRIANA\Carlo\OR_Work\Git_ORTS_source_mio\Source\Orts.Formats.Msts\SignalScripts.cs:line 246


I've been looking through the script file very hard but can't seem to turn up anything. Attached is the full log and script file

Attached File(s)



#2 User is offline   perpetualKid 

  • Fireman
  • Group: Status: Active Member
  • Posts: 190
  • Joined: 10-June 18
  • Gender:Male
  • Simulator:OR
  • Country:

Posted 06 August 2020 - 08:49 PM

View Postebnertra000, on 06 August 2020 - 04:34 PM, said:

I've been attempting to find the cause of the following error in the logfile:

Warning: Error reading signal script - C:\MSTS\ROUTES\Sig_Test\OpenRails\sigscr.dat : System.NullReferenceException: Object reference not set to an instance of an object.
   at Orts.Formats.Msts.Signalling.Parser.<GetEnumerator>d__5.MoveNext() in F:\ADRIANA\Carlo\OR_Work\Git_ORTS_source_mio\Source\Orts.Formats.Msts\Signalling\Parser.cs:line 103
   at Orts.Formats.Msts.SignalScripts..ctor(String routePath, IList`1 scriptFiles, IDictionary`2 signalTypes, IList`1 orSignalTypes, IList`1 orNormalSubtypes) in F:\ADRIANA\Carlo\OR_Work\Git_ORTS_source_mio\Source\Orts.Formats.Msts\SignalScripts.cs:line 246


I've been looking through the script file very hard but can't seem to turn up anything. Attached is the full log and script file



SCRIPT GCOR_CLS-20VH_A_RRGLY

in line 240+ you have two statements each for the if and for the else branch, where it should be one only. You'd need to enclose them as block using "{}"

if (ind_state ==# 3)
{
if (next_state ==# 2)
state = 0;
draw_state = 5;
else
state = 0;
draw_state = 3;
}

if (ind_state ==# 3)
{
if (next_state ==# 2)
{
state = 0;
draw_state = 5;
}
else
{
state = 0;
draw_state = 3;
}
}


But i agree the parser could do a better job and not just crash, will look into it. This only affects MG versions which use a different SignalScript Parser.

#3 User is offline   ebnertra000 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,234
  • Joined: 27-February 17
  • Gender:Male
  • Location:East-Central Minnesota
  • Simulator:OR/TSRE
  • Country:

Posted 07 August 2020 - 05:00 PM

Are you referring to the line 246 listed in the error message? I'm pretty sure that's line of the parser file that didn't agree with what was in my script file. I ended up removing all of the state = 0; lines, leaving just the draw state numbers, and removing those "draw_state = def_draw_state(state); lines from the end of each signal type script, and suddenly, not only did the crash message in the log go away, the signals began functioning properly, too.

I'm not sure what cured the error, but I didn't change the aforementioned statement. In fact, I've tested countless signals using scripts just like that, and they've always worked without issue

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