ZBrushCentral

ZSphereAdd code syntax problem

I code in many languages, but I’m still trying to figure out how the Zscript syntax works.

What is wrong with this script?

 [ZSphereEdit, [ZSphereEdit,[ZSphereAdd, 10, 3, 12, 2.0, 1], 0], 0] 

I’m just trying to place a zsphere on the stage based on this:
http://pixologic.com/home/z2coderef.html

The ZSphereEdit commands need an active ZSphere tool before they will do anything. So to place an active ZSphere in the middle of your canvas you need to use code something like this:

[IConfig,2.0]
[IButton,"Create ZSphere","Press",
[IPress,Tool:ZSphere]
[CanvasClick,([IGet,Document:Width]/2),([IGet,Document:Height]/2),([IGet,Document:Width]/2),([IGet,Document:Height]/2)+200]
[IPress,Transform: Edit]
[ISet,Draw:Draw Size,1]
]

Then you can use your code to add another ZSphere (but the root ZSphere is index 0):

[ZSphereEdit,[ZSphereAdd, 10, 3, 12, 2.0, 0], 0]

Also you don’t gain anything by wrapping the second ZSphereEdit around the first as the command is simply a container for commands/actions on the active ZSphere tool. I’m surprised ZB doesn’t return an error.

I get this error if I don’t encase it in that function.

Yes, but in your code in your first post you did it twice.