Setting Dialogues on runtime

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Setting Dialogues on runtime

Post by nishant »

Hi,
I have a dialogue that tells the user the current day . The day gets stored and updated along with day/night cycle . I wanted to know if its feasible to edit the dialogue text in runtime . So for day 1 its will say "Today is day 1 " , for day 2 it will say "Today is day 2 " and so on ...


Thanks.
Nishant
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting Dialogues on runtime

Post by Tony Li »

Hi Nishant,

Yes, it's very easy. Store the day in a Dialogue System variable. For example:

Code: Select all

using PixelCrushers.DialogueSystem;
...
DialogueLua.SetVariable("Day", timeOfDay.day);
Then use the [var=varName] markup tag in your Dialogue Text:
  • Dialogue Text: "Today is day [var=Day]."
You can also register your own Lua functions and use the [lua(...)] tag, or use the RandomElement() function to choose text randomly from a list.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Setting Dialogues on runtime

Post by nishant »

Cool that works... Thanks a lot
Post Reply