Ive got a question regarding texts. Basically I want to do randomized quest and it would save me alot of work if could insert texts that is stored in variables into a text.
Basically, what I mean by this is, if we assume this is the text:
"Hi, Ive lost my weapon at the grand canyon. Can you retrieve it for me?"
And I would like it to be like
"Hi, Ive lost my (Variable) at the grand canyon. Can you retrieve it for me?"
This way, if I want to change the object he lost, I can simply change the text in the variable and dont need to change the entire text. So I can put for example Knife or Sword into the variable. Is that possible?
For one of my projects, I made my own function called 'String with Keywords of Color,' which had three parameters, the main string, the key words (any amount, separated by spaces), and color. It colored all of the specified key words in the main strings to the input color. It was really easy and time efficient to do it that way, because I never needed to worry about all the 'combine strings.' I simply put the string, and then the key words.
You could make a similar function that replaces a placeholder substring in a main string. It would look roughly like:
mainstring (parent): "Hi, Ive lost my #lostitem at the grand canyon. Can you retrieve it for me?" replace strings: "#lostitem;weapon"
For one of my projects, I made my own function called 'String with Keywords of Color,' which had three parameters, the main string, the key words (any amount, separated by spaces), and color. It colored all of the specified key words in the main strings to the input color. It was really easy and time efficient to do it that way, because I never needed to worry about all the 'combine strings.' I simply put the string, and then the key words.
You could make a similar function that replaces a placeholder substring in a main string. It would look roughly like:
mainstring (parent): "Hi, Ive lost my #lostitem at the grand canyon. Can you retrieve it for me?" replace strings: "#lostitem;weapon"
Just saying.
Im interested in doing it this way, but Im not quite sure how to pull it off. Do have a test map or something? That would help alot.
Edit: Nevermind I think I figured it out. Thanks so much, that is very helpfull.
Well, you'd have to compare it to using the 'Combine Strings (multiple)' function. I don't think anyone would openly recommend 'Combine Strings' for combining more than two.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi,
Ive got a question regarding texts. Basically I want to do randomized quest and it would save me alot of work if could insert texts that is stored in variables into a text.
Basically, what I mean by this is, if we assume this is the text:
"Hi, Ive lost my weapon at the grand canyon. Can you retrieve it for me?"
And I would like it to be like
"Hi, Ive lost my (Variable) at the grand canyon. Can you retrieve it for me?"
This way, if I want to change the object he lost, I can simply change the text in the variable and dont need to change the entire text. So I can put for example Knife or Sword into the variable. Is that possible?
Any help would be greatly appreciated!
@Crainy: Go
You can literally do exactly what you are saying you want to do. You might have to mess with a bunch of combine texts though.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@Crainy: Go
Just do Combine Text or Combine Text Multiple, with one of the values being Convert _ To Text, with _ being whatever type your variable is.
@Crainy: Go
For one of my projects, I made my own function called 'String with Keywords of Color,' which had three parameters, the main string, the key words (any amount, separated by spaces), and color. It colored all of the specified key words in the main strings to the input color. It was really easy and time efficient to do it that way, because I never needed to worry about all the 'combine strings.' I simply put the string, and then the key words.
You could make a similar function that replaces a placeholder substring in a main string. It would look roughly like:
mainstring (parent): "Hi, Ive lost my #lostitem at the grand canyon. Can you retrieve it for me?" replace strings: "#lostitem;weapon"
Just saying.
Thanks for all the replies so far.
Im interested in doing it this way, but Im not quite sure how to pull it off. Do have a test map or something? That would help alot.
Edit: Nevermind I think I figured it out. Thanks so much, that is very helpfull.
Personally, I prefer using the expression tab instead of a bunch of combine functions. Seems less complicated.
@MaskedImposter: Go
Well, you'd have to compare it to using the 'Combine Strings (multiple)' function. I don't think anyone would openly recommend 'Combine Strings' for combining more than two.