Page 1 of 1

lua scenario restart button on error

Posted: Sun Jul 14, 2019 10:19 am
by dog80
hi so what i regularly encounter is that i do some lua scenario coding and testing ingame directly, and i will make errors which results in having to press "ok"(green-button) on error confirmation, then i end up in the main-menu .... i press "play" - "scenarios" - ... i select my scenario... - "create" etc... u see its annoying...

why not add a restart button to the error confirmation, so that while this confirmation is opened and the game is paused before exit, i can fix the issue in the code, then press restart and it will load the new files with the same map gen settings etc., ...

this is the same as if i attended to fix the issue but then end up in getting an error message in the card-generator tab, there i can just then press again on the green "create" button when i have fixed the code and it will either spit out another error message or work and start the game.

idk i would like this^^

Re: lua scenario restart button on error

Posted: Sun Jul 14, 2019 10:20 am
by Klonan
I would like this too :D

Re: lua scenario restart button on error

Posted: Mon Jul 15, 2019 6:59 pm
by WIZ4
That would be great! Devs please!

Re: lua scenario restart button on error

Posted: Mon Jul 15, 2019 7:56 pm
by eradicator
Would also be nice for non-scenario related modding. When i do testing i go through a lot of "error -> ok -> load game -> load" loops. If there was an button to just load the latest savegame again in the error dialogue that would be great. (And possible even useful to non-modders.)

Re: lua scenario restart button on error

Posted: Mon Jul 15, 2019 9:58 pm
by slippycheeze
eradicator wrote: Mon Jul 15, 2019 7:56 pm Would also be nice for non-scenario related modding. When i do testing i go through a lot of "error -> ok -> load game -> load" loops. If there was an button to just load the latest savegame again in the error dialogue that would be great. (And possible even useful to non-modders.)
You may, in that context (and possible in scenarios, where I don't know the structure enough to comment), benefit from using some pcall wrappers during development. That isn't as good as the game doing it smartly, but it does let you manually catch any error that happens inside the lua call and respond before it bubbles far enough up to kill the game. YMMV on the state of the save afterwards, of course.