Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Will Nations | |
Old Version | Published before Godot 3 was released. |
Was wondering if anyone knew if it were possible to get functionality to trigger off of specific segments of a text block in the Godot UI somehow (a Control node).
Something like putting tags around text in a text field and then signals get triggered off of any text between those tags that you can then attach functions to.
# text field content having SOME means of defining a name for a segment
<a name="talk">TALK</a> to <a name="bob">Bob</a>.
# in script
func _on_talk_hover:
pass # display a tooltip explaining the "talk" action
func _on_talk_press:
pass # trigger behavior that moves the story forward
func _on_bob_hover:
pass # trigger another UI element to display information about Bob
I’d rather have a way of automatically generating these signals for any given segment of text rather than having to manually place an invisible button over very particular positions in a Control node (which I would have to readjust any time the text is changed). Perhaps this is better submitted as a simple feature request for the engine?
If nothing else, I could probably spend a couple of days writing a tool script that could generate all of this stuff from the editor by parsing the text content of an exported node, identifying segments, generating new signal connections passing in the name of the segments and generating invisible buttons with positions calculated somehow.
sigh