Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Volk |
So I’m working on a text based game. I was using Twine before, more specifically Sugarcube 2. Now there was a Template API that Sugarcube had that I was using for a lot of things (pronouns, adjectives, nouns, etc…).
So how it would work is you would write your text. For example, “You pet the ?pet.” Then you would create a template for “?pet” either in the form of a single item or an array of several. You could also have the template base its output on a variable. For example if “pet = 7”, it would print the eighth item from the array. Alternatively you could also just have it select one at random. So then “?pet” would be replaced with whatever you set the templates output to (dog, cat, giant fire breathing dragon, etc…)
I’ve been looking for something similar or at the very least a way to create a script to do the same thing, but I haven’t been having much luck so far. Searching for Godot, text, replace, and placeholder in Google hasn’t been getting me much in the way of actual answers and the closest I’ve come so far was Format Strings, which while close, doesn’t seem quite right for my purposes.
Any help with this would be greatly appreciated.
Also, apologies if this ends up being a duplicate. i think my previous question got sent to the void or something.