TrainsCaller deprecated

by Hermios

Allows trainstations to call trains when conditions are fulfilled

Content
4 years ago
0.14 - 0.18
14
Trains

b Crash when disconnecting circuit wire

5 years ago

OK, first of all, i have no idea what i'm doing, barely learn how to get this mod to work because i don't get that TrainCaller GUI when connecting the "red frame" to my trainstop.
2nd, this is bare test, only two train stop.
Although there are plenty of other mod related train is already installed.
If the problem is because certain mod conflict, i will post the full list and trying to find the culprit.

Crash Log :

343.288 Error MainLoop.cpp:1223: Exception at tick 17508: The mod TrainsCaller caused a non-recoverable error.
Please report this error to the mod author.

Error while running event TrainsCaller::on_tick (ID 0)
Index out of bounds.
stack traceback:
TrainsCaller/methods/trainFunctions.lua:117: in function 'removeTrainStop'
TrainsCaller/methods/trainStationFunctions.lua:129: in function 'removeSignal'
TrainsCaller/methods/trainStationFunctions.lua:83: in function 'updateRequestedSignals'
TrainsCaller/methods/globalEvents.lua:19: in function 'OnTick'
HermiosLibs/controlLib.lua:38: in function <HermiosLibs/controlLib.lua:31>
stack traceback:
[C]: in function 'newindex'
__TrainsCaller
/methods/trainFunctions.lua:117: in function 'removeTrainStop'
TrainsCaller/methods/trainStationFunctions.lua:129: in function 'removeSignal'
TrainsCaller/methods/trainStationFunctions.lua:83: in function 'updateRequestedSignals'
TrainsCaller/methods/globalEvents.lua:19: in function 'OnTick'
HermiosLibs/controlLib.lua:38: in function <HermiosLibs/controlLib.lua:31

5 years ago

Hey
Ok, first, I realise that the picture is quite old, and not up to date at all!!! There is no GUI anymore, very sorry for that.
The only GUI you have is on te trains, a check box to allow, or not multi caller.
To have this checkbox, you need to add an equipment TrainCaller to your train, then (To improve in the future), reopen your GUI.
This option is quite specific, you shouldn't bother about it first.
Then, connect a network to your red frame, and fill your train with something, that is requested by the network. The train schedule will be changed to go to the station.
For the crash, can you tell me what you did? I didn't havd this error, need to look at it
I will change the picture as soon as I can.
Thanks for the feedback

5 years ago
(updated 5 years ago)

Sorry for late reply, too much going on (testing a lot of different train related mod)

OK, i think i figured out what happened, it conflict with Train Skip Fulfilled Station mod ( i think...)
https://mods.factorio.com/mod/TrainSkipFulfilledStation

But actually the crash is not my major concern, it may just happen because the prior mod confused when there's only one train stop.
Because you know, this is a test, so i only put one station on the train itself.
Maybe it will become a major concern in the real playthrough, but at the moment i just disabling that mod to make this mod working.

This question below probably more fit in different thread, than the original bug report
(should i opened new thread for this ?)

Anyway my main problem is figuring out how this mod working.
Here's my simple test setup:
https://i.imgur.com/ZoxO9oS.jpg
Or as blueprint :
https://pastebin.com/hzktSwCf

The setup :
Left Side
Station A : The green signal were just to start test which train will depart, if they were given the same exact start,

Right Side
Station B: The train stop "red frame" is connected to constant combi, outputting Nuclear fuel signal (using value of 6 in the blueprint)

The train :
Each have 2 nuclear fuel in the cargo, condition were set to "Green > 0", just a way to start the test,

The result:
1. IF the constant combi outputing 2 nuclear fuel, one train is departing, okay...is this how it's supposed to work does it ?
2. BUT if the constant combi outputing 6 nuclear fuel, a train still depart ? Huh ? I thought only a train that have 2 nuclear fuel can depart ?

Further question :

How to setup so that i can have multiple train queuing in the same train stop ? How can i determined the number of train departed?
How to setup an empty train so it can depart to target station (a.k.a from unload to outpost/mining site) ?

Edit :
OK, i test a bit with train signal sender as well, (to figure out how to sent an empty train to an outpost), sadly i didn't managed to make it work at all.
You really need to provide sample save file. 😢

5 years ago

Hey
Well, first of all, many thanks for your interest in this mod, it's my favorite one, and I quite like that you have questions.
So, now, the answers:
I think you misconfused about how it works. The train caller is not related to any quantity. The concept is far more "simple":
A train stop needs a resource, a train has the resource, the train stop calls the train. While the train stop needs the resource, the train will be called. As soon as the train stop doesn't need the resource anymore, the train is released.
There is an algorithm to decide which train will be called (Defined on various paramaters), and once a train has been called for a specific resource, the train stop won't look for another one, for this resource.
So, in your case, where you have 2 trains with nuclear fuel, the train stop will make a call, and one of the train will answer this call. The other will just ignore it.
If the first train delivered all its nuclear fuel, and the train stop is still requesting more, then it will call the second one and so on.
You cannot really choose which train will be called, that is the job of the mod. You can only play on priorities by allowing or not multiple calls. Although I wouldn't recommand it, this option is not designed for that.
There is no real possibility to make a queue for the train stop, this one is implicit, according to the needs of the train stop.
To setup an empty train to go to a target station, you got the point, Train Signal Sender is your friend. And I am surprised it doesn't work. Maybe you can give me more details: Does the empty train has the appropriate equipment? Does it have at least a quantity of one for the resource?
To provide an accurate test, ensure that this train is only one that can be called for the specific resource. If you asked for the nuclear fuel, and another train already has it, then it may happen that the other train will be called instead of the empty one.

