Page 1 of 1

Inverse Lua bool via trigger

Posted: Fri Jul 01, 2022 12:01 am
by domopuff
Hi, just a quick question.

I'm trying to do a multidirectional trigger for fading in and out audio and I am trying to get the Dialogue System Trigger to invert a boolean variable via Lua.

I've tried these methods in the run Lua code section but all of them don't seem to change the boolean:

Code: Select all

Variable["Astromall.DowntownBGM"] ~= Variable["Astromall.DowntownBGM"]

Code: Select all

Variable["Astromall.DowntownBGM"] = ~Variable["Astromall.DowntownBGM"]
I was wondering if there is another way for such a method to work?

Re: Inverse Lua bool via trigger

Posted: Fri Jul 01, 2022 12:14 am
by domopuff
Alright, I went ahead with TriggerEnter and TriggerExit to Fade in and Fade Out the audio respectively instead!

Thank you.

Re: Inverse Lua bool via trigger

Posted: Fri Jul 01, 2022 9:18 am
by Tony Li
Hi,

Should you need to invert another bool in the future, you can use the "not" keyword:

Code: Select all

Variable["Astromall.DowntownBGM"] = not Variable["Astromall.DowntownBGM"]

Re: Inverse Lua bool via trigger

Posted: Sat Jul 02, 2022 6:42 am
by domopuff
Thanks for this Tony!