Page 1 of 1

Reset Schedule

Posted: Fri May 19, 2017 11:31 pm
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

Re: Reset Schedule

Posted: Sat May 20, 2017 1:51 am
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.

Re: Reset Schedule

Posted: Sun May 21, 2017 5:12 am
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 :)