How to make a simple GUI
How to make a simple GUI
I have added a special entity. When the entity is clicked, I want to prompt the user with a simple prompt dialog to show a number associated with the entity and allow the user to change the number. How do I go about doing this? So just like the way to specify the number of items requested by a requester chest.
Re: How to make a simple GUI
Have you checked out: http://lua-api.factorio.com/latest/LuaGuiElement.html
- DedlySpyder
- Filter Inserter
- Posts: 253
- Joined: Fri Jun 20, 2014 11:42 am
- Contact:
Re: How to make a simple GUI
There still isn't any proper way to handle players clicking on an entity to fire an event (unless they changed recently). I think your best bet is to make a custom keyboard shortcut that checks the player's selected entity for your entity and handle the GUI from there. (although I believe some people use an on tick event to check constantly, I like to avoid on tick as much as possible)
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: How to make a simple GUI
Correct.DedlySpyder wrote:There still isn't any proper way to handle players clicking on an entity to fire an event (unless they changed recently). I think your best bet is to make a custom keyboard shortcut that checks the player's selected entity for your entity and handle the GUI from there. (although I believe some people use an on tick event to check constantly, I like to avoid on tick as much as possible)
Also, the .operable property of an entity can be set to false to prevent default entity GUI opening when its clicked: listen for built events, if it's your entity then set event.created_entity.operable = false
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.