Way to not stop at station if train is full of cargo?
Moderator: OpenTTD Developers
Way to not stop at station if train is full of cargo?
Is there any way to set this up, when really long train has orders to go to couple stations (f.e. forests) and then final destination (f. e. paper mill) to do not stop at that forest stations, if is already full of cargo (wood)? I mean, there is no other empty wagons, so there is no reason to stop at that station and just go through to the final station (paper mill).
Re: Way to not stop at station if train is full of cargo?
Use conditional orders. https://wiki.openttd.org/en/Manual/Conditional%20Orders
1: Go non-stop to Station A (Load if available)
2: Jump to order 4 when Load percentage is equal to 100.
3: Go non-stop to Station B (Load if available)
4: Go non-stop to Station C (Unload)
1: Go non-stop to Station A (Load if available)
2: Jump to order 4 when Load percentage is equal to 100.
3: Go non-stop to Station B (Load if available)
4: Go non-stop to Station C (Unload)
Do you like drones, quadcopters & flying toys? Check out Drone Strike Force!

Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets

Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Re: Way to not stop at station if train is full of cargo?
Yep - Conditional orders are what you're looking for.
Find them in the orders' screen, by clicking and holding on the bottom-right button
Find them in the orders' screen, by clicking and holding on the bottom-right button
Re: Way to not stop at station if train is full of cargo?
With the question of orders in regard to loading up: There is still no way to just fill a part of the cargo capacity of a train, right?kamnet wrote: 04 Aug 2023 15:37 Use conditional orders. https://wiki.openttd.org/en/Manual/Conditional%20Orders
1: Go non-stop to Station A (Load if available)
2: Jump to order 4 when Load percentage is equal to 100.
3: Go non-stop to Station B (Load if available)
4: Go non-stop to Station C (Unload)
Say a train has a capacity of 100 units (whatever that is) for a certain cargo - what I really would like to do is:
1: go to Station A and load up to 50 units of a particular cargo (leaving at least 50 units capacity for that cargo empty)
2: go to Station B and load up to 50 units of a particular cargo
3: go to Station C and unload all cargo
Same the other way round - say a train has loaded 100 units of a certain cargo:
1: go to Station B and unload 50 units of cargo
2: go to Station A and unload 50 units of cargo
Both would be neat to fill up or unload a train one by one during multiple stops.
Re: Way to not stop at station if train is full of cargo?
no, that is not possible.ebla71 wrote: 04 Aug 2023 15:581: go to Station A and load up to 50 units of a particular cargo (leaving at least 50 units capacity for that cargo empty)
[...]
1: go to Station B and unload 50 units of cargo
Re: Way to not stop at station if train is full of cargo?
I cannot but point out that this is a typical newbie mistake. If you don't pick up cargo from further stations down the line, their rating will drop, which in turn will cause a drop in production. Eventually you'll remain with one or two industries in the beginning of the circuit, while the rest will decline and eventually close down.legitalk wrote: 04 Aug 2023 13:47 Is there any way to set this up, when really long train has orders to go to couple stations (f.e. forests) and then final destination (f. e. paper mill) to do not stop at that forest stations, if is already full of cargo (wood)? I mean, there is no other empty wagons, so there is no reason to stop at that station and just go through to the final station (paper mill).
To keep up the station rating and make the production increase, make sure that there is always a train waiting for full load at each industry. If your industries are still small but you want to have a big delivery train, set up feeder services with shorter trains.
My add-ons: • AdmiralAI fix • Persistence for vehicle evolution lines
My pictures: • The animation thread
My pictures: • The animation thread
Re: Way to not stop at station if train is full of cargo?
Does somebody have a link to the part of the source code where the conditional orders are handled for me or at least the name of the file that does that?
I would like to take a look but lack a general overview of the overall code structure.
- 2TallTyler
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- Contact:
Re: Way to not stop at station if train is full of cargo?
Thank you very much for pointing to the source code.2TallTyler wrote: 05 Aug 2023 12:59 Should be order_cmd.cpp.
https://github.com/OpenTTD/OpenTTD/blob ... er_cmd.cpp
It's the switch block in the ProcessConditionalOrder() function that determines which conditional orders are available, right?
I roughly understand what it is doing but unfortunately I'm mostly a "Python person" ...
Re: Way to not stop at station if train is full of cargo?
the problem with "only load 50%" orders is that the conditional orders are only evaluated AFTER loading finished.
- 2TallTyler
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- Contact:
Re: Way to not stop at station if train is full of cargo?
C++ is not quite as simple as Python.
I have not delved into orders recently, but conditional order types are defined in this header file and assigned to orders in various places in order_gui.cpp: https://github.com/OpenTTD/OpenTTD/blob ... er_gui.cpp
The best way to explore is is probably to check out the OpenTTD repository and open it in something like Visual Studio, where you can follow links between files, see references, etc., using IntelliSense or its equivalent. Instructions for this are in the official Contributing guide, which also contains links to the Compiling guide and other resources.

I have not delved into orders recently, but conditional order types are defined in this header file and assigned to orders in various places in order_gui.cpp: https://github.com/OpenTTD/OpenTTD/blob ... er_gui.cpp
The best way to explore is is probably to check out the OpenTTD repository and open it in something like Visual Studio, where you can follow links between files, see references, etc., using IntelliSense or its equivalent. Instructions for this are in the official Contributing guide, which also contains links to the Compiling guide and other resources.
Re: Way to not stop at station if train is full of cargo?
I know - that's why in a professional context I only prototype in Python and then a "real" software developer re-codes my gibberish in C++

Thank you very much for the insight - already found the definition and learnt that the assignment and evaluation of orders are handled by some different pieces of code.2TallTyler wrote: 06 Aug 2023 15:12 I have not delved into orders recently, but conditional order types are defined in this header file and assigned to orders in various places in order_gui.cpp: https://github.com/OpenTTD/OpenTTD/blob ... er_gui.cpp
Not as simple as thought - contributions will possibly have to wait until my retirement, which is still a couple of decades down the road

- 2TallTyler
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- Contact:
Re: Way to not stop at station if train is full of cargo?
For what it's worth, I learned C++ to contribute to OpenTTD with little formal training. Start simple and work your way up to more complex changes.
Re: Way to not stop at station if train is full of cargo?
The main problem, as always with such projects, is time besides family and a regular job ... plus program or play?2TallTyler wrote: 07 Aug 2023 10:17 For what it's worth, I learned C++ to contribute to OpenTTD with little formal training. Start simple and work your way up to more complex changes.
Re: Way to not stop at station if train is full of cargo?
as a rule of thumb: if you start programming on a game, you will never play that game again 

Who is online
Users browsing this forum: Ahrefs [Bot] and 13 guests