Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Speed and Way The Doors Open and Close
#1
How do you code how fast or slow the doors should close and how to code so that the doors do not close the moment the sound of the doors closing starts playing?

Example: LU Doors (How to hold doors until the chime stops)
Reply
#2
The door closing speed depends on the doorclose sound itself.
Reply
#3
Let me phrase it in this way...

For example, look at joeyfjj's C751A, the doors do not close immediately after the sound plays.

Also, our C151, C651 and C751B all have different ways of closing their doors. I'm just wondering how do the developers make the codes for these and what are the codes?
Name: Ryan Lam (But you can just call me Ryan)
School: Temasek Junior College
Reps: C751B 327/328, C830 809, C151A 515/516
Youtube Channel: http://www.youtube.com/user/LamRyan1
Facebook: https://www.facebook.com/lam.ryan.52


Reply
#4
Well, the animation depends on the .ANIMATED file where the door codes are found.
An example is the KHI C151: (1131.animated)
Code:
;Door 1;

[Object]
States = drsl_left.csv
Position = 0.008,0,-9.06
TranslateZFunction = if[leftdoorstarget==0,if[leftdoors == 1,-0.87,if[leftdoors<1&leftdoors>0.5,leftdoors*leftdoors*(-0.87),if[leftdoors<0.5&leftdoors>0.3,-0.2175,if[leftdoors<0.3,leftdoors*(-0.725),0]]]],if[leftdoors == 1,-0.87,if[leftdoors<1&leftdoors>0.7,leftdoors*(-0.87),if[leftdoors<0.7&leftdoors>0.5,-0.609,if[leftdoors<0.5,leftdoors*(-1.218),0]]]]]

C751A has a unique animated code that allows the door to move once drcls.wav reaches a certain time. Thus you see a delay when opening doors in C751A, a delay after the doors "fully opened".

0.animated
Code:
[Object]
Position = 0,0, -0.425
States = doorsl1.csv
TranslateZFunction = 0.7*if[leftDoors[0]>0.5,1,leftDoors[0]*2]
Mark4211
Hi there! I am a railway technology enthusiast, currently studying at a polytechnic in Singapore.

North South Line for openBVE [NB: MSP - BSH]
[-] The following 1 user Likes Mark4211's post:
  • TIB1219M
Reply
#5
Um, can anyone explain how to code and what do they stand for?
Name: Ryan Lam (But you can just call me Ryan)
School: Temasek Junior College
Reps: C751B 327/328, C830 809, C151A 515/516
Youtube Channel: http://www.youtube.com/user/LamRyan1
Facebook: https://www.facebook.com/lam.ryan.52


Reply
#6
(04 December 2012, 10:03 PM)SMRT/SBS Transit Wrote:   Show/Hide

I hope I did not reply too late.

Code:
TranslateZFunction = 0.7*if[leftDoors[0]>0.5,1,leftDoors[0]*2]

0.7 is just the width of that door, any number will work here.

The if statement is the main part of the formula. Think of leftDoors as a number indicating how far the doors closing/opening sound have played. 0 is closed and 1 is opened.

Code:
if[leftDoors[0]>0.5
if the sound is more than half-way open,

Code:
,1
the doors appear fully opened.

Code:
,leftDoors[0]*2]
if not, close the doors gradually.
Joey Foo
The web design/development guy.
"Have you tried the '404' page on SGTrains.com?"
joeyfoo.com @joeyfjj 

Useful links: Download openBVE / C751A
[-] The following 2 users Like joeyfjj's post:
  • , Mark4211
Reply
#7
One more question, how do you hold the doors to a certain time (e.g. after 3 seconds of sound being played, door closes from the open position. And how do you code in such a way that a door waits for 2 seconds before being opened?
Name: Ryan Lam (But you can just call me Ryan)
School: Temasek Junior College
Reps: C751B 327/328, C830 809, C151A 515/516
Youtube Channel: http://www.youtube.com/user/LamRyan1
Facebook: https://www.facebook.com/lam.ryan.52


Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Requests to learn OpenBve coding SBS2831G 6 10,189 27 April 2016, 10:27 AM
Last Post: Hi1307
  [Bug] Last few left PSD doors not working TIB1219M 0 7,905 03 June 2013, 09:00 PM
Last Post: TIB1219M
  Resolved: Creating "faulty" doors SBS8217R 9 6,026 06 May 2011, 08:14 PM
Last Post: C830/C751B/C951 Fan
  Resolved: Doors closing announcements not played SmartUserID 8 6,450 11 February 2011, 08:17 PM
Last Post: joeyfjj

Forum Jump:


Users browsing this thread: 1 Guest(s)