I want to edit TrainSchedule easily

Post all other topics which do not belong to any other category.
Post Reply
spiral_power
Burner Inserter
Burner Inserter
Posts: 9
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 431 times

spiral_power
Burner Inserter
Burner Inserter
Posts: 9
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: 4050
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: 292
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.

Post Reply

Return to “General discussion”

Who is online

Users browsing this forum: -Axiom-