How do I pass an argument to call a class object?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mymokol

I am relatively new to godot and programming in general, so excuse my lack of knowledge.

Straight to the point:
I have a signal “mouse_over_child” with arguments name (string) and state (bool).
The signal is emitted from a child node whenever the mouse enters or leaves said child node.

In the root node’s script, I have created a class button with variables deployed (bool) and mouse_over (bool).

In the root node, I have a function _on_mouse_over_child(name, state) connected to the signal from the children of the root node. What it is supposed to do is take the object of the class button, whose name is the same as the argument “name,” and change its “deployed” to the argument “state.”

How do I do that without having to do case by case scenarios? Is there even a way?

I tried to look it up in the documentation, but didn’t find anything, because I didn’t know what to look for.

Please ask for details if you need any - though I can’t assure you I’ll be able to provide them

Thank you for taking your time to read this question of mine.

I’m a little confused. What do you mean by “take the object of the class button”? In general, I think most of us would need a better list of code in order to try to figure out how you want to do what you’re trying, plus more clarity around the desired functionality - we might have a different way to handle it altogether.

Kyle Szklenski | 2020-12-06 18:00