Capturing button press

I'm working on a show where I'd like to capture which of ten buttons is pressed and store it as a variable to be used as a timeline selection that would be played with an astro trigger. The concept is that there is a default timeline that would run everyday but if so desired, an alternative can be selected prior to the astro event and there run instead of the default. I can't find information about passing a button number through to a variable or function. Is this possible?


  • I have done this in the past by having my buttons populate timeline numbers to a table or update a global variable instead of the start timeline action. I then use an Astro trigger to call that data and/or a “fire now” button to test it. If your default timeline is timeline number 1(for an easy example) you could have another trigger that resets the variable to 1 each day. 
    you can also use this data to update captions on your screen to provide some feedback. If variable is 1 “default is scheduled” if variable is 2 “timeline 2 is scheduled”. 

    I am half asleep right now and I am only semi coherently typing on my phone instead of a computer, otherwise...  I would provide a better example and some LUA snips for reference. I think the script I was using is slightly deprecated with the newest api anyways. 

  • I haven't been able to test the 2 attached configurations as I am about to get on a plane but I hope they might work or at least be able to point you in the right direction.
    I have done 1 config without using a script and another using scripts.

  • Right, capturing to a global variable is the path I'm on. Thanks for the input!

  • Hello Tom, I like how streamlined the scripting approach is. I can see what's going on with it. Thanks for the examples!

  • I was just reading through emails and this came back up. Sorry for the "fragmented" answer. 

    Tom's Scripting example is essentially what I was attempting to explain. The flexibility you get from LUA(and/orJavaScript for that matter) is addicting. I find myself using a script in some of the most basic projects  even if its just to automatically populate touch screens with pages and buttons with names/timeline numbers.

    you do end up with the "just because it can doesn't mean it should" internal conflict from time to time haha

  • I've been experimenting with a different approach to this using intensity mastering. 

    The scheduled timeline is activated in the morning (assuming a system that's lit up sunset to sunrise) just after the lights are turned off with an intensity master (sunrise +30 or whatever).

    The intensity master goes to full at sunset-30 or whenever it's scheduled to. 

    The advantage is the button for tonight's timeline is selected all day, so daytime workers can see what to expect on the screen, and making a change for a one-off update is straightforward. 

  • I thought of this scenario as well. What would you do for the daily reset? Would you have it revert to the normally scheduled program just before normal business hours?

    I may be a pessimist, but I could see someone on staff(end users staff) consistently setting a "preset" for the day BEFORE the system reverts back to the default programming each day and complaining. 

  • Basically, instead of having the Start Timeline instruction in the "Sunset -30" trigger, it would be in a "Sunrise +31" trigger. There would be a window where staff could get it confused, but that's something you have to cover in training no matter when your astro triggers fire. I like it better than "if you only want to override for a day, wait for the lights to come on and push a different button" strategy

  • I agree, I constantly struggle with going down the rabbit hole with "just because you can"! I'm wanting to incorporate the scripting approach, just the typical "learning how to do it" with an active project. I'm used to doing things with the standard triggers but would like a cleaner appraoch.

  • Tom! Is "lstbtn" that you use something that Lua is supposed to know? Your set_control_state(button%lstbtn, Blue) and set_control_state(button%btn, Orange) calls return error messages. I have everything working where if a button is pressed within a range it is stored in a variable that is then used in an astro trigger with it's corresponding timeline and I'm trying to use the same variable to change the state of it's button as well as whatever was before that button was pressed, mutually exclusive.