A system comprising: a platform comprising at least one hardware processor, and a web application configured to, when executed by the at least one hardware processor, generate a graphical user interface, GUI, for creating control scripts, wherein the GUI comprises one or more inputs for linking graphical elements, each representing a construct of a base scripting language, into a graphical representation of a control script, and wherein the at least one hardware processor of the platform converts the graphical representation of at least one control script into the base scripting language; and a plurality of gateways, each configured to receive the at least one control script from the platform via at least one network, wherein each of the plurality of gateways comprises at least one hardware processor, a compiler that, when executed by the at least one hardware processor of the gateway, automatically compiles the at least one control script, represented in the base scripting language, into at least one virtual-machine program as it is loaded into a virtual machine, and the virtual machine that, when executed by the at least one hardware processor of the gateway, executes the at least one virtual-machine program to control one or more physical devices communicatively connected to the gateway. a platform comprising at least one hardware processor, and a web application configured to, when executed by the at least one hardware processor, generate a graphical user interface, GUI, for creating control scripts, wherein the GUI comprises one or more inputs for linking graphical elements, each representing a construct of a base scripting language, into a graphical representation of a control script, and wherein the at least one hardware processor of the platform converts the graphical representation of at least one control script into the base scripting language; and at least one hardware processor, and a web application configured to, when executed by the at least one hardware processor, generate a graphical user interface, GUI, for creating control scripts, wherein the GUI comprises one or more inputs for linking graphical elements, each representing a construct of a base scripting language, into a graphical representation of a control script, and wherein the at least one hardware processor of the platform converts the graphical representation of at least one control script into the base scripting language; and a plurality of gateways, each configured to receive the at least one control script from the platform via at least one network, wherein each of the plurality of gateways comprises at least one hardware processor, a compiler that, when executed by the at least one hardware processor of the gateway, automatically compiles the at least one control script, represented in the base scripting language, into at least one virtual-machine program as it is loaded into a virtual machine, and the virtual machine that, when executed by the at least one hardware processor of the gateway, executes the at least one virtual-machine program to control one or more physical devices communicatively connected to the gateway. at least one hardware processor, a compiler that, when executed by the at least one hardware processor of the gateway, automatically compiles the at least one control script, represented in the base scripting language, into at least one virtual-machine program as it is loaded into a virtual machine, and the virtual machine that, when executed by the at least one hardware processor of the gateway, executes the at least one virtual-machine program to control one or more physical devices communicatively connected to the gateway.