Author Topic: Electronic Train Board "Emulator"  (Read 1901 times)

0 Members and 1 Guest are viewing this topic.

Offline dwpvdk

Electronic Train Board "Emulator"
« on: January 28, 2015, 04:22:30 AM »
When watching videos of Simutrans around the web, I found that many players liked to make destination boards or electronic boards like those in some trains irl to show in their videos. Here are some examples:







These seem to take a good deal of time to make using Gimp, Photoshop, etc. and then are a pain to animate using other utilities. In my own videos, I got by without complex animations, but I wanted something better.

So, I made this little program (sadly, it only runs on Windows operating systems):

http://www.weebly.com/uploads/5/1/1/1/5111657/simutrans_destboard.rar

In the .rar archive, there are three files:

1) example_line.hff -- You can edit this to make it display your own lines.
2) simutrans_destboard.exe -- This is the executable which starts the program.
3) standard.hff -- This has to be in the same directory as the executable because of the HFF data management system it runs on.

Short Guide:



1) The program asks for the name of the file containing the script, which in this case is the "example_line.hff" file included in the .rar archive.



2) Make sure to append the extension to the file name even though the prompt says "(*.hff)".



3) Once 'enter' is pressed to enter the file name, the script begins running. The time, in the lower left corner, ticks every second.



4) When a certain time comes (see the script), the destination, in the lower right corner, iterates.



5) When the clock stops ticking, the script has been completed, and the user may press any key to zap the memory allocations and end the program.

Editing the Script:

Here is the contents of "example_line.hff":

Code: [Select]
#mode standard pram
#cat EXPRESS Charlotte 08:00 11:16 Raleigh #cend
#align sta
#cat 08:35 Durham #cend
#cat 09:58 Greensboro #cend
#cat 10:43 Salisbury #cend
#cat 11:15 Charlotte #cend
#aend

Because the executable runs on HFF, the file is made up of tagged data structures.

Code: [Select]
#mode standard pram
This declares the mode for the program to load the data. Do not change this lest the program may not work correctly.

Code: [Select]
#cat EXPRESS Charlotte 08:00 11:16 Raleigh #cend
This contains some important parameters for the program to begin running. The first object inside the tags is the type of train, which is displayed in the upper left corner of the display board. The next object is the final destination, or name of the train, and is displayed in the upper right corner of the display board. The third object is the starting time. Note that the zero in front of the eight is included despite its redundancy. The program requires that all times be in a five-digit format (the third digit should be a colon or another placeholder but not a space or return) with initial zeros included as necessary. The fourth object is the ending time for the script. The last object is the initial destination; this is shown in the beginning of execution in the lower right corner of the display board.

Code: [Select]
#align sta
#cat 08:35 Durham #cend
#cat 09:58 Greensboro #cend
#cat 10:43 Salisbury #cend
#cat 11:15 Charlotte #cend
#aend

This is a list of category data structures that serves as a list of station stops. Each station object must have '#cat' and '#cend' tags around it. The first object in each is the time at which the destination display should changed to display the second object as the new destination.

This is an ongoing project, and any questions, feedback, and tips would be helpful.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Re: Electronic Train Board "Emulator"
« Reply #1 on: January 28, 2015, 10:19:43 PM »
I think this is more appropriate here. An interesting idea; one would rather need an interface to the simutrans trains table in the game ...

Offline dwpvdk

Re: Electronic Train Board "Emulator"
« Reply #2 on: February 07, 2015, 08:20:49 PM »
The first implementation of the utility in a video. A video was taken of the console output of the program, then overlaid onto the footage of the train running to produce the result.

The full video is here: http://youtu.be/HvTTvT0c4ww

Some screenshots:




Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2503
  • Total likes: 261
  • Helpful: 88
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Electronic Train Board "Emulator"
« Reply #3 on: February 08, 2015, 05:14:59 AM »
I think this is more appropriate here. An interesting idea; one would rather need an interface to the simutrans trains table in the game ...
Maybe scripting allows it, dwpvdk would need to check though.