Replacing Text dynamically

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Replacing Text dynamically

Post by nathanj »

Hi Tony ,

I'm drawing a complete blank at the moment.

I would like to make certain names in my dialogue to be replaced dynamically. Say for example,

"Hi, go and gather some berries from {Location}".

I know I've done this before, I just can't remember how to do it. If you could just point me in the direction, no need to explain,

Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Replacing Text dynamically

Post by Tony Li »

Hi Nathan,

One way is to set a variable. Example C# code:

Code: Select all

DialogueLua.SetVariable("Location", "Tahiti");
Then use [var=variable] in the Dialogue Text:
  • Dialogue Text: "Hi, go an gather some berries from [var=Location]."
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: Replacing Text dynamically

Post by nathanj »

Ah, that's it.

Thanks!
Nathan
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Replacing Text dynamically

Post by Tony Li »

Glad to help!
Post Reply