Schall Railway Controller


Assist train organizations and dispatches. Adds a GUI listing idling and stalled trains (or other customizable filters). Displays train status, for easy and quick schedule inspection and assignment. (Locale: English, Deutsch, 正體中文, 简体中文, Português Brasileiro)

Utilities
a month ago
0.17 - 2.0
4.86K
Trains

i [Solved] wishlist: make "railwaycon-gui-refresh-interval" a runtime-global or runtime-per-user setting

4 years ago

G'day. Right now the GUI refresh interval is set as a startup setting, so I can't change it without fully restarting Factorio. It seems like it could be changed on the fly without causing trouble, so it'd be nice if that happened. (Of course, I assume there is something that makes it hard to do that, but that I'm not seeing, so... if it is hard, I understand.)

4 years ago

Right, when I did my first script of automatic update, I also thought that it was supposed to use runtime-global or runtime-per-user.
By then writing the Lua code for that, I realized that it is using the script.on_nth_tick register, which is registered on game start/load only.
If it is under runtime-global or runtime-per-user, then I am not sure how the game behaves when it is changed during a game... Maybe the new interval setting will not take actual effect, until the user exit and reload the save?

So for game "safety" reasons, I am hesitant to change that, at least until I figure out how it works out.

4 years ago

Fair enough! I asked on discord, and didn't get a clear answer. So I guess I'll try and not experiment too much. :)

Thanks!

4 years ago
(updated 4 years ago)

Update: you can add or remove a handler any time using LuaBootstrap::on_nth_tick, so you need to check the runtime setting when that is available, and handle the "settings changed" event, but you can just .on_nth_tick(nil) ; .on_nth_tick(setting_value, handler) at any time and it'll do the right thing.

but that isn't trivial, and I don't need to change frequency much, so ... unless you feel real enthused, consider this closed off, I guess? :)

4 years ago

Great info. I will do some experiment with that.
If it goes smooth, actually this will be the simplest among your wishlist. :-D

4 years ago

Implemented in recent release 0.17.1 / 0.18.1.
It is now under runtime-global, as in Map settings.

PS: And yeah, it is actually the simplest one to implement among your wishlist.

New response