Reset Schedule

Place to get help with not working mods / modding interface.
Hermios
Long Handed Inserter
Long Handed Inserter
Posts: 80
Joined: Sat Aug 13, 2016 2:57 pm
Contact:

Reset Schedule

Post by Hermios »

Hi
My question may sound stupid but... How do you reset a schedule (empty the list?)
I tried train.schedule=nil-> Crash (Very strange, because the schedule is actually nil when I reset my schedule manually)
train.schedule.current=0-> Ignored (If I retest just after, player. print(train.schedule.current) return 1!
train.schedule.records={}->Ignored
And sometimes, the issue with the index of Current which is not correct.
Help on that, please, as this is very frustrating

Thanks

Hermios
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Reset Schedule

Post by Nexela »

When getting a crash or even a script crash it helps to post the log :)

It looks like the changes to schedule.current might have made it so you can't nil out the train record (if this was possible before the changes).

@rseding will know the answer

/c game.player.selected.train.schedule = nil --errors expects table
/c game.player.selected.train.schedule = {} --errors current is not a valid schedule index
/c game.player.selected.train.schedule = {current = 1, records={{station=""}}} --is valid but It is looking for an empty station so not what you want.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16018
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Reset Schedule

Post by Rseding91 »

I've changed it for the next version of 0.15 so writing nil or {} clears the schedule.

{} not working was actually a bug in how "current" was checked to be valid :)
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding help”