You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AIs and Game Scripts can use the following new class (that I have proposed) to timetable their vehicles (ScriptTimetable). If needed, the final implementation could be merged into the ScriptOrder class instead. The proposed implementation is subject to change, but it is suggested that the same functionality is retained.
ScriptTimetable::ChangeWaitTime(vehicle_id, order_position, time)
Sets the wait time of an order. Acts as if you pressed the "Change Time" button with the order highlighted and entered the value (in ticks) passed into time. Set null to instead act as if you pressed the "Clear Time" button.
ScriptTimetable::ChangeTravelTime(vehicle_id, order_position, time)
Sets the travel time of an order. Acts as if you pressed the "Change Time" button with the "Travel for X days/ticks" highlighted and entered the value (in ticks) passed into time. Set null to instead act as if you pressed the "Clear Time" button.
ScriptTimetable::ChangeSpeedLimit(vehicle_id, order_position, speed_limit)
Sets the speed limit of an order. Acts as if you pressed the "Change Speed Limit" button with the "Travel for X days/ticks" highlighted and entered the value (in internal units) passed into speed_limit. Set null to instead act as if you pressed the "Clear Speed Limit" button.
ScriptTimetable::SetStartDate(vehicle_id, start_date, distribute)
Sets the starting date of the timetable. Acts as if you pressed the "Start date" button and set the date passed into start_date. If the distribute flag is set, acts as if you also held CTRL.
ScriptTimetable::ResetLateCounter(vehicle_id)
Resets the late counter of a vehicle. Acts as if you pressed the "Reset Late Counter" button.
ScriptTimetable::Autofill(vehicle_id, non_destructive)
Acts as if you pressed the "Autofill" button. If the non_destructive flag is set, acts as if you also held CTRL.
ScriptTimetable::GetWaitTime(vehicle_id, order_position) ScriptTimetable::GetTravelTime(vehicle_id, order_position) ScriptTimetable::GetSpeedLimit(vehicle_id, order_position)
Gets the wait time, travel time, or speed limit of an order. Times are returned in ticks, while the speed limit is returned in OpenTTD's internal speed unit (mph/1.6).
ScriptTimetable::GetTimetableDelay(vehicle_id)
Gets how far behind or ahead the vehicle is from schedule. Negative values are late, positive values are behind. Zero means vehicle is on time, and an invalid value means the vehicle's lateness has not been graded yet.
Actual result
There is no such class built-in. AIs and Game Scripts can not timetable their vehicles in any built-in way.
Reasoning
I would like if AI/GS could fully timetable vehicles in the same way that a human player already can. This would allow for AI/GS to create 'realistic' services that don't end-up bunching up and instead are spaced out for optimal service (and therefore station rating).
The text was updated successfully, but these errors were encountered:
Version of OpenTTD
Last tested: 2020-01-08 master
Expected result
AIs and Game Scripts can use the following new class (that I have proposed) to timetable their vehicles (
ScriptTimetable
). If needed, the final implementation could be merged into theScriptOrder
class instead. The proposed implementation is subject to change, but it is suggested that the same functionality is retained.ScriptTimetable::ChangeWaitTime(vehicle_id, order_position, time)
Sets the wait time of an order. Acts as if you pressed the "Change Time" button with the order highlighted and entered the value (in ticks) passed into
time
. Setnull
to instead act as if you pressed the "Clear Time" button.ScriptTimetable::ChangeTravelTime(vehicle_id, order_position, time)
Sets the travel time of an order. Acts as if you pressed the "Change Time" button with the "Travel for X days/ticks" highlighted and entered the value (in ticks) passed into
time
. Setnull
to instead act as if you pressed the "Clear Time" button.ScriptTimetable::ChangeSpeedLimit(vehicle_id, order_position, speed_limit)
Sets the speed limit of an order. Acts as if you pressed the "Change Speed Limit" button with the "Travel for X days/ticks" highlighted and entered the value (in internal units) passed into
speed_limit
. Setnull
to instead act as if you pressed the "Clear Speed Limit" button.ScriptTimetable::SetStartDate(vehicle_id, start_date, distribute)
Sets the starting date of the timetable. Acts as if you pressed the "Start date" button and set the date passed into
start_date
. If thedistribute
flag is set, acts as if you also held CTRL.ScriptTimetable::ResetLateCounter(vehicle_id)
Resets the late counter of a vehicle. Acts as if you pressed the "Reset Late Counter" button.
ScriptTimetable::Autofill(vehicle_id, non_destructive)
Acts as if you pressed the "Autofill" button. If the
non_destructive
flag is set, acts as if you also held CTRL.ScriptTimetable::GetWaitTime(vehicle_id, order_position)
ScriptTimetable::GetTravelTime(vehicle_id, order_position)
ScriptTimetable::GetSpeedLimit(vehicle_id, order_position)
Gets the wait time, travel time, or speed limit of an order. Times are returned in ticks, while the speed limit is returned in OpenTTD's internal speed unit (mph/1.6).
ScriptTimetable::GetTimetableDelay(vehicle_id)
Gets how far behind or ahead the vehicle is from schedule. Negative values are late, positive values are behind. Zero means vehicle is on time, and an invalid value means the vehicle's lateness has not been graded yet.
Actual result
There is no such class built-in. AIs and Game Scripts can not timetable their vehicles in any built-in way.
Reasoning
I would like if AI/GS could fully timetable vehicles in the same way that a human player already can. This would allow for AI/GS to create 'realistic' services that don't end-up bunching up and instead are spaced out for optimal service (and therefore station rating).
The text was updated successfully, but these errors were encountered: