Page 1 of 31

[MOD 0.15] SmartTrains 2.0.5

Posted: Sun Aug 02, 2015 2:51 pm
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

Re: [0.12.2+] SmartTrains 0.3

Posted: Mon Aug 03, 2015 12:54 am
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 :)

Re: [0.12.2+] SmartTrains 0.3

Posted: Mon Aug 03, 2015 9:40 am
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.

Re: [0.12.2+] SmartTrains 0.3

Posted: Wed Aug 05, 2015 5:16 am
by nosferato
Been waiting patiently for this, Many Thanks for updating

Re: [0.12.2+] SmartTrains 0.3.1

Posted: Wed Aug 05, 2015 5:49 pm
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

Re: [0.12.2+] SmartTrains 0.3.1

Posted: Wed Aug 05, 2015 10:32 pm
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

Re: [0.12.2+] SmartTrains 0.3.1

Posted: Thu Aug 06, 2015 2:26 am
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!

Re: [0.12.2+] SmartTrains 0.3.2

Posted: Thu Aug 06, 2015 1:03 pm
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.

Re: [0.12.2+] SmartTrains 0.3.2

Posted: Thu Aug 06, 2015 4:47 pm
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.

Re: [0.12.2+] SmartTrains 0.3.2

Posted: Thu Aug 06, 2015 10:14 pm
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.

Re: [0.12.2+] SmartTrains 0.3.3

Posted: Fri Aug 07, 2015 10:27 am
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

Re: [0.12.2+] SmartTrains 0.3.3

Posted: Fri Aug 07, 2015 12:52 pm
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

Re: [0.12.2+] SmartTrains 0.3.3

Posted: Fri Aug 07, 2015 4:03 pm
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.

Re: [0.12.2+] SmartTrains 0.3.3

Posted: Fri Aug 07, 2015 4:10 pm
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.

Re: [0.12.2+] SmartTrains 0.3.4

Posted: Fri Aug 07, 2015 5:14 pm
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)

Re: [0.12.2+] SmartTrains 0.3.4

Posted: Sat Aug 08, 2015 10:07 am
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.

Re: [0.12.2+] SmartTrains 0.3.4

Posted: Sat Aug 08, 2015 11:30 am
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.

Re: [0.12.2+] SmartTrains 0.3.4

Posted: Sat Aug 08, 2015 12:17 pm
by Outsider
This is an awesome must have mod!
Thank you

Re: [0.12.2+] SmartTrains 0.3.4

Posted: Sat Aug 08, 2015 4:42 pm
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?

Re: [0.12.2+] SmartTrains 0.3.4

Posted: Sat Aug 08, 2015 4:50 pm
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