Global variables?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
SealDev
Posts: 85
Joined: Thu Jun 24, 2021 5:45 am

Global variables?

Post by SealDev »

I have a currency int variable.
Can I have it across multiple databases?

I have a SendMessage that can increase the currency amount. (DialogueLua.GetVariable) What if I want to run a conversation from an extra database tho?

Can I still add a condition if currency is above certain amount?

Will DialogueLua.GetVariable still work? What if each database has a variable with the same name? How does it know which one to pick?
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Global variables?

Post by Tony Li »

Hi,

Variables should be unique across databases. If two databases define the same variable name, only one variable will be created at runtime.
SealDev
Posts: 85
Joined: Thu Jun 24, 2021 5:45 am

Re: Global variables?

Post by SealDev »

Should actors and conversation names also be unique across multiple databases?
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Global variables?

Post by Tony Li »

Yes. For more information about multiple databases, including how to keep IDs unique, please see:

Working With Multiple Databases
Post Reply