The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hello.
So, as you probably know, you can enable Bbcode on a RichTextLabel.
Some examples of that are [b] [i] etc.
The thing is, I want to make a custom one, to be a preset of some of there, and maybe some changes. [b] + [i] + a custom effect.

I dont want to have to add all the tags each time that I want to use that, but a custom one that applies all those effects. For example
[customone] The text [/customone]
being the same as
[b][i][another] The text [/b][/i][/another]

I find it even more important when you are passing parameters.

Is that possible?

Godot version 4.0 stable mono
in Engine by (19 points)

1 Answer

0 votes

You can create custom effects as noted in the docs: https://docs.godotengine.org/en/stable/tutorials/ui/bbcode_in_richtextlabel.html#custom-bbcode-tags-and-text-effects

Note the example [matrix]text[/matrix], backed by a method to implement the effect. I figure you can have a [customtag]text[/customtag] that implements your defaults.

Good luck!

by (1,406 points)

Yes. I know about custom effects thanks. The problem is having a collection of those elements being called at the same time by just one tag.

I created a new proposal for it: https://github.com/godotengine/godot-proposals/issues/6560

I see, that’s cool and was my other suggestion. In a current project, there’s a custom resource that inherits from the rich text node with appropriate text fields. This references a constant class with the tag definitions in another resource; essentially what you’re proposing be built into the engine.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.