FAQ | What are scripts and how are they used
Explanation about what BASIC and LUA scripts are, and what they are used for.
QUESTION: What are scripts? Do I HAVE to use them?
Several ControlByWeb products have the ability to run scripts. Scripts are a set of instructions similar to a small program. Scripts can be used for advanced logic functions and/or relay timing that cannot be done through the setup pages. You do not HAVE to use scripts to operate our products. In fact, for most applications scripts will not be necessary; however, for advance functionality, scripts are a great resource to have.
For example, for the X-301, you can easily activate relay1 if input1 is on or activate relay2 if input2 is on. With a script, relay1 may be activated when both input1 and input2 are on. Another scenario is input1 will activate both relay1 and relay2.
Scripts are also great for relay timing as well. Say relay1 needs to be on for 5 minutes before relay2 turns on. Or perhaps input1 will activate relay1 to start something like a heating element in preparation to start an engine. Ten minutes later, relay1 will turn off, and relay2 will activate to start the engine. These advanced timing options are possible with a script.
Scripts may also be used for time-based functions as well. An example would be an X-301 has an input connected to a door alarm. A script can be configured to send an email/text alarm any time the door opens outside of normal business hours (before 6AM and after 10PM).
While most applications can be adequately configured using the settings within the ControlByWeb modules, scripts open up many more possibilities for using advanced logic with ControlByWeb products.
Most of our advanced products support BASIC scripts (X-300, X-301, X-310, X-320, etc). The X-600M uses a different language for the coding, called LUA. Please see the X-600M users manual or the Lua Users Manual for more information.
** Please see our script writing tutorial for assistance and several examples for writing a BASIC script: Script Writing Tutorial