How to add signals and make them work

Started by Moonoo1234, Mar 30, 2021, 02:28 PM

Previous topic - Next topic

Moonoo1234

Hey all. I'm making the downtown f and I need to add signals. How to I add signals and make them work

Supreme DripLord Doggo

Hi there, Moonoo1234!

With my knowledge, I don't think making the Downtown F is necessary because its already being developed by Team Epiphany Tyler and others. But if you still want to go along w/ it, then read below.

The best thing to do is to read the .csv route format documentation. It tells you what to do in order to make a proper route.

https://openbve-project.net/documentation/HTML/route_csv.html#track_signalling

It has everything you need, and the signals part.

Trainkidkris

You can make whatever it is you want my friend. Your content is for you to enjoy!

Supreme DripLord Doggo

^ what Trainkidkris said. Can't wait until you decide if you release it or not!

Trainkidkris

To add signals to openBVE routes you will need the following:
1. https://openbve-project.net/documentation/
2. Notepad++/Route Viewer or another editor to edit the csv file
3. An understanding of coding in openbve

This guide will help you learn how to place signals down and how they are affected in the openbve game world.  NOTE! [This topic is very very difficult to comprehended!]

 

STEP 1: We need to do some pre work first! So lets find the signal pack you wish to use. For this demonstration I will be using OWN my custom "OBND Signal Pack" for this demonstration. Now once you find what signal pack your using, open your notepad++ (or whichever editor your using) and open the route you wish to add signals on.

NOTE!: For this demonstration I will be using the test route I built back in the "How to add a switch" guide for easy demonstration.

STEP 2: Choose the amount of signals you wish to add into the route from the signals folder. This means you will choose the amount of signals which you want to use when building your route in openbve. For my example ill use about 25 signals.

STEP 3: Once you figured out the amount of signals you want to use, go to your editor and typing in the following code to begin referencing those signals to openbve:
.Load ()

NOTE: The .Load() command is the instruction given to openbve to load in .animated signals.
The () are used to input a number which will be the signal reference number. Signals are basically like freeobjs and can be used as a freeobj as well. The () can house up to large numbers but I personally recommend keeping it under high high numbers like 200000.
Example: .Load(95) 95 is my reference number to that signal that I would like to use when coding.

STEP 4: Enter the amount of .Load() commands and enter a number for them. When your finished it should look like this:
You cannot view this attachment.

STEP 5: Enter the location and file extension of your signals into each of those rows. Once your finished it should look like this:
You cannot view this attachment.
NOTE: ERRORS will occur in your project if you dont enter the correct signal reference location and extension file. OpenBVE is case sensitive and will not load or will crash the game if something is not entered correctly. PLEASE CHECK YOUR WORK!

STEP 6: After entering all your signals into .Load() we will go to the position in the openBVE world via route viewer where you want to add those signals. Once you have found a spot you want to add a signal, you will enter its position into notepad++ or other editing software.
Example: At position 220 in the openbve world I would like to add a signal here. I enter the following code 220,.

STEP 7: After you found the position you want and entered its point in the code, you will start to load the signal into the game to be seen by adding the following code.
Example: 220,.SigF 4;1;0;0,.Section 0;2;4 ;Once you did that it your signal should have loaded into openbve like this

You cannot view this attachment.


Information: The command SigF is used to define the signal being placed in the world. .Load is being used to reference the object and .SigF is used to load the object into the game world to allow the player to see. Now the command 4 is my signal reference number that im using, its my signal type or a type of signal im using that maybe different from my other signals I have.
The command 1 is used to represent the signal section. In the openbve document guide it stats that "Section: A non-negative integer representing the section this signal is attached to, with 0 being the current section, 1 the upcoming section, 2 the section after that, and so on" is stating that in order for the signal to respond to the train passing over it and turn that signal red or updating it in the signal network it need to be set using a number.


FUTHER INFORMATION: The BVE guide reference stating "Section: A non-negative integer representing the section this signal is attached to, with 0 being the current section, 1 the upcoming section, 2 the section after that, and so on" means the following: EXAMPLE: Players A train is leaving Station 1. Player A train sees a signal outside of the station in front of him [Lets call this signal #100] indicating "green". The player passes signal [#100] and it turns red. Once he clears signal [#100] that signal remains signal remains red until he clears another signal up ahead. Player A train passes another signal [Lets call it Signal #145] indicating green, the players passes [Signal #145] and it turns red. Once players A train has fully cleared [Signal #145] the signal out side the station known as [Signal #100] turns yellow. Once he passed the 3rd signal [Lets call this signal #200] and clears it completely by having his train off that signal. Signal #100 will now turn green. All signals will work this way only if the command in the SigF is left as the following and the section command is coded that way. ,.SigF 4;1;0;0 [Since there's way to much information to cover on signals here lets keep it simple. Experiment on your own is the best way to learn!]
 
MORE INFORMATION: The commands at the end of ,.SigF 4;1;0;0 Are X axis[-Left to +right]  and Y axis [-Down to +Up]. These are axis controls to reposition your signals.
The command ,.Section 0;2;4 is used for controlling signals. Sections are needed in order to allow the signal to turn RED/YELLOW/GREEN/ETC. If this code is not within your signal code you will not see the signal change colors when the train passes! ,.Section 0 means current. Or the signal when the train passes it known as  ,.Section 0;2 means the signal the the train passes first will be  followed by [YELLOW] which is represented by 2. ,.Section 0;2;4 means [RED/YELLOW/GREEN]. If you add the following code ,.Section 0;0;2;4 your adding a buffer which means when the train clears 2 RED signals the 3 signal will be yellow and the 4th signal up ahead will be green.
[NOTE: SIGNALS HAVE A VERY LARGE DEFINTION AND THE NOTES HERE WILL BE SUBJECTED TO CHANGES]


STEP 8: Experiment and enjoy!   



SMF spam blocked by CleanTalk