I want to edit TrainSchedule easily

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
spiral_power
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Oct 30, 2019 5:17 am
Contact:

I want to edit TrainSchedule easily

Post by spiral_power »

Are there any mods or tools which can edit TrainSchedule easily?
Text-base one is best for me, because it is easy to edit (copy/paste/REPLACE) .
https://lua-api.factorio.com/latest/Con ... inSchedule

Hundreds trains and each have different dozens stations and conditons , I must be crazy if I set them manually...
I don't have experience of making Factorio mods nor lua , but I may have to make some mods or tools .

2.png
2.png (69.06 KiB) Viewed 834 times

User avatar
spiral_power
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Oct 30, 2019 5:17 am
Contact:

Re: I want to edit TrainSchedule easily

Post by spiral_power »

I couldn't wait so I made some scripts which inputs to console.
Somewhat good.

export

Code: Select all

local id=11794
local trains=game.player.surface.get_trains()
local list = ""
for _, train in pairs(trains) do
	if ( train.id == id ) then
		game.write_file("schedule.lua", serpent.block(train.schedule)..",\n" .. "\n")
	end
end
import

Code: Select all

local id=11794
local trains=game.player.surface.get_trains()
for _, train in pairs(trains) do
	if ( train.id == id ) then
		train.schedule=
--------------------------
--modified TrainSchedule--
--------------------------
	end
end

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 4051
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: I want to edit TrainSchedule easily

Post by eradicator »

spiral_power wrote:
Thu Feb 20, 2020 9:23 am
Are there any mods or tools which can edit TrainSchedule easily?
Text-base one is best for me,
A few problems i can think of for text based editing:
1) Editing raw lua tables is not userfriendly.
2) Inventing some sort of custom language throws you into parsing hell.
3) Without graphics the user would have to know the internal names of items.
4) Also a mod with complex text input would require at least a basic text editor which would have to be implemented first.

I mean sure...if you just want an undecorated window that lets you edit raw lua tables, that's easy to mod. But anything userfriendly ... :|.
Author of: Hand Crank Generator, Screenshot Hotkey 2.0, /sudo
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

ptx0
Filter Inserter
Filter Inserter
Posts: 304
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: I want to edit TrainSchedule easily

Post by ptx0 »

eradicator wrote:
Fri Feb 21, 2020 4:04 pm
spiral_power wrote:
Thu Feb 20, 2020 9:23 am
Are there any mods or tools which can edit TrainSchedule easily?
Text-base one is best for me,
A few problems i can think of for text based editing:
1) Editing raw lua tables is not userfriendly.
2) Inventing some sort of custom language throws you into parsing hell.
3) Without graphics the user would have to know the internal names of items.
4) Also a mod with complex text input would require at least a basic text editor which would have to be implemented first.

I mean sure...if you just want an undecorated window that lets you edit raw lua tables, that's easy to mod. But anything userfriendly ... :|.
train blueprints are base64 encoded json strings which contain the schedule for the train, it's not a major leap to think of editing JSON and clicking "Confirm" would be all you'd need to know.

JasonCurnow
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Jan 03, 2018 4:44 am
Contact:

Re: I want to edit TrainSchedule easily

Post by JasonCurnow »

This is a bit of an old thread, but I thought it was worth chiming in.. You might consider the add-on Logistics Train Network (LTN). It turns your rail network into a logistics network. Stations can request resources (like a requester chest) or provide resources (like a provider chest). LTN then schedules a train to fetch and deliver the resources you want. an example would be you have 4 stations providing copper bars, and you need to request copper bars at your green circuit station, your mall and your structures station. LTN will figure out where to get copper from and schedule a train anywhere that needs it. It DOES have a fairly high learning curve, but factorio.school does have some good blueprints for stations and there's quite a few videos to help. If you do go this route, make very, very sure to make an extra save of your game before diving in. I just built a "mid-game" base (1,000 SPM) with LTN and it works great. For a true megabase, it's probably not needed as you will likely have dedicated resource patches for specific functions and back-and-forth trains dedicated to the route, however.

Hannu
Filter Inserter
Filter Inserter
Posts: 729
Joined: Thu Apr 28, 2016 6:27 am
Contact:

Re: I want to edit TrainSchedule easily

Post by Hannu »

eradicator wrote:
Fri Feb 21, 2020 4:04 pm
I mean sure...if you just want an undecorated window that lets you edit raw lua tables, that's easy to mod. But anything userfriendly ... :|.
When this kind of problem arise, player probably have complex trainworld with tens of complex train schedules. Setting up train schedules takes several hours. It is very profitable to use hour or two to learn how to use scripts and then be able to use versatile text manipulation of writing programs.

But I suggest that devs add ability to change station name without changing leave conditions and copy and paste conditions (single conditions and groups) in schedule window and between schedules. That would add very much flexibility with moderate costs and no more complexity for beginners.

Hannu
Filter Inserter
Filter Inserter
Posts: 729
Joined: Thu Apr 28, 2016 6:27 am
Contact:

Re: I want to edit TrainSchedule easily

Post by Hannu »

spiral_power wrote:
Fri Feb 21, 2020 9:07 am
I couldn't wait so I made some scripts which inputs to console.
Thank you. I have thought many times that I should ask is there this kind of functionality. I will test this very soon in my DyWorld modded trainworld.

User avatar
spiral_power
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Oct 30, 2019 5:17 am
Contact:

Re: I want to edit TrainSchedule easily

Post by spiral_power »

Thank you for your comments.

If I try to import a wrong schedule, factorio returns an error messasge and won't destroy game datas, factorio does verification .
I think this is for some expert user, so unuserfrendly is OK, but It does really efficient working for some users.

My current factory is now 37M rockets, 381kspm with Bob's, god module use, NO excess 1 tick bug use.
Before, I made vanilla 1M rockets, 7kspm factory, I needed good UPS too.
In vanilla, It is not so hard to manual scheduling trains because vanilla's optimised pattern is somewhat simple, but Bob's is not.

I don't know LTN much, but I know a little. I wonder LTN is for small factory, no UPS worry and less train running.
I need good UPS, I think optimised HARD CODING schedule is good for UPS.

In first building, I does many copy/paste stop conditions.
In maintainance phase (current phase, refactoring), I does many editing train-stop names, and sometimes does copy/paste stop conditions.
To edit train-stop names, I now must export/import schedule , it is Troublesome ( but much better than no script use), if I could edit train-stop names on GUI. ;)

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2649
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: I want to edit TrainSchedule easily

Post by darkfrei »

spiral_power wrote:
Fri Jun 19, 2020 4:49 am
I need good UPS, I think optimised HARD CODING schedule is good for UPS.
Try not use any crossings and intersections, so every railway line has only two stations, Input and Output.

User avatar
spiral_power
Burner Inserter
Burner Inserter
Posts: 11
Joined: Wed Oct 30, 2019 5:17 am
Contact:

Re: I want to edit TrainSchedule easily

Post by spiral_power »

darkfrei wrote:
Fri Jun 19, 2020 7:27 am
spiral_power wrote:
Fri Jun 19, 2020 4:49 am
I need good UPS, I think optimised HARD CODING schedule is good for UPS.
Try not use any crossings and intersections, so every railway line has only two stations, Input and Output.
If I think total optimization ( not train system locally ), LESS crossings and intersections are possible and I do already. But NOT use may be imppossible. Could you build such factories (in vanilla)?

And 2 station system may works OK in vanilla but not good in Bobs's or some complecated mods (i.e. high module bonus, high inseter stack size,etc ) .

Post Reply

Return to “Gameplay Help”

Who is online

Users browsing this forum: TheoMarque