Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: YellowBirdAZ on February 10, 2018, 10:54:29 AM
-
Is there a way to set a global variable on launch that can be referenced (and changed) from any layout or plug-in?
So whatever you set it to (say true or false) would stay the same no matter where it was referenced from (layout, plug-in, screensaver, etc.). And likewise the value could conceivably be changed from any of these places.
-
Might this be what the fe.nv table is for?
-
Might this be what the fe.nv table is for?
Yes. However, be careful that you don’t mess with other params and loose them. There’s no real guideline. I opted for fe.nv.layout_plugin_module <- {} to keep things working nicely between devs.
Check out how I am using it:
https://github.com/keilmillerjr/mvscomplete/blob/master/layout.nut
Line 244
-
Thanks!
I copied yours. The only difference is I only need to store one boolean in there.
if (!fe.nv.rawin("jukebox")) fe.nv.rawset("jukebox", false);
In jukebox mode you get music from whatever era of games are displayed (80s, 90s, etc) and the audio for all videos is turned off (Vid.NoAudio).
In non-jukebox mode you get the opposite (no music, but audio for videos is re-enabled).
The Custom1 input toggles between the two modes.
With the NV variable I can have these settings persist even when the screensaver is active.