Train Scaling


Automate the construction and deconstruction of your trains! Configure a train currently scheduled for a station as a template for the station - the mod's special train construction station will automatically build (or destroy) copies of the template train on demand, or in response to circuit conditions.

Content
2 years ago
0.16 - 1.1
5.02K
Trains

b Crashes + Temp Fixes

2 years ago

got this when inputting number in the field next to slider

The mod Train Scaling (1.1.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event train-scaling::on_nth_tick(60)
train-scaling/control.lua:2439: bad argument #1 of 2 to 'newindex' (string expected, got number)
stack traceback:
[C]: in function '__newindex'
__train-scaling
/control.lua:2439: in function 'update_normal_station_gui'
train-scaling/control.lua:2573: in function <train-scaling/control.lua:2564>

Temp fix, Change line 2439 to from slider_flow.train_scaling_config_target_textbox.text = station_config.target To slider_flow.train_scaling_config_target_textbox.text = tostring(station_config.target),

tho this does seem to break basic functions of "Limiting" the trains being built Could be from another mod causing this as testing with a mostly unmodded (creative mod only loaded) the limiting worked fine
Next error, anything above 1000...

Error while running event train-scaling::on_gui_text_changed (ID 2)
train-scaling/control.lua:2676: bad argument #1 of 2 to 'newindex' (string expected, got number)
stack traceback:
[C]: in function '__newindex'
__train-scaling
/control.lua:2676: in function '?'
train-scaling/control.lua:2849: in function <train-scaling/control.lua:2843>

doing the same as before with other error Change line 2676 event.element.text = 1000 to event.element.text = tostring(1000)
But if you feel the need to have over 1000 trains (i know some of you may want to.) you will need to play with line 2675 and 2676 to reflect just how many you want.
2675 if tonumber(event.element.text) > 5000 then
2676 event.element.text = tostring(5000)
would give you a max of 5000 trains and allow any number from 1-5000

Last error i have ran into is while setting slider/number Lower then trains that are already built
Error while running event train-scaling::on_nth_tick(300)
train-scaling/control.lua:1842: attempt to get length of field 'wait_conditions' (a nil value)
stack traceback:
train-scaling/control.lua:1842: in function 'try_decommission'
train-scaling/control.lua:2061: in function <train-scaling/control.lua:1984>

No clue on how to fix this one, not actually a coder or modder but have learned a few tricks

Also This mod Does not work when used with "Do Robots Build Automatic Trains?" installed due to Trains being placed are forced into auto mode

2 years ago

The last one is caused by trains with no condition for the train stop. The code should check for nil first before checking how many conditions are set.

New response