Inverse Lua bool via trigger

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
domopuff
Posts: 25
Joined: Fri May 13, 2022 2:26 am

Inverse Lua bool via trigger

Post 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?
domopuff
Posts: 25
Joined: Fri May 13, 2022 2:26 am

Re: Inverse Lua bool via trigger

Post by domopuff »

Alright, I went ahead with TriggerEnter and TriggerExit to Fade in and Fade Out the audio respectively instead!

Thank you.
User avatar
Tony Li
Posts: 22145
Joined: Thu Jul 18, 2013 1:27 pm

Re: Inverse Lua bool via trigger

Post 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"]
domopuff
Posts: 25
Joined: Fri May 13, 2022 2:26 am

Re: Inverse Lua bool via trigger

Post by domopuff »

Thanks for this Tony!
Post Reply