Page 1 of 1

GUI update (Help me, Please)

Posted: Thu May 01, 2025 6:05 pm
by yaim904
Context
Some time ago I created my version of Star whit items, but I couldn't get the GUI to look like the Vanilla GUI.

Now that I'm updating it, I'm in the same place, I don't know what styles to use and in what sequence to use; I also didn't find updated guides on the subject.

I tried to check the GUI with Ctrl + F5 and Ctrl + F6 but I don't understand anything. It's a lot of Flow and I always seem to be missing some detail.

Below is the GUI I made some time ago.
4.png
4.png (18.28 KiB) Viewed 756 times
5.png
5.png (39.74 KiB) Viewed 756 times
6.png
6.png (19.58 KiB) Viewed 756 times
7.png
7.png (19.66 KiB) Viewed 756 times

What I want from the GUI
I want it to look like the infinite chest, with a blank space always at the end (to add the next item).
12.png
12.png (55.68 KiB) Viewed 756 times


When I want to add a new object, the list of objects (like the one in the requirement chests) will be displayed.
13.png
13.png (203.58 KiB) Viewed 756 times

I need help with the GUI, I code the logic.
Help me, Please

Re: [2.0.43] GUI update (Help me, Please)

Posted: Sat May 03, 2025 12:34 am
by yaim904
I have created a Frame as the main container
But I don't know how to add the buttons in the title bar.
In the images you can see that there are two children
How can I select a children from an element?

Code: Select all

---------------------------------------------------------------------------------------------------
---> control.lua <---
---------------------------------------------------------------------------------------------------

script.on_event(defines.events.on_player_created, function(event)
    local player = game.get_player(event.player_index)
    local screen_element = player.gui.screen
    local main_frame = screen_element.add({
        type    = "frame",
        name    = "main_frame",
        style   = "frame_without_left_side",
        caption = "Hello world"
    })
    main_frame.style.size = { 484, 632 }
    main_frame.auto_center = true

    -- main_frame.children[1].add({
    --     type = "button",
    --     style = "close_button"
    -- })
end)
Captura de pantalla (357).png
Captura de pantalla (357).png (5.01 KiB) Viewed 708 times
Captura de pantalla (358).png
Captura de pantalla (358).png (5.1 KiB) Viewed 708 times
Captura de pantalla (359).png
Captura de pantalla (359).png (50.91 KiB) Viewed 708 times
Captura de pantalla (360).png
Captura de pantalla (360).png (70.2 KiB) Viewed 708 times

Re: GUI update (Help me, Please)

Posted: Sun May 11, 2025 3:31 pm
by yaim904
Now I have another question

Before I used to use this line to close the menu when using Esc, E or opening another menu; but now it is not working.

Code: Select all

player.opened = main_frame
Can you tell me
What I am doing wrong?
The following code is functional

Code: Select all

---> control.lua <---
script.on_event(defines.events.on_player_created, function(event)
    local player           = game.get_player(event.player_index)
    local screen_element   = player.gui.screen
    local main_frame       = screen_element.add({
        type    = "frame",
        name    = "main_frame",
        style   = "frame_without_left_side",
        caption = "Hello world"
    })
    main_frame.style.size  = { 484, 632 }
    main_frame.auto_center = true
    player.opened          = main_frame
end)
I am still waiting for the answer to the previous post.

Re: GUI update (Help me, Please)

Posted: Sun May 11, 2025 8:55 pm
by eugenekay
For Vanilla-like styling, take a look at the Source Code for GUI Unifyer - particularly the files prototypes/frame_style.lua and button_style.lua.

Good Luck!

Re: GUI update (Help me, Please)

Posted: Tue May 13, 2025 1:42 am
by yaim904
eugenekay wrote: Sun May 11, 2025 8:55 pm
This may help me, thank you very much.

Re: GUI update (Help me, Please)

Posted: Mon May 19, 2025 11:55 pm
by yaim904
I have advanced in the GUI.
I found no way to access the flows mentioned in the post.
yaim904 wrote: Sat May 03, 2025 12:34 am

The GUI is as follows:
Captura de pantalla (409).png
Captura de pantalla (409).png (33.17 KiB) Viewed 461 times
What code should i use to copy the selected text into the image?
Captura de pantalla (410).png
Captura de pantalla (410).png (16.92 KiB) Viewed 461 times

This is the closest thing i found about copying text.
unhott wrote: Sat Feb 02, 2019 3:11 am