5 years ago

Thanks for the reply,
Apparently the new update fix the behavior, now the train that have signal can get an order.
No wonder i confused why it doesn't work before.

Too bad this can't support queuing, linear unload is much more efficient and faster with train traffic than the stacker one.
I guess i have to live with none of those if i'm dedicated using this mod as the main train manager.

There is one major future UPS concern though, in my test world i only use 3 train, yet the train signal sender mod already use 0.2 script update. That's pretty high, compare to TrainCaller mod that only use 0.042 script update.
I wonder if the script update will expand linearly with the number of train that use signal .
(which would be all train that go to mining site).

Back to original TrainCaller question :
I'm not clear why the train can still be sent even if the content were below or above the provided signal.

Example :
It doesn't matter what if the constant combi in station B is outputing 1 nuclear fuel, 2 nuclear fuel or even 6.
As long as the train have nuclear fuel in their cargo, even as little as 1 item, they will get called ?

This pose a problem for a mixed train, example my outpost maintenance train carrying light oil, wall, repair pack, ammo, construction bot, etc.
A wrong kind of train can arrive instead.
OK, probably i shouldn't use it on every train.

But this pose a question do train that partially full still be called ?

I have more question, related to my playthrough, still haven't figure out how this mod will working logically (with my chain production setup)
But i will posting it in different thread, since this is a bug thread, plus i haven't actually test it.

5 years ago
(updated 5 years ago)

Hi again
Train signal: Possibly, yes, there was a bug with Trainsignalsender, fixed in this new version. So it was it :)

Linear queue is not something that I see as possible, due to the design. It would mean planning in the future what is required. This would mean as well that one train stop can lock all the trains of a kind.
As to unload your content, why not manually define the stations in your train schedule? I do it. The train caller lets trains save which station has been called by the train caller, and delete those once the call is over. However, manually defined stations are maintained.

Considering the UPS, I didn't evaluate it. For my own game, not so much problem with TrainSignalSender, no change if I add many trains, or many items to one train.
The only issue I have is with Roboport Converter, when there are too much ghosts. Then the game get slower.
If you have actual UPS trouble, please let me know, I'll try to find a solution.

For the behavior of train caller, once again, quantity is not taken in account.
Maybe a use case can help you understand how it works: I have an outpost, where many walls have been destroyed. This outpot needs repair. Since Walls destroyed are now ghots, the roboport converter transform those as signals. Those signals are sent to the train stop, which will call for walls. If a train has those walls, it will bring those to the train stop.
Even if the train doesn't have enough of those walls, or i it has other content, it will bring it. Then, the train stop will call another train that has further walls. The purpose is to avoid a dead lock situation, where a problem can never be fixed because a train has not enough of a specific material (Too much of an item requested compared to the capacities of a train, for example).

If you wish to limit the quantity delivered to a station, you can play with smart unloaders, and connect them to your circuit network (The same you connect to your train stop). I do this, and it works fine.

if you have a train that has similar content as another one, and shouldn't be callable, then just don't provide it the equipment. Otherwise, I don't see a use case where a train with required content and callable shouldn't be called.

Please, if you have any further use case, don't hesitate to share with me. Either the solution is already in, or I may think about a way to improve my mod (if relevant).
FYI, this mods works now very fine with all my use cases. The only problem is that the connections to redframe cannot be blueprinted, they have to be set manually each time.

5 years ago

The ghost signal as a way to deliver order is neat idea, i never thought of that !👍
No need to predetermined what item most likely get destroyed, or having a different set of item deliveries.
But playing with Rampant mod, that approach will obliterate my outpost before any replacement arrive fast enough.

I do use ghost signal by another mod to auto load-deliver a dedicated train, but i only do that to built outpost.
Never thought doing it for maintenance purpose.
And i do that with multiplexing signal (while this mod doesn't need a physical connection, neat !)
But i don't think it's suitable for current playthrough, all my outpost were universally the same design, only fit for L-CC or L-C for maintenance, while the "industrial" train were L-CCCC.
Sending those to outpost to deliver ghost will not fit them.

But 10/10 will use your approach in next playthrough.
Thanks for the idea, i love it ❤ !

Regarding my playthrough question, i will post them tomorrow, in different thread.
In my head, some my current setup with this mod either will simply goes on loop forever, or a wrong kind of train will get called instead.
But that's just setup in my head, i have to test it.

5 years ago

I actually use the traincaller for more or less anything: Building an outpost (I start with a train controlled manually, then, once I set the base, I create ghosts and wait for another train to got), maintenance, and even for trains loading:
This way, I don't need to name all my outposts identically, which occures issues when trying to get there in automatic mode, and is unmanageable if an outpost deliver more than one kind of resource. With the train caller, this is the content of boxes that will call a train. Besides, if a train is called, another one won't be, this way, I avoid a useless queue.
My trains are all LCL, to keep it simple.

Finally, for the rampant, you can as well give yourself some buffer: For example, if your resources of wall are less than 100, call a train!
Thanks anyway for loving it :)
If you have any suggestion to improve it, or improve the explanation, please tell me, I'll update it

New response