Can someone suggest how to write a script or dialog writer?

I am an experienced C# / SQL Server developer, and I use Python for my 3D hobby. I recently looked at a few writing generators and there prices for a hobbyist is more than I am willing to spend. Are there any opensource script generators? I saw one that required a ChatGPT license, and I can’t even sign up for them without a cell phone.

Just curious if there are guides on how to do this.

Thanks