Elvas Tower: Expand potential of TCS scripting - 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.
  • 13 Pages +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

Expand potential of TCS scripting Rate Topic: -----

#41 User is offline   Icik 

  • Conductor
  • Group: Status: Active Member
  • Posts: 308
  • Joined: 19-April 15
  • Simulator:Open Rails
  • Country:

Posted 30 April 2020 - 02:09 AM

Carlo, can I see the syntax somewhere? How will they be used?

#42 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,013
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 30 April 2020 - 03:48 AM

Icik,
sorry, but I don't understand your question well. The syntax of what? For the script a stroke of the above key combinations will be the same as the mouse click on the ORTS_TCS1 or ORTS_TCS2 cab control.

#43 User is offline   Icik 

  • Conductor
  • Group: Status: Active Member
  • Posts: 308
  • Joined: 19-April 15
  • Simulator:Open Rails
  • Country:

Posted 30 April 2020 - 04:14 AM

How do I handle to turn TCS on / off with a keyboard shortcut? Is there a function for this?

#44 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,013
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 30 April 2020 - 05:20 AM

This must be coded within the script itself. The TCS script starts always, but loops doing practically nothing until the starting keystrokes are pressed.

#45 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,013
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 30 April 2020 - 07:41 AM

View PostCsantucci, on 28 April 2020 - 12:52 PM, said:

As requested, two keyboard commands have been added in the TCS extensions; they are triggered by Ctrl+, and Ctrl+. . They are linked to the generic TCS controls ORTS_TCS1 and ORTS_TCS2. The commands are generic, and may be have any use within the TCS script. They might be used to start and stop the on-board Train Control System, but also for other functions.

This is now implemented in OR NewYear MG rev.60 and in the latest official Unstable release, where also all other TCS extensions are now available.

#46 User is offline   Icik 

  • Conductor
  • Group: Status: Active Member
  • Posts: 308
  • Joined: 19-April 15
  • Simulator:Open Rails
  • Country:

Posted 30 April 2020 - 11:27 PM

Carlo, I don't know how or what to test in the script to get true / false when I press Ctrl + or Ctrl + ..
Please, give me an advice.

#47 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,013
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 01 May 2020 - 10:14 AM

Hi Icik,
you can download here http://www.interazio...ev8.0_provv.zip a new temporary release of the script for the Italian TCS, where I have implemented the check for key combinations Ctrl,(comma) to switch on the on board TCS and Ctrl.(period) to switch it off.
I also suggest you to update tomorrow morning the Testing version of OR. There should be an update in the OR manual, where YoRyan has written the basics of OR scripting.

The SCMT source is quite complicated. Here some hint about the points where the checks are performed. When one of the two key combinations are pressed and when they are released, method
       public override void HandleEvent(TCSEvent evt, string message)

at line 1883 of the script is called, and in particular lines from 1908 and further on are activated.
Key combination Ctrl,(comma) or Ctrl.(period) start HandleEvent; evt can have the two values TCSEvent.GenericTCSButtonPressed (when you start pressing the keys) and GenericTCSButtonReleased when you release them; message can be in our case "0" (string) for Ctrl,(comma) and "1" for Ctrl.(period). Within HandleEvent they are converted to integers and then to CommandEvent enums respectively as TCSCommandEvent.Accendi (switch on) and TCSCommandEvent.Spegni (switch off) and become indices for TCSButtonPressed[(int)commandEvent] and TCSButtonReleased[(int)commandEvent].
The relevant elements of TCSButtonPressed are then read within the update loop in UpdateSSBState() (line 1024). That method should be clear.

#48 User is offline   YoRyan 

  • Conductor
  • Group: Status: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 01 May 2020 - 12:38 PM

I'm working on some American TCS scripts, and I'm missing the ability to read the current positions of the throttle and brake handles. For example, when you get a penalty application on an American locomotive, you have to move the brake handle to Supression for 10 seconds before the TCS system will release the brakes.

Any chance of incorporating such a function into your changes?

#49 User is offline   Icik 

  • Conductor
  • Group: Status: Active Member
  • Posts: 308
  • Joined: 19-April 15
  • Simulator:Open Rails
  • Country:

Posted 01 May 2020 - 11:33 PM

Thank you so much Carlo! This is very helpful.

#50 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Status: Elite Member
  • Posts: 7,013
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 01 May 2020 - 11:52 PM

View PostYoRyan, on 01 May 2020 - 12:38 PM, said:

I'm working on some American TCS scripts, and I'm missing the ability to read the current positions of the throttle and brake handles. For example, when you get a penalty application on an American locomotive, you have to move the brake handle to Supression for 10 seconds before the TCS system will release the brakes.

Any chance of incorporating such a function into your changes?

Hi Ryan,
I'm happy you're working on that.
With this hook that I added some days ago
Script.Locomotive = () => Locomotive;

you have access to the whole Simulator environment (locomotives, trains, signals and so on), e.g. in the script you can refer to
Locomotive().LocalThrottlePercent

provided you have inserted the required using lines at beginning of the script.

  • 13 Pages +
  • « First
  • 3
  • 4
  • 5
  • 6
  • 7
  • Last »
  • 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