Scripting | Tips and Tricks

Hi Dimitry,
I hope you were getting some rest at home in sunny Netherlands :sunglasses:

I am opening this topic for questions that we have regarding simple scripting in viz artist and template wizard.

First question would be:

How do you target a property of some plugin?
For example Counter plugin and we want to target his input value to enter the value by other means, for example with some text in other container. We tired something like this.childcontainer.Geometry.Counter.Value but we couldn’t access and error was telling us that Counter does not exist.

Thanks

1 Like

Hehe, sunny Netherlands :slight_smile:
Tbh, I’m still recovering…

If you need to read or write these values of plugins, you have to get specific PluginInstance from the container, not from Geometry.

So, this won’t work:

In order to get something from “Counter” plugin you need to get the PluginInstance by name “Counter”.

How do I understand what the name I should use? As always — by reading the name from the console after manual triggering corresponding plugin.

Снимок экрана 2023-12-23 164040

You can see this plugin is functional because of FUNCTION word. (it’s not geometry!) And, you see the correct name of this plugin.

You need to search this function of the Container type:

Function GetFunctionPluginInstance(pluginName As String) As PluginInstance

and use it to control the “number” property (this name is also visible in the console):

'option 1 — with creating an extra variable: 
Dim pCounter = this.GetFunctionPluginInstance("Counter")
pCounter.SetParameterInt("number", 123)

'option 2 — without any extra variables:
this.GetFunctionPluginInstance("Counter").SetParameterInt("number", 123)

For different parameter you have to choose dedicated function. In our case we used SetParameterInt because the value is Integer. The full list you can find the great documentation about PluginInstance.

Try this link — file:///C:/Program%20Files/Vizrt/VizEngine/Documentation/viz-script-doc-webhelp/DataTypePluginInstance.html
(this may not work due to different installation)

1 Like