Page 1 of 1

How to change the value of a variable?

Posted: Tue May 30, 2023 1:09 am
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)

Re: How to change the value of a variable?

Posted: Tue May 30, 2023 8:35 am
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

Re: How to change the value of a variable?

Posted: Wed May 31, 2023 7:37 am
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)

Re: How to change the value of a variable?

Posted: Wed May 31, 2023 7:48 am
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;

Re: How to change the value of a variable?

Posted: Wed May 31, 2023 8:40 pm
by swang
Thank you very much!!

Re: How to change the value of a variable?

Posted: Wed May 31, 2023 9:37 pm
by Tony Li
Glad to help!