Make a character function that replaces certain key words with the characters value when a string is passed through it.
Then just make it find and replace:
std::replace(msg.begin(), msg.end(), '[name]', util:ucfirst(this->real_name));
then in quest.cpp before the text is added to the dialog packet run the code through the character function so it replaces dynamic values