Milestones

by Wiwiweb

Keep track of your progress in a fun way by finding out how fast you created key items. Look back on your factory's history, compare with your friends, or challenge yourself. Supports any list of items and comes with presets for popular big mods. Can be added to existing games.

Utilities
2 months ago
1.1
215K

g [Fixed] Crash with RPG

1 year, 8 months ago

With only this mod and RPG enabled in a new game, the game crashes sometimes when entering or exiting the main esc menu. I reported it to the RPG mod, too.

The mod Milestones (1.3.6) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Milestones::milestones_cancel_settings (ID 180)
LuaGuiElement API call when LuaGuiElement was invalid.
stack traceback:
[C]: in function 'index'
__Milestones
/scripts/gui_settings_page.lua:415: in function 'is_settings_page_visible'
Milestones/scripts/gui.lua:254: in function <Milestones/scripts/gui.lua:253>

1 year, 8 months ago

I can't reproduce. You're the second person to report this though. I'm trying with the RPGsystem mod version 1.3.2.
Could you send me a save file where this crash consistently happens? That would be very helpful, thanks.

1 year, 8 months ago
(updated 1 year, 8 months ago)

Oh, sorry. It doesn't happen with RPGsystem 1.3.2 (https://mods.factorio.com/mod/RPGsystem). It happens with RPG 1.0.14 (https://mods.factorio.com/mod/RPG). Different mods. Should just be able to open and close their top-left button. It happens in all my saves and any new game. I'll send a save file if this doesn't help.

1 year, 8 months ago

I switched to RPGsystem 1.3.2 because it seems to work fine with all my mods. The other one errors out with yours and 2 other mods, so I imagine it's their mod's fault.

1 year, 8 months ago

Aha, thanks for the easy reproduction case, I managed to fix this.
The RPG mod is one of those mods that deletes GUIs from other mods. I thought I had this handled in 1.3.0 by recreating it when needed, but I had a bug in the code that handled that.

Cheers!

1 year, 8 months ago
(updated 1 year, 8 months ago)

The RPG mod is one of those mods that deletes GUIs from other mods.

I would love to hear how others solve this issue.

Currently, mods don't solve this at all.
Viewing your code - you have nothing in your code to handle if a player clicks anything else that is not "milestone"-labeled.

Now, this might not be a problem, you would probably think. But the issue arises whenever a gui is left in the middle of the screen (i.e unhandled) and the player clicks another top-gui button that draws another gui frame. Now - all of a sudden - we're left with multiple frames that clutters the screen.

Would you like other mods to:
- mark your visible guis as non visible?
- destroy the guis?

1 year, 8 months ago
(updated 1 year, 8 months ago)

When you open your GUI, set player.opened = <your_gui_main_frame>.
When you do this, Factorio will send a on_gui_closed event with the name of the GUI that was previously the opened one.
If you receive this event and the name matches your main frame, close your window.
As a bonus this also handles closing your window with E or escape (Which also cause Factorio to send a on_gui_closed event with your window name).

https://lua-api.factorio.com/latest/LuaControl.html#LuaControl.opened
https://lua-api.factorio.com/latest/events.html#on_gui_closed

New response