ZBrushCentral

Getting Started with ZScripting

About ZScript :

ZScript is ZBrush’s built-in scripting language. It provides a way to automate common or repetitive tasks as well as add new functionality to ZBrush. It’s the language behind zscript recordings, tutorials, macros and plugins.

Online Resources

Local Documentation

You can export the full list of Zscript function directly from Zbrush .
Starts ZBrush and , in Zscript : export commands and a file dialog popup and ask you to file to a text file , then save on disk.

Note :
The Export Command list is the latest version of the Zscript documentation, as the offical documentation is getting old and some new function hasn’t been added in the command reference.

Editors and IDE

To write your Scripts and macro you can use a simple Text editor, but you can also use an IDE which offer more control and more tools to automate your task and backup your code on Git Depots.

VS Code

VS Code

ZScript VS Code Extension is Free and a dedicated extension developed by Jonathan Ouellet is available on the marketplace, it provided built in documentation and auto complete assistance.

Sublime Text[SHAREWARE]

>> Download Sublime Text

Notepad++

>> Download Notepad ++

Atom

>> Download Atom

or simply use Notepad

ZFileUtils Library ( Win/MAC)

What is ZFileUtils ?

ANSWER : ZFileUtils is a DLL (dynamic link library) that provides useful utilities to ZScript. This page describes these utilities. A sample zscript showing how to use all the functions is included in the zip (see below).

ZFileUtils Documentation and Samples code:

Latest version ZFileUtils 2021 01A updated November 17 2020
Download ZFileUtils 2021

Tutorials

1 Like

Custom ZBrush Startup DefaultZScript.txt

Introduction

Read First

Before to starts Do not forget, that we are going to edit the script which run at the ZBrush startup, if you are not sure about what you are about to do, by editing this file,
please consider to backup the file, to easily restore it without to brick your installation and having as last resort to uninstall ZBrush to make a new full installation.

Don’t forget to post your questions on this forum.

Requisite

I. Locate the install directory where you have ZBrush installed.

II. in the root folder there is a /ZScripts/ directory then open it

III. you will see a file with the name of DefaultZscript.txt open it with a text editor.

The DefaultZscript.txt File

The script below is the default startup script after a full installation., you can copy it to restore your startup script if you screw it up :rofl:

//startup

[If,[MemGetSize,startup_mem],

    [IPress,"Zplugin:Misc Utilities:Home Page"]
    ,//else
    [IPress,"Zplugin:Misc Utilities:Home Page"]
    [MVarDef,startup_mem,1,0]
]
[pd]
  • The script contains a Single [If] conditional block.

  • [IPress] are not Top level command !

Important :
We must to use the [If] block to [IPress, Misc utilities:Homepage] if startup_mem size is equals to 0 and mean the variable do not exists.

Conclusion

A. If it does not exists, then we define the variable with [MVarDef], and set the variable to 0.

B. If it does exists, then we [IPress] on "Zplugin:Misc Utilities:Home Page".

Commonly we would only have to edit the second part of the [If] statement,

The script below, will select using[IPress] the active Tool to be the Polymesh3D

//startup

[If,[MemGetSize,startup_mem],

    [IPress,"Zplugin:Misc Utilities:Home Page"]

    ,//else

    [IPress, "Tool:PolyMesh3D"]
    [MVarDef,startup_mem,1,0]
    // beware once pressedit never execute the code after the next line, because it calld on the different script.
    [IPress,"Zplugin:Misc Utilities:Home Page"]

]

Hope it helps!
Nicolas

1 Like

I think the defaultzscript you provide is not correct. The Home Page is another zscript, and when it is loaded, any code after it won’t even run.

[IPress,“Zplugin:Misc Utilities:Home Page”]
[MVarDef,startup_mem,1,0]

With this code, the if condition will never be true. Because the code to define the startup_mem is never executed. I think you never run this code in your computer to test?

Even the code in this support page is not correct:
How to Disable Home Page News – Knowledge Base (maxon.net)