0 votes

Hi all,

I've been playing around with the RichTextLabel, specifically with the BBCode functionality. I've read that you can define your own custom BBCodes here: https://docs.godotengine.org/en/3.2/tutorials/gui/bbcode_in_richtextlabel.html?#custom-bbcode-tags-and-text-effects

There are a couple of examples provided, but there doesn't seem to be any info on how to actually use custom BBCodes in one's GoDot project. Being new to GoDot, I naively tried pasting the example code into a script called 'ghost.gd' and using the [ghost] BBCode in the RichTextLabel. However, unlike the other built-in BBCodes, writing something like "[ghost]test[/ghost]" gets rendered as-is, i.e. the code is not recognised, parsed and removed from the output. Is there some step that I am missing? Any help would be much appreciated.

P.S. My original aim was to get superscript/subscript text. Would still be good to know how to use custom bbcodes (can see this being super useful for all sorts of reasons), but if there is a quicker way to get superscript/subscript working that'd also be great to know.

asked May 3 in Engine by sjbcastro (15 points)

1 Answer

+1 vote
Best answer

You have to create a resource (i.e. a file ending ".tres") to which the script Ghost.gd is attached to. Then you can this resource in the Inspector of the RichTextLabel under "Custom Effects". This video shows you how to do it.

answered May 3 by njamster (9,948 points)
selected May 3 by sjbcastro

Thanks for the fast reply, will give it a try :)

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 How to use this Q&A? before posting your first questions.