How to customize the tooltip or use the default??

Place to get help with not working mods / modding interface.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

How to customize the tooltip or use the default??

Post by yaim904 »

I want to use the default tooltips for technologies and recipes; and how to create a similar one or modify them.
Captura de pantalla 2022-03-21 145947.png
Captura de pantalla 2022-03-21 145947.png (38.23 KiB) Viewed 1080 times


I saw that FNEI does it, but I don't understand how it does it.

I don't understand why it is programmed in OOP, it doesn't have a clear flow or comments.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: How to customize the tooltip or use the default??

Post by yaim904 »

After staring at the code for two hours, I understood the part I was looking for.

What I want is part of the normal operation of the "choose-elem-button", in other words, what I wanted was to learn how to use the "choose-elem-button" and I already learned, at least a part.

I still don't know how to add more text to the Tooltip without affecting the default one (choose-elem-button).

For example, I don't know how to add the information of the Tooltip variable to the information that it will have by default in the following code. I emphasize, add, not replace.

Code: Select all

local function CreateButton( Data )

    -- Identificar la tecnología
    Data.Technology = getTechnology( Data.Technology )

    -- Paramatros de selección
    local Tags = { }
    Tags.Size = 64
    Tags.Location = Data.Location or Data.Flow.name
    Tags.MOD = Data.GMOD.Prefix_MOD
    Tags.Enabled = "omitted_technology_slot"
    Tags.Disabled = "image_tab_selected_slot"
    Tags.Technology = Data.Technology.name

    -- Seleccionar las posibles acciones
    local List = { }
    if Tags.Location == Data.GUI.QueueFlow.name then
        List = { "show", "prioritize", "remove" }
    elseif Tags.Location == Data.GUI.UnresearchedTechnologyTable.name then
        List = { "show", "add" }
    end

    -- Agregar posibles acciones
    local Tooltip = { }
    for _, Local in pairs( List ) do
        table.insert( Tooltip, "\n" )
        table.insert( Tooltip, { Data.GMOD.Local .. Local } )
    end

    local Picture = { }
    Picture.tags = Tags
    Picture.type = "choose-elem-button"
    Picture.elem_type = "technology"
    Picture = Data.Flow.add( Picture )
    Picture.locked = true
    Picture.style = Tags.Enabled
    Picture.style.size = Tags.Size
    Picture.elem_value = Data.Technology.name
    Picture.style.margin = 0
    Picture.style.padding = 0
end
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
Post Reply

Return to “Modding help”