Page 1 of 1

[Rseding91] Error when trying to open GUI by defines.gui_type

Posted: Fri Oct 25, 2024 8:28 am
by Pi-C
According to LuaControl::opened, defines.gui_type is an allowed type for writing. In Factorio 1.1, we could use

Code: Select all

/c game.player.opened = defines.gui_type.controller
to open the player/character GUI, or

Code: Select all

/c game.player.opened = defines.gui_type.blueprint_library
to open – you've guessed it! – the blueprint library.

In the latest version, setting LuaControl::opened to defines.gui_type.none will close any opened GUI correctly, but setting it to any other type will result in an error like this:

Code: Select all

Cannot execute command. Error: Invalid type: 3
I know that it doesn't make sense to use all types in defines.gui_type with LuaControl::opened, but it definitely does make sense for the following:
  • achievement
  • blueprint_library
  • bonus
  • controller
  • global_electric_network
  • logistic
  • production
  • trains
  • none
As a matter of fact, it makes sense for all of the GUIs that can be opened with one of the buttons above the minimap, which includes tutorials and the Factoriopedia. Unfortunately defines.gui_type.tutorials has been removed, and defines.gui_type.factoriopedia doesn't exist.

Please fix this so that setting LuaControl::opened to a numeric value defined in defines.gui_type will open the corresponding GUI – and I'd be extremely happy if you added 'tutorials' and 'factoriopedia' to defines.gui_type! :mrgreen:

Re: Error when trying to open GUI by defines.gui_type

Posted: Fri Oct 25, 2024 11:59 am
by Rseding91
Thanks for the report. I'm unsure why some of those were removed. As for the controller one, you can work around it by writing player.opened = player.

I'll look into the others and see if there's some underlying reason why they aren't there anymore.

Re: [Rseding91] Error when trying to open GUI by defines.gui_type

Posted: Fri Oct 25, 2024 3:03 pm
by Pi-C
Thank you very much! :-)