Skip to content

New features in VP10

c-f-h edited this page May 28, 2014 · 11 revisions

Transparent walls

Walls/surfaces can now be made transparent by checking the according checkbox in their properties.

To specify the amount of transparency, there are two options. The first is the Opacity property, which can be set from the editor or via script: 0 means completely transparent and therefore invisible, 255 means fully opaque (no transparency). The second way is to assign the wall a texture which has an alpha channel. These two methods can also be combined, in which case the alpha channel of the texture will modulate the Opacity setting.

Opacity settings on ramps

Ramps too now have transparency and Opacity settings as described above for walls.

New scripting features

Getting all currently active balls

The new global script function GetBalls() returns an array containing all balls which currently exist on the table. This can be useful for scripting the ball rolling sound, for instance.

Getting all table elements

The new global script function GetElements() returns an array containing all elements which were placed on the table in the editor. This can be used to preprocess objects based on their name or type, for instance, or to collect certain objects into arrays and act on them later.

Note that this function can return hundreds or thousands of objects on a complex table, so it should only be used during the initialization phase of the table to avoid performance problems.

' Set opacity of all transparent walls to 100
Dim e
For Each e in GetElements()
	If TypeName(e) = "Wall" Then
		If e.Transparent Then e.Opacity = 100
	End If
Next
' Hide all objects whose name starts with "abc"
Dim e
For Each e in GetElements()
	If Left(e.Name, 3) = "abc" Then
		e.Visible = 0
	End If
Next

Getting a table element by name

The new global script function GetElementByName(str) returns the element with the given name, or Nothing if no element with that name exists.

Note that this function currently has to search through all objects, so it can be slow to use it many times per frame. It's best to use it at startup and store the result in a variable.

' Get the ramp named "Ramp42" and store it in a variable.
Const rampNr = 42
Dim myRamp
Set myRamp = GetElementByName("Ramp" & rampNr)