Attract-Mode Support Forum

Attract-Mode Support => Scripting => Topic started by: arzoo on May 14, 2020, 02:57:20 PM

Title: How to get attract-mode config values from within plugin?
Post by: arzoo on May 14, 2020, 02:57:20 PM
Hi, Is it possible to get the values from the attrract.cfg file from within a plugin? Any suggestions would be appreciated. Thanks.
Title: Re: How to get attract-mode config values from within plugin?
Post by: keilmillerjr on May 14, 2020, 03:12:16 PM
Read the file using squirrel standard library. May I ask what you are trying to do?
Title: Re: How to get attract-mode config values from within plugin?
Post by: arzoo on May 14, 2020, 08:14:20 PM
Read the file using squirrel standard library. May I ask what you are trying to do?

I'm updating the LEDBlinky plugin so it correctly passes events to LEDBlinky. If I can get this working I'll add AM as a front-end that's natively supported by LEDBlinky (I'm the dev). The last issue I'm having with the plugin is that when AM is configured to show the Displays menu on startup (startup_mode = displays_menu), the plugin receives two back-to-back Transition.ToNewList callbacks on startup, the first is for the selected item (display) in the list and the second is for the Displays menu itself. I don't want the plugin to pass the first (bogus) ToNewList transition to LEDBlinky. The only way I can see making this work is if the plugin knows how the startup_mode is set, which is why I need to read the value from the attract.cfg file. I was hoping the config values were stored in a table that was included in the fe object, but I guess I'll have to manually parse the file.

Can you point me to any docs or examples for using the squirrel standard library to read a file? Thanks!
Title: Re: How to get attract-mode config values from within plugin?
Post by: cools on May 15, 2020, 04:43:33 AM
That sounds more like an AM bug to me, have you reported it?
Title: Re: How to get attract-mode config values from within plugin?
Post by: arzoo on May 15, 2020, 05:30:42 AM
That sounds more like an AM bug to me, have you reported it?

Good idea, I'll report the bug. In the mean time, I realize there's no need for the plugin to read the AM config file since LEDBlinky itself does that to get the control codes.