skyvat wrote:I then tried entering your script into the Periodical event field. Again, it seems like I just don't understand how you connect that script to the module interface.
Basically you can communicate with your interface using the "module" global object and the "setValue" / "getValue" functions :
module.setValue(controlName, key, value)
module.getValue(controlName, key)
- controlName is the name of the control that you specified in the interface builder.
- key is for controls which have several possible values (like two axis, etc.). For a knob or a slider you can always pass 0.
- value is the value of the control. Typically it goes from 0.0 to 1.0 (50% = 0.5). However you can also change the range in the interface builder.
Try to add a knob to your module and give it the name "speed".
And use this new version of the precedent periodical script:
Code: Select all
v = modul8.getValue('direct_layer_rotation_z', 0)
if v==None:
v = 0
v+= elapsed*10.0 *module.getValue('speed',0)
modul8.setValue('direct_layer_rotation_z', v,0)
Now you can change the speed of the rotation using the knob.
The interesting line is :
v+= elapsed*10.0 *module.getValue('speed',0)
The getValue returns the current value of the knob from 0.0 to 1.0.
"elapsed" is the amount of time in seconds since the last frame.