While the process of building web panels with Helm Designer is almost identical to that for ‘native’ Helm Panels, the language used for scripting has changed.
Native (PC-based) panels can use the ‘classic’ Helm script language, or Lua. When building web panels, you must use the Javascript language for scripts, because scripts are run inside the web browser.
Classic
Helm’s’ original scripting language is a simple sequencing language. Commands were executed sequentially, with no expression evaluation or conditional control flow capabilities. Helm’s script editor has intelligence about the allowed commands, and the interface allows commands to be constructed interactively as well as typed. Classic scripts look like this:
ELEMENTAL:PauseOutput("42") StatusLabel:Set("Text", _ELEMENTAL:Status)
In the first line, Elemental
is the name of the device we’re controlling, PauseOutput
is the action we’re performing, and "42"
is a parameter. The second line sets a Label’s Text to the current Status of the Elemental device.
Lua
The introduction of Lua for Helm Scripting brings the power of a conventional programming language to Helm. Integration with third part libraries, control flow and expression evaluation. The first versions supported a fairly simple interface with the Helm system, so the above script would have been written like this.
helm.exec("ELEMENTAL","PauseOutput",42) helm.set("StatusLabel","Text", helm.get("ELEMENTAL","Status"))
More recent Helm releases allow this to be written more concisely, where every Helm component is directly available from a global object named H
H.ELEMENTAL.PauseOutput(42) H.StatusLabel.Text = H.ELEMENTAL.Status
Javascript
Javascript follows the new Lua convention very closely, and the previous example can be used unchanged.
H.ELEMENTAL.PauseOutput(42) H.StatusLabel.Text = H.ELEMENTAL.Status
While simple function calls and assignment statements very similar to Lua, there are plenty of significant differerences. Because Javascript is so widely used there are plenty of books and online resources available to help you learn it. We suggest the MDN Javascript Guide as a good place to start, but there are many more tutorials and guides available.
Specifying Script types
In Helm’s Script Editor, you can specify the script type by clicking the appropriate button. The Helper panel below which allows you to choose devices, functions and parameters is only available for Classic scripts,