This is an explanation where to start when creating a new module, and how the basics work.
In this example I will create a new module, set the properties, create actions and connect them.
I will show in particular about how to do it properly.
The "PropertiesExample" module was added to the installer 1.9.164 and above, that illustrates many of the functionalities of the property builder. This can be used as starting point, unused elements can be deleted from the module.
We will create the module “Autoinit”, it should provide a simple node based solution to run a module after startup. It should be possible to set a delay, in case some elements in Pixera are not ready at startup.
We will add a new module and start to create Properties and things like module version, date……
- Import “NewModule” to the workspace
- Change name to Autoinit
- Right-click the module and Launch Property Builder
I'm adding a new function called delay, this is to set the init delay.
I set the default value to 30 and select the type number.
This is the only module specific property, all the others are just information, I will not go into the creation of these here.
A PNG with the Pixera logo and alpha in the background has been added to the logo.
Now we add an action and name it init. This name has a special use, if "Auto Init" exists as property and is true, then it will call the init() action automatically. In this current state, the init() will be called already after startup or the Lua core is allocated.
Now we enter the code to the action itself.
In our case, we want the delay to be used and then an action to be executed in the node system.
First we need to import the pixc.helper to read from the properties the value we need.
We can create the import the requirement with the following code, built-in intelligence will help us here and speed up the process:
if self.helper == nil then require "pixcHelper" self.helper = createPixcHelper(pixc,self()) end
Afterward, we can get our value like this:
local delayTime = self.helper:getProperty("Delay")
Now we can use the internal sleep function to not disrupt execution of other modules while sleeping.
Utils.Timer.sleep(delayTime * 1000.0)
Now the module looks like this:
You need at least a Control Core license for export.
Now that it contains everything necessary, it is ready for export.
This export creates a .json file that can be imported back into Pixera Control.
Pixera 1.9.136 | 21. September 2023