How To | Converting a momentary button to a trigger using Lua scripting
Convert a momentary button to a trigger using Lua scripting
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.
- Drag a Text Controller into the design.
- Open the component
- Add two controls
- Set one of the controls to a "Momentary" button, and name it “Btn”
- Set the other control be be a "Trigger" button. and name it “Trigger"
- 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