[MOD 0.15] SmartTrains 2.0.5

Topics and discussion about specific mods
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

[MOD 0.15] SmartTrains 2.0.5

Post by Choumiko »

SmartTrains

Information

RefuelStations:
In the ST-Settings ui you can define the name of refueling station. If you want to use auto refueling, your actuall refueling station(s) must be named depending on the Train they can refuel. SmartTrains creates a type depending on how your train is set up. E.g. a single headed train with 4 cargo-wagons is of type L-CCCC, a double headed train might be L-CCCC-L. So if you use L-CCCC trains, your station needs to be "Refuel L-CCCC", "Refuel L-CCCC-L", etc.
When a train needs refueling, the station will be added to the end of the schedule. So plan for that by making the last station in the schedule close to a reachable refuelstation. (I tend to have the station at the Factory last and the refueling stations between the base stations and the mainline, so they can refuel after delivering their cargo and before going to outposts)

A quick howto on trainlines:
  • Creating a line: Stop the train, change the schedule as you wish, click "Read from UI", name the line, hit "Save as line", start the train. Done. The train is then automatically assigned to this line.
  • Changing a line: Like creating a line, when hiting "Read from UI" the train is unassigned from it's current line. The train your saving the line on get's updated right away, all other trains update at the next station they are going to
  • When you delete a line which has trains assigned, the trains delete their line and just keep the schedule
  • Renaming a line: If you rename a line, the trains stay assigned to the new name, so no need to reassign them
  • Rules: To set the "leave Station when empty/full" rule, click on "Rules" in the trainlines window, set it for the stations, click save. Done. The first check for the rule will happen 4 seconds after arriving at a station, the next ones every 2 seconds. If the normal waiting time is passed the train will still leave. You can change the time in ST-Settings ("Min. waiting time" and "Interval for autodepart")
Screenshots will follow, with explanation of what setting does what etc.
Old stuff
Attachments
Demosave.zip
(2.38 MiB) Downloaded 900 times
Last edited by Choumiko on Mon Sep 16, 2019 2:48 pm, edited 71 times in total.
OBAMA MCLAMA
Filter Inserter
Filter Inserter
Posts: 337
Joined: Fri May 30, 2014 4:23 am
Contact:

Re: [0.12.2+] SmartTrains 0.3

Post by OBAMA MCLAMA »

YUS! been waiting for this for a longgg time.

EDIT:
After testing it with 24 trains in the network. It has worked flawlessly. (3 hour test)
When the trains update their schedule on the next station, i love the bright yellow text notifying me of it :)
When i stream twitch i always answer questions and try to help, come visit me.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3

Post by Choumiko »

OBAMA MCLAMA wrote:YUS! been waiting for this for a longgg time.

EDIT:
After testing it with 24 trains in the network. It has worked flawlessly. (3 hour test)
When the trains update their schedule on the next station, i love the bright yellow text notifying me of it :)
Glad to hear that, i'm watching the recording right now :D I'll probably watch the beginning again (where you are a bit confused about Read from UI and stuff) and update the first post to make it clearer.
nosferato
Inserter
Inserter
Posts: 27
Joined: Sat Aug 02, 2014 11:11 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3

Post by nosferato »

Been waiting patiently for this, Many Thanks for updating
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.1

Post by Choumiko »

Updated to 0.3.1

Added "leave station when empty/full" as an option to trainlines.
Quote from the updated first post:
Rules: To set the "leave Station when empty/full" rule, click on "Rules" in the trainlines window, set it for the stations, click save. Done. The first check for the rule will happen 4 seconds after arriving at a station, the next ones every 2 seconds. If the normal waiting time is passed the train will still leave. You can change the time in ST-Settings ("Min. waiting time" and "Interval for autodepart")
nosferato wrote:Been waiting patiently for this, Many Thanks for updating
You're welcome. Throw some thanks to Obama Mclama too, He wasn't as patient, i remember the first thing hearing when watching his stream: "I need trainlines", might have been a coincidence :D
delassa
Burner Inserter
Burner Inserter
Posts: 13
Joined: Mon Jun 29, 2015 6:35 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.1

