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

Is current .sta StopDuration able to be received by OpenBveApi?

2 posters

Go down

Is current .sta StopDuration able to be received by OpenBveApi? Empty Is current .sta StopDuration able to be received by OpenBveApi?

Post by M4211 Thu Nov 26, 2020 1:59 pm

Hi! I'm fairly a new developer for a train plugin

I was trying to replicate a real life scenario where the train's display would be able to receive a 'dwell' time when at the station.

In game this 'dwell' time is set by the .sta StopDuration feature, but I am not able to get the StopDuration value into the plugin.

Is current .sta StopDuration able to be received by OpenBveApi?

M4211

Posts : 3
Join date : 2020-11-26

https://www.sgtrains.com

Back to top Go down

Is current .sta StopDuration able to be received by OpenBveApi? Empty Re: Is current .sta StopDuration able to be received by OpenBveApi?

Post by leezer3 Fri Nov 27, 2020 5:31 pm

Look in the ElapseData supplied each frame.
You want the Stations from there, and then you'd need to calculate the dwell time from the arrival / departure times.

I don't recall offhand when this was added to the API, but was likely around ~1.6

For maximum compatibility however, you'd need to build against the legacy 1.4 API and supply the dwell time via a beacon in the route.

leezer3

Posts : 1980
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Is current .sta StopDuration able to be received by OpenBveApi? Empty Re: Is current .sta StopDuration able to be received by OpenBveApi?

Post by M4211 Fri Nov 27, 2020 7:39 pm

leezer3 wrote:Look in the ElapseData supplied each frame.
You want the Stations from there, and then you'd need to calculate the dwell time from the arrival / departure times.

I don't recall offhand when this was added to the API, but was likely around ~1.6

For maximum compatibility however, you'd need to build against the legacy 1.4 API and supply the dwell time via a beacon in the route.

Ah thanks! So it's not possible to receive the actual StopDuration value at all, just need to be calculated from arrival/departure times

At first I assumed that Station.StopTime would contain the value

Will use the Beacon data to supply this data then

I appreciate the clarification!

M4211

Posts : 3
Join date : 2020-11-26

https://www.sgtrains.com

Back to top Go down

Is current .sta StopDuration able to be received by OpenBveApi? Empty Re: Is current .sta StopDuration able to be received by OpenBveApi?

Post by leezer3 Fri Nov 27, 2020 10:57 pm

Sorry, you're right, that's what comes of skimming code.

StopTime will contain that value, but that comes with the API version isse noted.

However, now I've read and tested the code it's got some issues that need solving properly:

  • This value hasn't got any sense checking at the minute; If you create a station with no set arrival / departure times, this will currently return 0 (*not* the minimum stop time as would be expected)
  • A station with no arrival time but a departure time will produce a wrong value. (It returns the time representation for the departure as the stop duration)
  • Similar issue with departure time set but no arrival time. (silly negative numbers)
  • AllStop seems to break it and sets it to zero.


TLDR:
It's broken Razz
I'll try and fix it properly over the weekend, but for maximum compatability and less bugs the beacons are going to be the solution at the minute.

leezer3

Posts : 1980
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Is current .sta StopDuration able to be received by OpenBveApi? Empty Re: Is current .sta StopDuration able to be received by OpenBveApi?

Post by M4211 Sun Nov 29, 2020 12:00 pm

leezer3 wrote:Sorry, you're right, that's what comes of skimming code.

StopTime will contain that value, but that comes with the API version isse noted.

However, now I've read and tested the code it's got some issues that need solving properly:

  • This value hasn't got any sense checking at the minute; If you create a station with no set arrival / departure times, this will currently return 0 (*not* the minimum stop time as would be expected)
  • A station with no arrival time but a departure time will produce a wrong value. (It returns the time representation for the departure as the stop duration)
  • Similar issue with departure time set but no arrival time. (silly negative numbers)
  • AllStop seems to break it and sets it to zero.


TLDR:
It's broken Razz
I'll try and fix it properly over the weekend, but for maximum compatability and less bugs the beacons are going to be the solution at the minute.

No worries, thank you mate!

M4211

Posts : 3
Join date : 2020-11-26

https://www.sgtrains.com

Back to top Go down

Is current .sta StopDuration able to be received by OpenBveApi? Empty Re: Is current .sta StopDuration able to be received by OpenBveApi?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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