godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.11k stars 69 forks source link

Implement "trigger bbcodes" in RichTextLabel #9138

Open IntangibleMatter opened 6 months ago

IntangibleMatter commented 6 months ago

Describe the project you are working on

Several games with large amounts of dialogue and cutscenes

Describe the problem or limitation you are having in your project

Frequently, things need to be triggered in the middle of dialogue. While there are ways to do this as it stands, none of them are particularly clean, nor are they generally nice to use.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

In RichTextLabels, a new BBCode could be implemented, the [signal] bbcode. This BBcode would have a single argument, which would contain the contents of the signal in String format. When text is being displayed in a RichTextLabel, and a [signal] is reached, the RichTextLabel would then emit a signal with the data of the bbcode.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Say that a RichTextLabel has the following text:

Hey, I need to talk to you about something.[signal="charanim;scared"]
Are you free to talk right now?

When the text is then being displayed, once the [signal] code is reached, the RichTextLabel would then emit a signal (i.e. bbcode_signal_hit) with the string given to the bbcode, this could then be handled and used wherever it needs to be.

If this enhancement will not be used often, can it be worked around with a few lines of script?

While there are ways that this can be implemented with Scripts, they frequently are unwieldy and prone to breakage.

Is there a reason why this should be core and not an add-on in the asset library?

This enhancement would greatly increase the ease of creating Tutorials, Dialogue, and many other things.

dalexeev commented 6 months ago

See:

KoBeWi commented 6 months ago

This is possible with RichTextEffect.