How To | Converting a momentary button to a trigger using Lua scripting

Convert a momentary button to a trigger using Lua scripting

Updated at January 2nd, 2024

Procedure


Some systems may require mixed control types for various functions.

This example will convert the momentary button press into a triggered output using a Text Controller component.

  1. Drag a Text Controller into the design.
  2. Open the component
  3. Add two controls
  4. Set one of the controls to a "Momentary" button, and name it “Btn”
  5. Set the other control be be a "Trigger" button. and name it “Trigger"
  6. Open the script editor and copy the code snippet into it
Controls["Btn"].EventHandler = function() --This line captures the state change of the button press and runs function 

	if Controls["Btn"].Boolean == true then --This line looks at the button presses state to determine if true or not 

		Controls["Trigger"]:Trigger() --this line sets Trigger output  

	end
end