How to change the value of a variable?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
swang
Posts: 19
Joined: Sat May 13, 2023 10:28 pm

How to change the value of a variable?

Post by swang »

I want to change the value of a variable in a sequence. But it doesn't run.

![image](https://github.com/kaYeonTan/Sort/asset ... 825dd271f0)
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change the value of a variable?

Post by Tony Li »

Hi,

Are there any errors or warnings in the Console window?

Alternatively, try changing the variable value in the Script field instead:

Code: Select all

Variable["CharacterProfileSprite"] = false
swang
Posts: 19
Joined: Sat May 13, 2023 10:28 pm

Re: How to change the value of a variable?

Post by swang »

I tried that way, but it didn't work.

The initial value set at the beginning is still applied.

![스크린샷 2023-05-31 203437](https://github.com/kaYeonTan/Sort/asset ... cf4c5d2ac0)
![스크린샷 2023-05-31 203424](https://github.com/kaYeonTan/Sort/asset ... 980e917d01)
![스크린샷 2023-05-31 203539](https://github.com/kaYeonTan/Sort/asset ... 285055ead9)
![스크린샷 2023-05-31 203604](https://github.com/kaYeonTan/Sort/asset ... 5a64d6af74)
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change the value of a variable?

Post by Tony Li »

Hi,

Code: Select all

db.GetVariable("CharacterProfileSprite").InitialBoolValue
will return the initial value, not the current value. To get the current value, use:

Code: Select all

isSprite = DialogueLua.GetVariable("CharacterProfileSprite").asBool;
swang
Posts: 19
Joined: Sat May 13, 2023 10:28 pm

Re: How to change the value of a variable?

Post by swang »

Thank you very much!!
User avatar
Tony Li
Posts: 22149
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to change the value of a variable?

Post by Tony Li »

Glad to help!
Post Reply