DaveTheCoder That said, I think I got this one! I'll post my work just in case anyone else stumbles across this specific issue!
So, for context I have two relevant nodes. An Enemy with the enemy script attached, and a child node RichTextLabel with the script named "NewRegFunc"
The code for the Enemy is as follows, utilizing a form of the Call function
using Godot;
using System;
public partial class Enemy : Sprite2D
{
RichTextLabel prompt;
[Export]
public String prompt_text;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
prompt = this.GetNode<RichTextLabel>("RichTextLabel");
//This is the money maker! Needs to be cast exactly like this to work. If yours isn't working, check the GetNode() directory path is correct!
prompt_text = (string)GetNode("RichTextLabel").Call("CleanString", prompt.Text);
//Test just to make sure it prints correctly
GD.Print(prompt_text);
}
}
And for my "RichTextLabel" extension we have....
class_name NewRegFunc
extends RichTextLabel
func CleanString(rawBBCodeText: String)-> String:
var regex = RegEx.new()
regex.compile("\\[.*?\\]")
var text_without_tags = regex.sub(rawBBCodeText, "", true)
return text_without_tags
# `text_without_tags` contains the text with all BBCode tags removed.
And there you have it! A C# script that calls a GD script to remove the BBCode from a string and passes back to your C# script to use as you please! I hope someone else finds this useful, and thanks again Dave for your response!