How do I open a GUI with the radar?

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 do I open a GUI with the radar?

Post by yaim904 »

I have a GUI that I want to open with the Radars.
When I try to open the radar GUI, the on_gui_opened event is not triggered.

Code: Select all

script.on_event({
    defines.events.on_gui_opened
}, function(event)
    game.players[event.player_index].print("Event: Actived")
end)
What am I doing wrong?
How do I fix it?
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
Osmo
Fast Inserter
Fast Inserter
Posts: 108
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: How do I open a GUI with the radar?

Post by Osmo »

You are wrapping defines.events.xxx in parentheses, thus providing a table when the on_event function expects a defines.events number or a string of the same name. Remove the {} and it should work. (assuming radars even have gui, i don't remember if they do with energy sources other than burner)
Natha
Filter Inserter
Filter Inserter
Posts: 276
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: How do I open a GUI with the radar?

Post by Natha »

Osmo wrote: Tue Jul 29, 2025 9:57 am You are wrapping defines.events.xxx in parentheses, thus providing a table when the on_event function expects a defines.events number or a string of the same name. Remove the {} and it should work. (assuming radars even have gui, i don't remember if they do with energy sources other than burner)
A table is totally fine
For me, the radar doesnt have a GUI.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: How do I open a GUI with the radar?

Post by yaim904 »

Osmo wrote: Tue Jul 29, 2025 9:57 am
Natha wrote: Tue Jul 29, 2025 2:14 pm

What you mean is...
It only works if the entity prototype has a GUI?

I can only find two entities that meet the requirements I'm looking for (Radar and Roboport):
1. The animation is infinite from the moment it is created (without player intervention).
2. It allows red and green cables to be connected.
3. It consumes energy.

If you are right:
4. It must have a GUI.
And that would rule out Radar.

If you know of another type of entity that meets the requirements, please let me know.
Solo entiendo español, pero si tu también lo entiendes, escríbeme
:D
Everything i write in English is translated by Deepl.
:D
Osmo
Fast Inserter
Fast Inserter
Posts: 108
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: How do I open a GUI with the radar?

Post by Osmo »

yaim904 wrote: Tue Jul 29, 2025 7:25 pm 1. The animation is infinite from the moment it is created (without player intervention).
Actually, any entity can have that, its called a stateless visualisation, an animation that plays regardless of the state of the entity or the game. Creating a continuos looping animation is easy.
Note however that this means it plays regardless of whether the machine is powered or not.

So the requirements are:
1. Consumes energy
2. Allows circuit wire connections
3. Has a GUI.

And that covers a lot of entities. One of the simpler examples is a Lamp.
User avatar
yaim904
Fast Inserter
Fast Inserter
Posts: 129
Joined: Wed Nov 17, 2021 11:26 pm
Contact:

Re: How do I open a GUI with the radar?

Post by yaim904 »

Osmo wrote: Tue Jul 29, 2025 9:38 pm
Thanks for the information, I didn't know that property worked that way.

I tried it and it keeps the animation going, but regardless of whether or not it has power.

I tried an electrical interface, but it doesn't have connections for the red and green cables.

The roboport continues to win.
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”