BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How to activate "Doors Opening" Signage when a train is approaching the station.

2 posters

Go down

How to activate "Doors Opening" Signage when a train is approaching the station. Empty How to activate "Doors Opening" Signage when a train is approaching the station.

Post by Inamak17 Fri Jul 15, 2022 2:47 am

Hello, I am currently developing a train where signage would say "Doors Opening on the Right/Left" whenever arriving at a station. Is there a way to code this in, where the sign only activates when the train is approaching a station?

Inamak17

Posts : 9
Join date : 2020-04-01

Rakago likes this post

Back to top Go down

How to activate "Doors Opening" Signage when a train is approaching the station. Empty Re: How to activate "Doors Opening" Signage when a train is approaching the station.

Post by leezer3 Sun Jul 31, 2022 10:20 am

Sure Smile

You want to combine the following animated variables: distanceNextStation, leftDoorsTarget, and rightDoorsTarget.

Thus:
Code:
States = Unlit.b3d, LeftDoorsOpen.b3d, RightdoorsOpen.b3d
StateFunction = if[distanceNextStation < 500 , if[leftDoorsTarget > 0, 1, if[rightDoorsTarget > 0, 2, 0]], 0]

This will display state zero until the train is within 500m of the next station.
At this point, it will display state 1 if the left doors are to open, state 2 if the right doors are to open, or state 0 if neither are to open.

If you want to detect *both* doors opening, just requires another nested if:
Code:
States = Unlit.b3d, LeftDoorsOpen.b3d, RightdoorsOpen.b3d, BothDoorsOpen.b3d
StateFunction = if[distanceNextStation < 500 , if[leftDoorsTarget > 0 && rightDoorsTarget > 0, 3, if[leftDoorsTarget > 0, 1, if[rightDoorsTarget > 0, 2, 0]]], 0]

leezer3

Posts : 1978
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Northern Line and Rakago like this post

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum