Elvas Tower: C# Signal Scripts - Elvas Tower

Jump to content

Posting Rules

All new threads will be started by members of the Open Rails team, Staff, and/or Admins. Existing threads started in other forums may get moved here when it makes sense to do so.

Once a thread is started any member may post replies to it.
  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

C# Signal Scripts Rate Topic: -----

#11 User is offline   Serana 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 16 August 2021 - 03:36 PM

As suggested by Chris, I will talk about a new function added to the scripts:

I added the PreUpdate() function in all script interfaces in order to manage the following case:
When you launch a game in timetable mode, you go through a pre-update phase where you start from midnight and you wait until you reach the start of your train.
During this phase, trains are running following the timetable information but with a huge time step.
If you use Timer instances inside signal scripts, the Timer instances will be updated at the same huge time step and the signals may clear much too late and cause huge delays to the trains.

With the PreUpdate() function, you can choose to disable the timers when the simulator is in this pre-update phase and avoid delays.

Link to the corresponding pull request: https://github.com/o...nrails/pull/445

#12 User is offline   VicenteIR 

  • Fireman
  • Group: Status: Active Member
  • Posts: 149
  • Joined: 24-April 15
  • Gender:Male
  • Location:Dimona, Israel
  • Simulator:Open Rails
  • Country:

Posted 18 August 2021 - 10:47 AM

Can I ask what the syntax is (will be) for calling this function in sigscr.dat? And which testing version or/and NY MG revision is/will include function PreUpdate()?

Regards
Oleg

#13 User is offline   Serana 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 18 August 2021 - 11:31 AM

There is no syntax for SIGSCR files because you can't use Timer classes in SIGSCR files. You can only use it in C# script files.

#14 User is offline   rickloader 

  • Conductor
  • Group: Status: First Class
  • Posts: 493
  • Joined: 05-February 13
  • Gender:Male
  • Location:Southampton uk
  • Simulator:Open Rails
  • Country:

Posted 18 August 2021 - 01:26 PM

ChrisJ very kindly made me an OR version with a variable timetable prerun update interval. Tests showed that signalling runs better with a short interval, but at a cost of longer loading times.
Perhaps you might also consider a shorter update interval than the standard 5 seconds? It might be a variable specified in the route .trk
Rick

#15 User is offline   VicenteIR 

  • Fireman
  • Group: Status: Active Member
  • Posts: 149
  • Joined: 24-April 15
  • Gender:Male
  • Location:Dimona, Israel
  • Simulator:Open Rails
  • Country:

Posted 26 September 2021 - 11:54 AM

Can somebody please to publish an example of the code of one class of Signal Type here or maybe link to relevant post/site whith the complete one? I'm new in C# and have a mess in my head.

Regards
Oleg

#16 User is offline   Serana 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 26 September 2021 - 12:42 PM

Here's a link to my C# signal Git repository: https://github.com/S...arp_Signals_LGE

#17 User is offline   VicenteIR 

  • Fireman
  • Group: Status: Active Member
  • Posts: 149
  • Joined: 24-April 15
  • Gender:Male
  • Location:Dimona, Israel
  • Simulator:Open Rails
  • Country:

Posted 07 December 2021 - 04:08 AM

Hi!

Is it some way for Signal Script to define a Multiplayer Mode?

Regards
Oleg

#18 User is offline   Laci1959 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 943
  • Joined: 01-March 15
  • Gender:Male
  • Simulator:Alföld
  • Country:

Posted 07 December 2021 - 07:31 AM

	else if (BLOCK_CLEAR !=# block_state())
	{
		if (Approach_Control_Position (Approach_Control_Req_Position))
		{
			Activate_Timing_Trigger();
		}
	}
	else if (block_state() !=# BLOCK_CLEAR &&
		( Check_Timing_Trigger( 120 ))
	)
		state = SIGASP_STOP_AND_PROCEED;

Hello.

Do I think the timer in the code above doesn't work because of this?

Sincerely, Laci1959

#19 User is offline   Serana 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 489
  • Joined: 21-February 13
  • Gender:Male
  • Location:St Cyr l'Ecole (France)
  • Simulator:Open Rails
  • Country:

Posted 07 December 2021 - 09:46 PM

 VicenteIR, on 07 December 2021 - 04:08 AM, said:

Hi!

Is it some way for Signal Script to define a Multiplayer Mode?

Regards
Oleg


Err... what do you mean ?

 Laci1959, on 07 December 2021 - 07:31 AM, said:

	else if (BLOCK_CLEAR !=# block_state())
	{
		if (Approach_Control_Position (Approach_Control_Req_Position))
		{
			Activate_Timing_Trigger();
		}
	}
	else if (block_state() !=# BLOCK_CLEAR &&
		( Check_Timing_Trigger( 120 ))
	)
		state = SIGASP_STOP_AND_PROCEED;

Hello.

Do I think the timer in the code above doesn't work because of this?

Sincerely, Laci1959


I don't know. I have never used those functions in MSTS signal scripts. But anyway, this is a topic about C# signal scripts, so I don't think this is here we should talk about it. Perhaps opening a topic in "Maybe it's a bug" is appropriate.

#20 User is offline   Laci1959 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 943
  • Joined: 01-March 15
  • Gender:Male
  • Simulator:Alföld
  • Country:

Posted 08 December 2021 - 09:23 AM

 Serana, on 07 December 2021 - 09:46 PM, said:

Err... what do you mean ?



I don't know. I have never used those functions in MSTS signal scripts. But anyway, this is a topic about C# signal scripts, so I don't think this is here we should talk about it. Perhaps opening a topic in "Maybe it's a bug" is appropriate.



Thanks, I'm sorry, I misunderstood. I thought there might be a connection.

  • 3 Pages +
  • 1
  • 2
  • 3
  • 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