Module Scripts allows you to add more complex and specific handling of values, help parsing data from network or serial streams that are following a specific API.
It's also the way to create Custom Modules, where you can define your own values and parameters, and have scripts run the main logic.
All scripts running inside a module will have a common set of functions that can be added to the script. Those functions are not needed to run the script.
Method | Description | Example |
---|---|---|
function moduleParameterChanged(param) | This function will be called each time a parameter of this module has changed, meaning a parameter or trigger inside the "Parameters" panel of this module. | function moduleParameterChanged(param){ script.log("Param changed : "+param.name); } |
function moduleValueChanged(param) | This function will be called each time a value of this module has changed, meaning a parameter or trigger inside the "Values" panel of this module. | function moduleValueChanged(value) { if(value.isParameter()) { script.log("Module value changed : "+value.name+" > "+value.get()); |
}else { |
||
script.log("Module value triggered : "+value.name); |
||
} |
||
} |
Some modules have specific function callbacks that are useful if you want to customize the parsing of received data from this module.
Some modules have specific methods that are useful if you want to have specific behaviors or send complex or automated data. Those methods are part of the local Javascript object, depending on the module it's running in.