What is a node proxy

I’m trying to make a sign system for a game I’m working on that I want to function like the Pokémon games. I.e. you walk up to is and press a button and a gui pops up saying what the sign says.

This is the code that send the message to the .gui_script

function on_input(self, action_id, action)
	if action_id == hash("action") and action.pressed then
		if my_house_sign == 1 then
			msg.post("/signs#my_house_sign", "enable-my_house_sign")
		end
	end
end

This is the code that I thought should make the gui visible

function on_message(self, message_id, message, sender)
	if message_id == hash("enable-my_house_sign") then
		gui.set_enabled("box", "true")
	end
end

This is the .gui file

This is what the nodes look like when visible
image

this is the eror i get when i try this

ERROR:SCRIPT: assets/sign/sign.gui_script:11: bad argument #1 to 'set_visible' (NodeProxy expected, got string)

Both nodes are enabled but not visible

I’ve read through the gui manual but I just cant wrap my head around it.

If you need to know anything else just let me know.
Any help will be greatly appreciated. Thanks

NodeProxy is the type returned by gui.get_node() and is what you need to pass to most GUI functions:

function on_message(self, message_id, message, sender)
	if message_id == hash("enable-my_house_sign") then
        local box = gui.get_node("box")
		gui.set_enabled(box, "true")
	end
end
1 Like

Thank you its working now

I’m now trying to hide it again but it isn’t working.

this is the code

gui.set_visible(gui.get_node("box"), "false")

Any idea why thanks.

What is the error you’re getting?

"false" is a string, not a boolean.
Use gui.set_visible(gui.get_node("box"), false) instead

1 Like

thanks