ZBrushCentral

Top Level Scripting Problem

Hello, I am trying to load a ZScript and I am having a bit of a problem. Basically I just want to load a tool from a script. Without having to make a button for it either, so it will just happen when I go to Zscript->Load. Here is my script.

[SectionBegin, “Convert to low res”]

[FileNameSetNext,“C:/testt.ZTL”][IPress,Tool:Load Tool]

[SectionEnd]

But when I load the script I get this.

[SectionBegin, “test”
]
[FileNameSetNext,“C:/testt.ZTL”]
ZScript Error The Following COmmand can not be used as a TopLevel COmmands. Place this command within another

TopLevel-Capable command–>[IPress,Tool:Load Tool][SectionEnd]

Does anyone know why?

You’ve made an error in your code. Any commands that you want executed when you click on the Section title should be inside the bracket, not between the SectionBegin and SectionEnd commands. See the code below to see how it is done.


[SectionBegin, "Click this Title"
,0 // initial state, 0 = collapsed, 1 = expanded 
,"Popup info - load the DemoHead"
,//Commands group to execute when expanding to reveal content
	[Note,"Loading ztool...",,2]
	[FileNameSetNext,"ZBRUSH_ZTools/DemoHead.ZTL"]
	[IPress,Tool:Load Tool]
,//Commands group to execute when collapsing to hide content
	[Note,"Closing collapsible section...",,2]
]//end of sectionbegin command

//stuff that is revealed is put here:
[PenMoveDown]//moves down a line before displaying the next text
"This is some stuff that is revealed when you click the section title"

[SectionEnd]

[PenMoveDown]//moves down a line before displaying the next text
"This text - outside the section - will always be displayed"


The Section commands were designed for tutorials which were displayed in the window at the bottom of the UI - used a lot in earlier versions of ZBrush. The Section could be used to display and hide content so that the tutorial could be divided into ‘chapters’.

If you don’t need all the features of the Section you may find the [IButton] command better serves your purpose. See the ZScripting Command Reference for more info.

Edit: Note the special form “ZBRUSH_ZTools/…” can be used to specify a filepath for folders in the ZBrush root folder.

HTH,