Post by delassa »

Checking or unchecking the "active" checkbox for a train on the Iron w-2-1 line gives the error

Code: Select all

Error in SmartTrains:__SmartTrains__/gui.lua:553 attempt to index local 't' (a nil value)
Ticking marked and hitting delete marked gives the error

Code: Select all

Error in SmartTrains:__SmartTrains__/gui.lua:400 attempt to compare number with nil
Also clicking the rules button brings the "route gui" to the top like normal but no "rules gui" is displayed below.

Save is below

https://drive.google.com/file/d/0B-Ua9C ... sp=sharing
OBAMA MCLAMA
Filter Inserter
Filter Inserter
Posts: 337
Joined: Fri May 30, 2014 4:23 am
Contact:

Re: [0.12.2+] SmartTrains 0.3.1

Post by OBAMA MCLAMA »

the latest update with the leave on full/empty is magnificent. I am able to tell trains to stay at a un/loading for 60-120 seconds, And leave when full. Which has opened up tons of new methods of building my yards.
For example, I run a steam powered world. I need lots of coal. I have 7 trains unloading coal that stop by for 10-15 seconds and only unload... 400-800 coal each trip. I now have them set up to stay for a long time, so they leave when they fully unload all of their cargo. Meaning more trains waiting to enter the station. (in my stacker)
Because of this, i now have less trains on the network driving, which in the end increases throughput on the network!
When i stream twitch i always answer questions and try to help, come visit me.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.2

Post by Choumiko »

Updated to 0.3.2
  • Changes
  • fixed error with - in trainlines (letters, numbers, space, -,#,!,$ allowed)
  • added info in ST-Settings about stations: uniquely named stations/total stations
  • prevent previous/next page button showing when invalid
  • trainline stations behave like vanilla when multiple stations with same name exist (renaming)
Your errors should be fixed delassa, all lines in the save can be de-/activated, deleted, renamed etc.

About the trainline stations behaving like vanilla stations: This was mostly a display error, now whenever you rename a station that is in a trainline, that trainlines station gets renamed if there isn't a station with the old name left. That's how vanilla behaves.
User avatar
BeltRunner
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Oct 02, 2014 8:23 am
Contact:

Re: [0.12.2+] SmartTrains 0.3.2

Post by BeltRunner »

Choumiko wrote: Rules: To set the "leave Station when empty/full" rule, click on "Rules" in the trainlines window, set it for the stations, click save. Done. The first check for the rule will happen 4 seconds after arriving at a station, the next ones every 2 seconds.
If the normal waiting time is passed the train will still leave.
Is it possible to change that?
It makes more sense for train to wait indefinitely if conditions aren't met.
OBAMA MCLAMA
Filter Inserter
Filter Inserter
Posts: 337
Joined: Fri May 30, 2014 4:23 am
Contact:

Re: [0.12.2+] SmartTrains 0.3.2

Post by OBAMA MCLAMA »

SmartTrains v 0.3.2
I'm coming across an error while trying to create and/or update an existing station name.
gui.lua ln.365 bad argument #2
http://puu.sh/js2O9/c9222ded92.jpg

error occurs with normal station names also.

Edit: downgrading to v0.3.1 fixed this issue.
When i stream twitch i always answer questions and try to help, come visit me.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.3

Post by Choumiko »

Updated to 0.3.3
fixed crash when saving/renaming lines
OBAMA MCLAMA wrote:I'm coming across an error while trying to create and/or update an existing station name.
gui.lua ln.365 bad argument #2
http://puu.sh/js2O9/c9222ded92.jpg
. instead of : was all :roll: :D
BeltRunner wrote:It makes more sense for train to wait indefinitely if conditions aren't met.
I would say it makes as much sense. Depends on the exact use. I'll see what i can do
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.12.2+] SmartTrains 0.3.3

