[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:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

Slimey wrote:Is it possible for a train/line to send out a unique signal? Or to add that to this mod?

I´m thinking something like this:
IF train A stops at a station it send out signal "trainA". A smart inserter then loads coal on a transport belt which get delivered and loaded to the train.
Train B later stop at the same station and then send out signal "trainB". Another inserter now load iron on the belt.

I guess I could do something similiar with a dummy item in one of the wagons but it would be a lot easier if the train itself sent a signal like that.
I remember a similar request some time ago, but had a much more complex use case. I'll guess it won't hurt performance adding one more virtual signal with a static value. Working on some changes right now, maybe i get to it after i'm done.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

Updated to SmartTrains 0.3.78
  • change trains waiting forever to wait 2^32-1 ticks instead of going into manual mode
  • check for full/empty only if needed
  • better rules display in Traininfo window
  • minimal Factorio version is 0.12.27
  • added virtual signal for line number
  • now works with Logistics Railway (1.0.5+)
The line number can be set in the rules window

Upgrading should work without problems, some trains that are set to wait forever might go to the next station even if their rule isn't valid. But that shouldn't be too much of an issue.
In case you're wondering, 2^32-1 ticks are about 828 days, which is pretty much forever as far as a single save is concerned?! :D
Last edited by Choumiko on Mon Mar 28, 2016 8:33 am, edited 1 time in total.
BJHawk
Manual Inserter
Manual Inserter
Posts: 1
Joined: Mon Mar 28, 2016 7:29 am
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.77

Post by BJHawk »

I cannot update the mod. When both mods are in, the Factorio shuts down with a warning about duplicate mods, when I remove the old version, the save game returns an error:

Code: Select all

Error while running the
on_configuration_changed>
__SmartTrains__/control.lua:159: attempt to
index field 'rules' (a boolean value)
Creat
Inserter
Inserter
Posts: 41
Joined: Sun Jun 22, 2014 4:35 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.78

Post by Creat »

Download-Link in the OP doesn't work, the one in the post above this one does, however.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.78

Post by Choumiko »

Updated to SmartTrains 0.3.79
  • fixed "full rule" never being true
Creat wrote:Download-Link in the OP doesn't work, the one in the post above this one does, however.
Thanks, fixed.

Hopefully the last necessary bugfix release for a while, sorry :roll:
NoriSilverrage
Fast Inserter
Fast Inserter
Posts: 159
Joined: Mon Mar 21, 2016 1:19 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.79

Post by NoriSilverrage »

Is there a way using this mod (or base game I guess) to have a train choose a open station?
For instance, if you have two stations right next to each other, could the train go to the open station? I haven't seen a way to do that, but I'm pretty new to any of the logic systems.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.79

Post by Choumiko »

If you name the stations the same then the train will go to the open one. That's base game behaviour, if you need them named differently then SmartTrains could probably do it with a third station and some combinator/smartTrain station stuff.
NoriSilverrage
Fast Inserter
Fast Inserter
Posts: 159
Joined: Mon Mar 21, 2016 1:19 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.79

Post by NoriSilverrage »

Sweet. Thanks for the answer.
Also, awesome mod. Really liking it.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.79

Post by steinio »

Hello Choumiko,

i upgraded from *.73 to *.79 and created a new line.
Now i get the attached error message everytime the train reaches a station of the line.

Greetings steinio
Attachments
SmartTrains.png
SmartTrains.png (186.13 KiB) Viewed 8697 times
Image

Transport Belt Repair Man

View unread Posts
golfmiketango
Filter Inserter
Filter Inserter
Posts: 549
Joined: Fri Jan 29, 2016 2:48 am
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.79

Post by golfmiketango »

steinio wrote:Hello Choumiko,

i upgraded from *.73 to *.79 and created a new line.
Now i get the attached error message everytime the train reaches a station of the line.

Greetings steinio
Likewise. I presume the error occurs while manipulating the schedule, as after this message I notice my trains did not get their routes updated as expected.
golfmiketango
Filter Inserter
Filter Inserter
Posts: 549
Joined: Fri Jan 29, 2016 2:48 am
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.79

Post by golfmiketango »

Just figured out how to repro this. The bug is triggered while building the GUI panel to show the route of a line with multiple visits to the same station. There is a second error message, I think, which happens before this one:
__SmartTrains__/control.lua:737: Error while running the event handler: __SmartTrains__/gui.lua:216: attempt to perform arithmetic on field 'time_to_wait' (a nil value)
Once that happens,
  • The partially constructed GUI panel intended to show the line's route stays on-screen, permanently, until the next successful attempt to build a gui panel of the same type
  • The route is unable to be installed into the train schedules, causing the error reported a few posts above by steinio
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

Updated to SmartTrains 0.3.80

For completeness sake the recent bugfix releases:
  • fix lines not updating
  • add/remove rules after copying a line with changed # of stations
  • fixed "full rule" never being true
  • fixed upgrading saves that had lines without rules
Choumiko wrote:
  • change trains waiting forever to wait 2^32-1 ticks instead of going into manual mode
  • check for full/empty only if needed
  • better rules display in Traininfo window
  • minimal Factorio version is 0.12.27
  • added virtual signal for line number
  • now works with Logistics Railway (1.0.5+)
The line number can be set in the rules window
The error came from some wierd code removing unused rules. I believe it could have been fixed without code changes by simply opening the rules for that line and saving.. :D
golfmiketango wrote:Just figured out how to repro this. The bug is triggered while building the GUI panel to show the route of a line with multiple visits to the same station.
Yeah, one station in a schedule more than once was how i reproduced it, your error is a result of a missing ruleset for a line. When opening the GUI it tried to check if the train is set to wait forever to display it in the Traininfo, fixed now.
User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by steinio »

Thanks Choumiko,

works like a charm.
Image

Transport Belt Repair Man

View unread Posts
supagu
Burner Inserter
Burner Inserter
Posts: 12
Joined: Sat Feb 27, 2016 4:44 am
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by supagu »

I just been trying this mod out recently and have a few issues:

I'm trying to set up a station that:
1. tells the train where to go if resource X is required
2. spend the amount of time specified on the train to stay at that station before returning to the home station
3. auto refuel the train

I got #1 to work but only if I don't use the station timer to specify how long a train waits at the station, instead i needed to use the station at resource X to give the train the green light to go, if the train uses its timer to go, it will simply go to the next station in its schedule

Seems auto refuel doesn't work when I'm telling the train to go to specific stations....
NoriSilverrage
Fast Inserter
Fast Inserter
Posts: 159
Joined: Mon Mar 21, 2016 1:19 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by NoriSilverrage »

I'm trying to setup a train to only depart a smart stop if a resource is below a certain amount in a series of smart chests.
Figured it would be simple but I must be missing something. I connected the chests to a powerline and it is showing 46k. I then connect that to the light on the stop and put in coal less than 40k. Tried greater than too. One makes the light go on and the other makes it turn off, so it seems to be reading right.
Neither holds the train at the station though. What am I missing?
Creat
Inserter
Inserter
Posts: 41
Joined: Sun Jun 22, 2014 4:35 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by Creat »

NoriSilverrage wrote:I'm trying to setup a train to only depart a smart stop if a resource is below a certain amount in a series of smart chests.
Figured it would be simple but I must be missing something. I connected the chests to a powerline and it is showing 46k. I then connect that to the light on the stop and put in coal less than 40k. Tried greater than too. One makes the light go on and the other makes it turn off, so it seems to be reading right.
Neither holds the train at the station though. What am I missing?
You need to tell the train to actually react to the signal: Go to the train line window where you can tell it to leave when full, empty and so on. There's a check box called "signal". Tick that and the train will leave when the signal lights up.

Keep in mind that if you specify multiple conditions, they have to all be true for the train to leave. For example, if you tick "full" and "signal it will only leave if it's full and the signal is lit up. Hope it's clear now :)
NoriSilverrage
Fast Inserter
Fast Inserter
Posts: 159
Joined: Mon Mar 21, 2016 1:19 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by NoriSilverrage »

Creat wrote:
NoriSilverrage wrote:I'm trying to setup a train to only depart a smart stop if a resource is below a certain amount in a series of smart chests.
Figured it would be simple but I must be missing something. I connected the chests to a powerline and it is showing 46k. I then connect that to the light on the stop and put in coal less than 40k. Tried greater than too. One makes the light go on and the other makes it turn off, so it seems to be reading right.
Neither holds the train at the station though. What am I missing?
You need to tell the train to actually react to the signal: Go to the train line window where you can tell it to leave when full, empty and so on. There's a check box called "signal". Tick that and the train will leave when the signal lights up.

Keep in mind that if you specify multiple conditions, they have to all be true for the train to leave. For example, if you tick "full" and "signal it will only leave if it's full and the signal is lit up. Hope it's clear now :)
Ahh, that is it. Thanks! Didn't realize it needed to be a line. So many more options now. :) The magic combo was wait forever, and for signal.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by Choumiko »

supagu wrote:I just been trying this mod out recently and have a few issues:

I'm trying to set up a station that:
1. tells the train where to go if resource X is required
2. spend the amount of time specified on the train to stay at that station before returning to the home station
3. auto refuel the train

I got #1 to work but only if I don't use the station timer to specify how long a train waits at the station, instead i needed to use the station at resource X to give the train the green light to go, if the train uses its timer to go, it will simply go to the next station in its schedule

Seems auto refuel doesn't work when I'm telling the train to go to specific stations....
If i understand 1 and 2 right you want: A train waits for example 30 seconds at Station A. If during that time the green light turns on, it goes to a specified station in the schedule(#3 in picture below). If the time passes without the light going green it should go to another station?
Image
If that's what you want you can add the home station directly after Station A or create a combinator setup that starts a timer when it detects when a train arrives and after a certain time sets the value of the green light to the number of the home station (check "signal value" and "wait forever" in the rules then)

To 3: Yes, auorefuel is kind of useless in combination with the signal/Go to station/signal value rules. For it to work the last station in the schedule should have none of these rules.
xiffix
Burner Inserter
Burner Inserter
Posts: 15
Joined: Thu Oct 29, 2015 2:22 pm
Contact:

Re: [MOD 0.12.27+] SmartTrains 0.3.80

Post by xiffix »

Hello,

I really like the idea of this mod but...
Im running in an issue with the Refuel Feature.
Factorio SmartTrain Error.png
Factorio SmartTrain Error.png (2.19 MiB) Viewed 8871 times
I've named the Station "Refuel L-CC"
I don't know what i'm doing wrong.

Here is the error:
Error in SmartTrains.
__SmartTrains__/gui.lua:608: attempt to index field '?' (a nil value)

Thanks
Attachments
No crafting.zip
My Safe File
(4.87 MiB) Downloaded 129 times
Post Reply

Return to “Mods”