Utilization Monitor Blargh


Displays the utilization percentage of factories, miners, labs, furnaces, boilers, generators, and reactors.

a month ago
0.18 - 2.0
9.20K
Logistics

b Crash on disable mod

3 years ago
(updated 3 years ago)

Pressed the toggle for enable/disable mod (same thing happens on toggle labels as well). Factorio v1.11.19; Nullius v1.0.4 + several quality of life mods, including Programmable Speaker Alerts List 2. However, I have no alerts or even speakers (started a completel new game). Looks like a compatibility issue, but not sure on which side.

The mod Utilization Monitor (Blargh) (0.8.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event UtilizationMonitorBlargh::toggle-utilization-monitor (ID 241)
The mod Programmable Speaker Alerts List 2 (1.0.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event AlertsList2::on_runtime_mod_setting_changed (ID 59)
__AlertsList2__/control.lua:265: bad argument #3 of 3 to '__index' (string expected, got nil)
stack traceback:
    [C]: in function '__index'
    __AlertsList2__/control.lua:265: in function <__AlertsList2__/control.lua:264>
stack traceback:
    [C]: in function '__newindex'
    __UtilizationMonitorBlargh__/control.lua:607: in function <__UtilizationMonitorBlargh__/control.lua:606>
3 years ago

With Speaker Alerts disabled, I still get the same crash, just with another mod mentioned in it:

The mod Utilization Monitor (Blargh) (0.8.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event UtilizationMonitorBlargh::toggle-utilization-monitor (ID 241)
The mod Time Lapse Base Edition (1.3.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event TLBE::on_runtime_mod_setting_changed (ID 59)
__TLBE__/scripts/config.lua:8: bad argument #3 of 3 to '__index' (string expected, got nil)
stack traceback:
    [C]: in function '__index'
    __TLBE__/scripts/config.lua:8: in function <__TLBE__/scripts/config.lua:7>
stack traceback:
    [C]: in function '__newindex'
    __UtilizationMonitorBlargh__/control.lua:607: in function <__UtilizationMonitorBlargh__/control.lua:606>
3 years ago

Ooooooookay, that's a bit odd :)

Let me grab those two mods and take a look.

3 years ago

Nullius might have something to do with it as well, since it's a total overhaul that substitutes every vanilla item, recipe and tech with its own.

3 years ago

So, the root problem is actually in both of those scripts - they assume player_index is defined in the on_runtime_mod_setting_changed event (and they're watching EVERY setting change, instead of filtering to their own...). However, https://lua-api.factorio.com/latest/events.html#on_runtime_mod_setting_changed explicitly says this isn't true in the case of a script changing a setting (which UMB is doing - it's trying to update the mod setting tick box to match what you're toggling).

AlertList2 has the problem starting at line 264:

script.on_event(defines.events.on_runtime_mod_setting_changed, function(e)
    local player = game.players[e.player_index]
    reload_settings(player)
end)

And TLBE has it in scripts/config.lua:

function Config.reload(event)
    local player = game.players[event.player_index]
3 years ago

One of the updates done in 0.8.4 was to fix this disconnect between the toggles in the settings and active state as driven by the keyboard shortcuts. I'm still pondering and poking, seeing if there's a way to work around it, but it's probably worth raising the issue on those other two mods, as UMB isn't the only mod that does game setting changes via script.

3 years ago

Press the shortcut key“ctrl+U” to report an error

3 years ago

hm I see... I didn't read the API documentation carefully enough.
I'll fix TLBE and make a quick release to fix this issue.

Thanks for spending the time investigating this!

3 years ago

No worries!

New response