BVEStation Forums

BVE => BVE/OpenBVE Support => Topic started by: BeeRyDavis on August 28, 2012, 05:12:13 pm

Title: Switching (BVE coding)
Post by: BeeRyDavis on August 28, 2012, 05:12:13 pm
I'm coding two different routes and need help with switching the train onto another track. Like how the A switches to the right track
at 207th st.
Title: Re: Switching (BVE coding)
Post by: ipac on August 28, 2012, 08:51:59 pm
Usually to switch tracks, you use the .turn command.  Turn takes a ratio (of something I cant quite recall).  Typically I've seen stuff like .turn 0.16, If I remember correctly this will switch it one track length to the right.  Negating it (.turn -0.16,) will switch it to the left.

So if you have 2 parallel tracks A and B (A is on the left and B is on the right) and they are smacked right next to each other (which should simply be 4m), and you are on track A, .turn 0.16 should switch you onto track B.  Then you would use the .rail command to readjust/add the other tracks accordingly.

I'm pretty sure thats a vague answer, and somebody else can probably offer a better explanation, but see if that helps.  :P

There is a entry on turn on the wiki, though I dont really like it very much since it explains little to nothing, but it may be good for reference.
http://wiki.bvestation.com/index.php?title=CSV_Routes (http://wiki.bvestation.com/index.php?title=CSV_Routes) (Scroll down to where it says Track.turn)
Title: Re: Switching (BVE coding) & signals
Post by: nightmare403 on August 29, 2012, 12:10:05 am
how do u make a signal display green over yellow
Title: Re: Switching (BVE coding)
Post by: peacemak3r on August 29, 2012, 01:59:57 am
There should be a signal that comes with TJ's pack that displays a Yellow over Green signal or vice versa.
Title: Re: Switching (BVE coding)
Post by: BeeRyDavis on August 29, 2012, 09:12:18 am
Usually to switch tracks, you use the .turn command.  Turn takes a ratio (of something I cant quite recall).  Typically I've seen stuff like .turn 0.16, If I remember correctly this will switch it one track length to the right.  Negating it (.turn -0.16,) will switch it to the left.

So if you have 2 parallel tracks A and B (A is on the left and B is on the right) and they are smacked right next to each other (which should simply be 4m), and you are on track A, .turn 0.16 should switch you onto track B.  Then you would use the .rail command to readjust/add the other tracks accordingly.

I'm pretty sure thats a vague answer, and somebody else can probably offer a better explanation, but see if that helps.  :P

There is a entry on turn on the wiki, though I dont really like it very much since it explains little to nothing, but it may be good for reference.
http://wiki.bvestation.com/index.php?title=CSV_Routes (http://wiki.bvestation.com/index.php?title=CSV_Routes) (Scroll down to where it says Track.turn)
I tried using the rail command before and after the switch but it's only correct after the switch. Before the switch I have the other tracks crossing in front of me with the pillars
Title: Re: Switching (BVE coding)
Post by: ipac on August 29, 2012, 10:56:18 am
You have to remove the columns when your doing them.  If your using the wall command, you have to change the wall index on the rail  so that one side uses the wall and the other side uses nothing.
Title: Re: Switching (BVE coding)
Post by: nightmare403 on August 29, 2012, 11:13:44 am
where is the switch track located in the route files?
Title: Re: Switching (BVE coding)
Post by: Mr Railfan on August 29, 2012, 11:47:33 am
Before attempting any of this , you have to at least know the basics to route coding. If you have absolutely no idea what the hell you are doing and just putting in random code in trying to make the train turn you will end up with stuff like this :



(http://img716.imageshack.us/img716/953/openbve2012072120445644.png)

and your train will turn out like this:


 (http://i.imgur.com/DCzAM.jpg)
Title: Re: Switching (BVE coding)
Post by: nightmare403 on August 29, 2012, 02:12:44 pm
Before attempting any of this , you have to at least know the basics to route coding. If you have absolutely no idea what the hell you are doing and just putting in random code in trying to make the train turn you will end up with stuff like this :



(http://img716.imageshack.us/img716/953/openbve2012072120445644.png)

and your train will turn out like this:


 (http://i.imgur.com/DCzAM.jpg)

          ^
what train is that
Title: Re: Switching (BVE coding)
Post by: Pacific385 on August 29, 2012, 02:15:30 pm
I assume the R143 that overshot the bumper in the ENYCanarsie Yard in '06

Title: Re: Switching (BVE coding)
Post by: bve on August 29, 2012, 03:21:33 pm
I assume the R143 that overshot the bumper in the ENY Yard in '06

Canarsie Yard.
Title: Re: Switching (BVE coding)
Post by: BeeRyDavis on August 29, 2012, 05:56:02 pm
Before attempting any of this , you have to at least know the basics to route coding. If you have absolutely no idea what the hell you are doing and just putting in random code in trying to make the train turn you will end up with stuff like this :



(http://img716.imageshack.us/img716/953/openbve2012072120445644.png)

and your train will turn out like this:


 (http://i.imgur.com/DCzAM.jpg)
Lol, I fixed the problem. I forgot the mid section where I have to subtract the distances of track on both sides by two. It looks fine now.
Title: Re: Switching (BVE coding)
Post by: nightmare403 on August 29, 2012, 06:20:18 pm
can someone teach me to code can some tell me tell me what i have to do to make the switch code look right?
Title: Re: Switching (BVE coding)
Post by: BeeRyDavis on September 01, 2012, 04:06:47 pm
can someone teach me to code can some tell me tell me what i have to do to make the switch code look right?
The switch objects are to be a distance of 50 away from each other. You'll need a few more rails to make it work. so say rail 1 is on
your right and u want to switch to the right. type railstart 2;0;0;1, if 1 is the same railtype as your running rail 0. now from the start of the switch
your rails are where they should be so just type the turn command (turn 0.08). at 25 ft you would type in .rail 1;2;0,.rail 2;-2;0, and then at 50 ft
you would type in .turn -0.08,.rail 1;0;0,.rail 1;-4;0,. You shouldn't see the tracks or walls cutting in front of you
Title: Re: Switching (BVE coding)
Post by: BeeRyDavis on September 01, 2012, 04:09:48 pm
I meant .rail 2;-4;0,
Title: Re: Switching (BVE coding)
Post by: coneyislandDFNQ on September 07, 2012, 01:38:33 pm
Before attempting any of this , you have to at least know the basics to route coding. If you have absolutely no idea what the hell you are doing and just putting in random code in trying to make the train turn you will end up with stuff like this :



(http://img716.imageshack.us/img716/953/openbve2012072120445644.png)

and your train will turn out like this:


 (http://i.imgur.com/DCzAM.jpg)

I wanna start coding like that lmao jk