How do you change the .turn for openBVE routes?

Started by Supreme DripLord Doggo, Mar 23, 2021, 07:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hello!

So I wanted to learn how to make routes go on the local or express track. For example, if I was on the express track and on the right is the local track and I find a track to turn my train, how do I change that? So if I wanted my train to go on the local track when its on the express track, how can I switch the .turn?

Hello!

You want to learn how to make trains switch tracks. First things first you need to understand that openbve doesn't actually have switchable tracks and we use that the .turn/.curve commands to create illusion of switching tracks. Now this instruction here will require you to have a basic understanding of coding in openbve tracks/freeobjs/dikes/cracks/walls and forms. NOTE! I will provide you with the basic understanding and from that point you will need to experiment on your own to grasp the concept.

To create a switch from the express track to the local track we will use the ,.curve command to do so. ,.curve is a cleaner alternative than ,.turn which causes more headaches:

Instructions!

(1) Go to the point you would like to create the switch: For me I will go to position 300M. NOTE! In openbve you will need to at a multiple of 25 in order to switch tracks efficiently and to end all repeating objects. If you dont then you will have errors or glitching objects later on.
You cannot see attachments on this board.

(2) Prepare your code in notepad++ or your route editing software. Once you establish the area you would like to switch tracks at. Take the position and enter it into your editing software like the following: Example: 300,. You cannot see attachments on this board.

(3) For my code at position 300M I will add this into notepad++ and then add 3 more numbers which will be multiples of 25 after 300 in the next lines. With that my following numbers will be listed as follows:
 300,.
 325,.
 350,.
 375,.

(4) I now will add the following code to switch my track to the track on the right side.
 300,.curve 156
 325,.curve -156
 350,.curve 0
 375,.

(5) Save your work and refresh openbve. Once that's completed your tracks should look like what I have posted.
You cannot see attachments on this board.

(6) Were not done yet so here comes the hard part. As I said before "Openbve doesn't actually have switchable tracks and we use that the .turn/.curve commands to create illusion of switching tracks". Now on the line where you have the code [300,.curve 156] you will edit your rail to the right side by adding the following code. My right side rail is numbered ,.rail 1 this maybe different from whatever rail is being used on your route or project ensure that you check what rail is being defined at that point. NOTE: Some rails will be overlapped on other rails for detailing purposes or other reasons!

(6A) Enter the rail codes for the as follows for each line. This will allow the right side rail to be kept straight as the main rail turns into that track.
     300,.curve 156 ,.rail 1;4
     325,.curve -156,.rail 1;2
     350,.curve 0 ,.rail 1;0
Once you are finished you should have something that looks like this You cannot see attachments on this board.

(7) After that is completed. Add a new railstart command to the code, identify it by adding a number like the following ,.railstart 4;0;0;0. I made my track identification number to be #2. We will be using this to make the main look rail straight while you will be diverging to the right.
     300,.curve 156 ,.rail 1;4 ,.railstart 2;0;0;3
     325,.curve -156,.rail 1;2 ,.rail 2;-2
     350,.curve 0 ,.rail 1;0 ,.rail 2;-4
Once that is completed you will see the rail look like this You cannot see attachments on this board.

( 8 ) Lets clean up now. So the rail that you see in the middle needs to be removed. How do we do that? Simple! We will go to the rail commands wherever they are placed and look for nothing.csv or nothing.b3d. NOTE! If this invisible object isn't added in your rail code you will need to do this! This is useful because you can hide you rails or other objects with this command. The command to hide the rail crossing over will be the following:
 300,.curve 156 ,.rail 1;4 ,.railstart 2;0;0;3 ,.railtype 0;0
Once that's completed you will see this You cannot see attachments on this board.

(9) Were almost finished! Now after that rail is cleared you will need to correct the rail constantly roaming around and correct your track at the end of it. Add the following code at line 375. 375,.railend 1 ,.railtype 0;4 : The reason we add this code is because your rail on the right side was rail 1. You ended rail 1 at line 375. Now your main which is rail 0 will continue to run in place of rail 1 giving you that illusion that you see normal tracks infront of you.

(10) Thats it! Your well on your way to code switchable tracks!! Enjoy!


Bonus! Turn the curve commands around with positive or negative to switch either left or right! 



 

Thank you so much! Where did you learn all this??

Years of experience! And learning from other routes that other people build.

How cool! I also saw someone say to use .curve instead of .turn. From your experience and knowledge, how would we change to track direction (Lcl >> Exp or Exp >> Lcl) if we used .curve instead?

Same way. However as I said you will need some understanding of how it works because openbve has no ,.switch everything is an illusion