Post by jeroon »

Choumiko wrote:
BeltRunner wrote:It makes more sense for train to wait indefinitely if conditions aren't met.
I would say it makes as much sense. Depends on the exact use. I'll see what i can do
If your outpost is depleted the train would wait there forever. Another option would be to create a "parking" station and send it there after a certain amount of time and retire, but still keep it's schedule. That way it's easy to see what outposts are depleted, from the safety of your main base. Might be complicating things a bit too much though :D
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.3

Post by Vin »

jeroon wrote:
Choumiko wrote:
BeltRunner wrote:It makes more sense for train to wait indefinitely if conditions aren't met.
I would say it makes as much sense. Depends on the exact use. I'll see what i can do
If your outpost is depleted the train would wait there forever. Another option would be to create a "parking" station and send it there after a certain amount of time and retire, but still keep it's schedule. That way it's easy to see what outposts are depleted, from the safety of your main base. Might be complicating things a bit too much though :D
Resource Monitor has warnings for when outposts become depleted. I know it's an additional mod, but I find it to be a much more elegant solution than looking to see if trains are empty.
OBAMA MCLAMA
Filter Inserter
Filter Inserter
Posts: 337
Joined: Fri May 30, 2014 4:23 am
Contact:

Re: [0.12.2+] SmartTrains 0.3.3

Post by OBAMA MCLAMA »

I just look at the map and see the outpost being depleted.

A solution is.... if a train leaves a station marked leave on full.... with empty cargo.
When i stream twitch i always answer questions and try to help, come visit me.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Choumiko »

Updated to 0.3.4

Changes:
  • Autorefuel adds "Refuel" as station if actual station not found
  • added option for trains to wait until full/empty, ignoring time
Note: Wait forever doesn't work with stations where waiting time is set to 0
jeroon wrote:If your outpost is depleted the train would wait there forever.
For outposts i would probably use wait until full with a time that is slightly longer than the time needed to fill the wagons when the chests are full. At unloading stations i can now (0.3.4 :D ) suggest wait until empty with wait forever set.
jeroon wrote:Another option would be to create a "parking" station and send it there after a certain amount of time and retire, but still keep it's schedule. That way it's easy to see what outposts are depleted, from the safety of your main base. Might be complicating things a bit too much though :D
Not going to do that ;)

Next up: Hooking the circuit network to train-stops, most likely in the form of "if signal euqals something, goto station X, else continue schedule". This should make a lot of things possible (clever use of signals/combinators and chaining of "smart-stops" assumed)
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Vin »

Using version 0.3.4 - toggleFlyingText seems to have no effect on the actual text displayed on the trains at stations. I'm assuming this is what it's supposed to affect? The UI gives me a true/false toggle when I enter the console command, but nothing seems to change.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Choumiko »

Um yeah.. actually it didn't work since the first release for 0.12, i forced it to be always on and forgot about it :D

You can change line 69 to

Code: Select all

global.showFlyingText = global.showFlyingText or false
and reload the save. Toggling should then work.

If all goes well, i might have a release with smart trainstops out this evening.
Outsider
Fast Inserter
Fast Inserter
Posts: 115
Joined: Sat Jan 10, 2015 12:23 am
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Outsider »

This is an awesome must have mod!
Thank you
Advanced Logistics System - Provides a detailed view of your logistics network and the items within it
Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Vin »

Do I need to hard reset the mod to get the toggle to work?

And it's line 69 of control.lua, yeah?
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.12.2+] SmartTrains 0.3.4

Post by Choumiko »

Vin wrote:Do I need to hard reset the mod to get the toggle to work?

And it's line 69 of control.lua, yeah?
Yeah, control.lua. No hard reset should be needed. And while you're at it, change line 421 in Train.lua to

Code: Select all

if s then self.train.carriages[1].surface.create_entity({name="flying-text", position=pos, text=msg, color=color}) end
Then it works, finally :D
Post Reply

Return to “Mods”