ZScript Command Reference
From ZBrush Info
Contents |
Introduction
All the zscript commands are listed below, with brief explanations and examples. If you are new to scripting then it's probably best to read Getting Started with ZScripting before using this list to extend your knowledge. If you are already familiar with scripting then you may find ZScripting for Seasoned Scripters useful.
A pdf version of this page can be downloaded here.
Buttons and Sliders
| IButton | [IButton, Button name, Popup info Text, Commands group to execute when button is pressed, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled), Button width in pixels (0:AutoWidth NonZero:Specified width), Optional hotkey, Optional button icon (.psd .bmp + .pct for Mac Systems), Button height in pixels (0:AutoHeight NonZero:Specified height)]
|
| Creates an interactive push button (can be placed anywhere but advise Top Level). | |
Example:
Creates an interactive button with "Click Me" text which will display a "YouClicked" message when pressed (Top Level).
The special Button name ??? indentifies this as a Macro. If the zscript text file is placed in the ZStartup\Macros folder, ZBrush will automatically load the zscript; the file name will show as the Button name. | |
| ISlider | [ISlider, Slider name, CurValue, Resolution, MinValue, MaxValue, Popup info Text, Commands group to execute when value is changed, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled), Slider width in pixels (0:AutoWidth NonZero:Specified width)]
|
| Creates an interactive slider (Top Level). | |
Example:
Creates an interactive slider with initial value of 12, range of 0 to 100 and "ChangeMe" text which will display a "Thankyou" message when its value is changed | |
| ISwitch | [ISwitch, Switch name , Initial state (1:pressed, 0:unpressed), Popup info Text, Commands group to execute when button is pressed , Commands group to execute when button is unpressed, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled), Switch width in pixels (0:AutoWidth NonZero:Specified width)]
|
| Creates an interactive switch (Top Level). | |
Example:
Creates an interactive switch with "ClickMe" label which will display an "On" message when pressed and an "Off" message when unpressed Note: for zplugins, only unpress commands work. | |
| ISubPalette | [ISubPalette, Subpalette name, Title mode? (0:Show Title and minimize button(ByDefault) 1:Show Title without minimize button 2:Hide Title ), Optional subpalette gray-scale (8-bits) icon (Standard size of 20x20 pixels), Left Inset (0:default), Right Inset (0:default), Left Top (0:default), Right Bottom (0:default)]
|
| Adds a subpalette to ZBrush interface. Output: Returns 1 if subpalette added successfully. Returns 0 if subpalette could not be added or if it already exsists. | |
Example:
Creates a "My Plugins" subpalette within the ZPlugin palette. This command is essential for creating a zscript plugin. | |
| ButtonFind | [ButtonFind, Interface item path, Button name, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled)]
|
| Locates a ZBrush interface item (Top Level). | |
Example:
Locates the width button in the Document menu | |
| ButtonPress | [ButtonPress, Interface item path, Button name, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled)]
|
| Locates and presses a ZBrush interface item (Top Level). | |
Example:
Locates the Sphere3D button in the Tool menu and presses it making the Sphere3D the active tool | |
| ButtonSet | [ButtonSet, Interface item path, Value, Button name, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled)]
|
| Locates and sets a new value to a ZBrush interface item (Top Level). | |
Example:
Locates the Width slider in the Document menu and enters "123" as its value | |
| ButtonUnPress | [ButtonUnPress, Interface item path, Button name, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled)]
|
| Locates and unpresses a ZBrush interface item (Top Level). | |
Example:
Locates the W button in the Modifiers submenu of the Layer menu and unpresses it | |
Notes and Messages
| Note | [Note, "Text line", Optional path1 of an interface item to be pointed out (default:none), Display Duration (in seconds) (0:wait for user action(default), -1:combine with next note command), Popup background color (0x000000<->0xffffff, default:0x606060, 0:No Background), Prefered distance of the note from the specified interface item (default:48), Prefered Note width (in pixels, default:400), optional marked windows fill color (0x000000<->0xffffff or (blue+(green*256)+(red*65536))(Omitted value:No fill)), Frame horizontal size (1:Max width (default)), Frame vertical size (1:Max height (default)), Frame left side (0:left (default), .5:center, 1:right) Omit value for horizontal autocentering, Frame top side ( 0:top (default), .5:center, 1:bottom )Omit value for vertical auto-centering, Optional icon file name]
|
| Displays a note to the user. Output: If the note has UI buttons then the return value of the pressed buttons (1=1st button, 2=2nd button ...), otherwise the return value will be zero (Sub-Level only). | |
Example:
Displays a message to the user with "Hello There" as the text. | |
| NoteBar | [NoteBar, The Message that will be shown (use empty string to clear current note), Optional progress-bar value (0:Min, 1:Max)]
|
| Displays a note in progress bar (Sub-Level only). | |
Example:
Displays a progress bar note "ZScript is calculating. Please wait...". | |
| NoteIButton | [NoteIButton, Button name, Optional button icon, Initially Pressed? (default:unpressed), Initially Disabled? (default:enabled), Optional button H relative position (Positive value:offset from left, Negative value:offset from right, 0:automatic), Optional button V relative position (Positive value:offset from top, Negative value:offset from bottom, 0:automatic), Optional button width in pixels (default:automatic), Optional button height in pixels (default:automatic), Optional button color (0x000000<->0xffffff or (blue+(green*256)+(red*65536))), Optional text color (0x000000<->0xffffff or (blue+(green*256)+(red*65536))), Optional background opacity (default:1), Optional text opacity (default:1) , Optional image opacity (default:1)]
|
| Defines a button to be included within the next Note to be shown (Sub-Level only). | |
Example:
Defines an "OK" note button. | |
| NoteIGet | [NoteIGet, Note-button index (1:1st) or its name]
|
| Returns the value of am NoteIButton which was shown in the last displayed Note. Output: The item value. | |
Example:
Returns the value of the 1st note button or switch.
Returns the value of the note button or switch named "Double". | |
| NoteISwitch | [NoteISwitch, Switch name, Optional button icon, Initially Pressed? (default:unpressed), Initially Disabled ? (default:enabled), Optional button H relative position (Positive value:offset from left, Negative value:offset from right, 0:automatic), Optional button V relative position (Positive value:offset from top, Negative value:offset from bottom, 0:automatic), Optional button width in pixels (default:automatic), Optional button height in pixels (default:automatic), Optional button color (0x000000<->0xffffff or (blue+(green*256)+(red*65536))), Optional text color (0x000000<->0xffffff or (blue+(green*256)+(red*65536))), Optional background opacity (default:1), Optional text opacity (default:1), Optional image opacity (default:1)]
|
| Define a switch-button to be included within the next Note to be shown (Sub-Level only). | |
Example:
Defines a "Double Sided" note switch-button. | |
| MessageOK | [MessageOK, The Message that will be shown, The Title of the message]
|
| Displays a user message with a single OK button | |
Example:
Displays a message to the user with "Hello There" as the text, and waits for the user to click the "OK" button (Sub-Level only). | |
| MessageOKCancel | [MessageOKCancel, The Message that will be shown, The Title of the message]
|
| Displays a user message with CANCEL and OK buttons Output: Returns the button that the user clicked. (0=CANCEL, 1=OK)(Sub-Level only). | |
Example:
Displays a message to the user with "Delete this image?" as the text, and waits for the user to click the "OK" or "Cancel" button. | |
| MessageYesNo | [MessageYesNo, The Message that will be shown, The Title of the message]
|
| Displays a user message with YES and NO buttons Output: Returns the button that the user clicked (0=NO, 1=YES)(Sub-Level only). | |
Example:
Displays a message to the user with "Are you sure?" as the text, and waits for the user to click the "YES" or "NO" button. | |
| MessageYesNoCancel | [MessageYesNoCancel, The Message that will be shown, The Title of the message]
|
| Displays a user message with YES, NO and CANCEL buttons Output: Returns the button that the user clicked (0=NO, 1=YES CANCEL=-1)(Sub-Level only). | |
Example:
Displays a message to the user with "Are you sure?" as the text, and waits for the user to click the "YES", "NO" or "CANCEL" button. | |
Working in the Canvas
| CanvasClick | [CanvasClick, X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6, X7, Y7, X8, Y8]
|
| Emulates a click within the current canvas area | |
Example:
Emulates a canvas click at 10, 10 with a drag to 20, 20 before releasing the mouse button | |
| CanvasGyroHide | [CanvasGyroHide]
|
| Hides the Transformation Gyro | |
Example:
Hides the Transformation Gyro until the next | |
| CanvasGyroShow | [CanvasGyroShow]
|
| Shows the Transformation Gyro | |
Example:
Shows the Transformation Gyro hidden by a previous | |
| CanvasPanGetH | [CanvasPanGetH]
|
| Returns the H pan value of the active document view Output: The current H Pan value. | |
Example:
Returns the Horizontal pan value of the active document view | |
| CanvasPanGetV | [CanvasPanGetV]
|
| Returns the V pan value of the active document view Output: The current V Pan value. | |
Example:
Returns the Vertical pan value of the active document view | |
| CanvasPanSet | [CanvasPanSet, H value (0:left of document), V value (0:top of document)]
|
| Pans (Scrolls) the active document view | |
Example:
Scrolls the center of a 640x480 canvas to be at the center of the document view
Scrolls the top left corner of the canvas to be at the center of the document view | |
| CanvasStroke | [CanvasStroke, StrokeData, Delayed update until end of stroke, Rotation, HScale, VScale, HOffset, VOffset]
|
| Emulates a brush stroke within the current canvas area | |
Example:
Replays the last stroke | |
| CanvasStrokes | [CanvasStrokes, StrokesData, Delayed update until end of stroke, Rotation, HScale, VScale, HOffset, VOffset, HRotateCenter, VRotateCenter]
|
| Emulates multiple brush strokes within the current canvas area | |
Example:
Replays "loadedStrokes" in the canvas area | |
| CanvasZoomGet | [CanvasZoomGet]
|
| Returns the zoom value of the active document view Output: The current zoom value. | |
Example:
Returns the zoom value of the active document view | |
| CanvasZoomSet | [CanvasZoomSet, Zoom factor]
|
| Sets the zoom factor of the active document view | |
Example:
Sets the zoom value to 2 (each Pixol is shown twice as large)
Sets the zoom value to .5 (half-antialiased zoom mode) | |
| PixolPick | [PixolPick, Component Index: 0:CompositeColor (0x000000<->0xffffff or (red*65536+green*256+blue)); 1:Z(-32576 to 32576); 2:Red(0 to 255); 3:Green(0 to 255); 4:Blue(0 to 255); 5:MaterialIndex(0 to 255); 6:XNormal(-1 to 1); 7:YNormal(-1 to 1); 8:ZNormal(-1 to 0), H Position, V Position]
|
| Retrieves information about a specified Pixol Output: The value of the specified Pixol | |
Example:
Returns the Z(depth) value at 10, 20 canvas position. | |
| StrokeGetInfo | [StrokeGetInfo, Stroke-type Variable, Info number, Point index (0 based)]
|
| Retrieves the information from a specified Stroke-type Variable Output: StrokeInfo result
Info number: 0=PointsCount 1=IndexedHPos 2=IndexedVPos 3=IndexedPressure 4=MinH 5=MinV 6=MaxH 7=MaxV 8=MaxRadius 9=MaxRadiusPointlndex 10=MaxDeltaH 11=MaxDeltaV 12=Total Distance 13=Twirl Count 14=DeducedZValue 15=IndexedkeyPress | |
Example:
Returns the number of points in the last drawn brush stroke | |
| StrokeGetLast | [StrokeGetLast]
|
| Retrieves the last drawn brush stroke Output: StrokeData | |
Example:
Replays the last drawn brush stroke
Replays the last drawn brush stroke rotated 90 degrees and scaled x2. | |
| StrokeLoad | [StrokeLoad, FileName(.txt)]
|
| Loads a brush-stroke text file Output: StrokeData | |
Example:
Loads the "Star.txt" file, creates a BrushStroke object and assigns it to "Strokel" variable.
Loads the "Star.txt" file, creates a BrushStroke object and applies it to the canvas. | |
| StrokesLoad | [StrokesLoad, FileName(.txt)]
|
| Loads a brush-strokes text file Output: StrokesData | |
Example:
Loads the "Star.txt" file, creates a BrushStrokes object and assigns it to "Strokel" variable.
Loads the "Star.txt" file, creates a BrushStrokes object and applies it to the canvas. | |
| TransformGet | [TransformGet, xPosition, yPosition, zPosition, xScale, yScale, zScale, xRotate, yRotate, zRotate]
|
| Gets current transformation values (Sub-Level only). | |
Example:
sets the variables xPos, yPos, zPos, xSc, ySc, zSc, xRot, yRot and zRot to the 3D Position, Scale and Rotation values of the last drawn object or current floating object. | |
| TransformSet | [TransformSet, xPosition, yPosition, zPosition, xScale, yScale, zScale, xRotate, yRotate, zRotate]
|
| Sets new transformation values (Sub-Level only). | |
Example:
sets the 3D values of the last drawn object or current floating object to: Position - XY center of the canvas and Z depth 0 Scale - uniform scale of 100 Rotation - default rotation of 0, 0, 0 | |
Working with ZBrush
| IClick | [IClick, Interface item path, X1, Y1, X2, Y2, X3, Y3, X4, Y4, X5, Y5, X6, Y6, X7, Y7]
|
| Emulates a click within a specified ZBrush interface item (Sub-Level only). | |
Example:
Emulates a click at 55, 10 position
Emulates a click at 10, 10 with a drag to 20, 10 before releasing the mouse button | |
| IClose | [IClose, Interface item path, Show Zoom Rectangles?, Target parent window?]
|
| Closes an interface item. | |
Example:
deletes the ZScript:Play window | |
| IColorSet | [IColorSet, Red (0-255), Green (0-255), Blue (0-255)]
|
| Sets the active color to a new value | |
Example:
sets the main interface active color to red | |
| IConfig | [IConfig, ZBrush version-configuration ]
|
| Sets ZBrush internal version-configuration | |
Example:
sets the interface to 2.0 configuration
sets the interface to 3.1 configuration | |
| IDialog | |
| Command currently disabled | |
| IDisable | [IDisable, Window path, Window ID or relative windowID(-100<->100)]
|
| Disables a ZScript interface item (can only be used for ZScript-generated interface items) | |
Example:
Disables the "DoIt" ZScript interface item
Disables the next interface item in the ZScript window | |
| IEnable | [IEnable, Window path, Window ID or relative windowID(-100<->100)]
|
| Enables a ZScript interface item (can only be used for ZScript-generated interface items) | |
Example:
Enables the "DoIt" ZScript interface item
Enables the next interface item in the ZScript window | |
| IExists | [IExists, Interface item path]
|
| Verifies that a specified interface item exists. Output: 1 if item exists, 0 otherwise | |
Example:
returns 1 if TOOL:Sphere3D exists, returns 0 otherwise. | |
| IFadeIn | [IFadeIn, Fade in speed in secs. (default:.5 secs)]
|
| Fades in ZBrush window from black. | |
Example:
fade in from black, speed = 0.35 seconds (*ZBrush 3 only). | |
| IFadeOut | [IFadeOut, Fade out speed in secs. (default:.5 secs)]
|
| Fades out ZBrush window to black. | |
Example:
fade out to black, speed = 0.35 seconds (*ZBrush 3 only).
| |
| IGet | [IGet, Interface item path]
|
| Returns the current value of a ZBrush or ZScript interface item Output: The item value | |
Example:
Returns the current value of the Width slider in the Draw menu | |
| IGetFlags | [IGetFlags, Interface item path]
|
| Returns the status flags of the specified interface item Output: The flags | |
Example:
Returns the info of specified windowID interface item | |
| IGetHotkey | [IGetHotkey, Interface item path]
|
| Returns the hotkey of the specified interface item Output: The Hotkey | |
Example:
Returns the hotkey of specified windowID interface item | |
| IGetID | [IGetID, Interface item path]
|
| Returns the window ID code of the specified interface item Output: The Title | |
Example:
Returns the id code of the Tool:LoadTool interface item | |
| IGetInfo | [IGetInfo, Interface item path]
|
| Returns the info (popup info) of the specified interface item Output: The info | |
Example:
Returns the info of specified windowID interface item | |
| IGetMax | [IGetMax, Interface item path]
|
| Returns the maximum possible value of a ZBrush or ZScript interface item Output: The item maximum value | |
Example:
Returns the maximum value of the Width slider in the Draw menu | |
| IGetMin | [IGetMin, Interface item path]
|
| Returns the minimum possible value of a ZBrush or ZScript interface item Output: The item minimum value | |
Example:
Returns the minimum value of the Width slider in the Draw menu | |
| IGetSecondary | [IGetSecondary, Interface item path]
|
| Returns the the secondary value of a 2D interface item Output: The item value | |
Example:
Returns the secondary value of the Light:LightPlacement control | |
| IGetStatus | [IGetStatus, Interface item path]
|
| Returns the Enabled/Disabled status of a ZBrush or ZScript interface item Output: The item status 0=Disabled 1=Enabled | |
Example:
Returns the current status of the Move button in the Transform menu | |
| IGetTitle | [IGetTitle, Interface item path, Return full path? (0:no nonZero:yes)]
|
| Returns the title of the specified interface item Output: The Title of the button | |
Example:
Returns the title of specified windowID interface item | |
| IHeight | [IHeight, Interface item path]
|
| Returns the pixel-height of an interface item. Output: The height of the interface item. | |
Example:
Returns the height of the "Tool:SimpleBrush" interface item | |
| IHide | [IHide, Interface item path, Show Zoom Rectangles?, Target parent window?]
|
| Hides an interface item. | |
Example:
Hides the "Draw:Width" window | |
| IHPos | [IHPos, Interface item path , Global coordinates?(set value to non-zero for global coordinates; default:Canvas coordinates)]
|
| Returns the H position of the interface item in Canvas or Global coordinates. Output: The H position of the interface item. | |
Example:
Returns the H position of the "Draw:Width" interface Item in Global coordinates | |
| IKeyPress | [IKeyPress, The key to press (with an optional CTRL/CMD, ALT/OPT, SHIFT or TAB combination.) , Commands group to execute while the key is pressed , Optional H cursor position prior to key press , Optional V cursor position prior to key press]
|
| Simulates a key press | |
Example:
Simulates "x" key press
Simulates "Ctrl+z" key press | |
| ILock | [ILock, Window path, Window ID or relative windowID(-100<->100)]
|
| Locks an interface item. | |
Example:
locks the "DoIt" Zscript window interface item (*ZBrush 3 only).
locks the next interface item (*ZBrush 3 only).
| |
| IMaximize | [IMaximize, Interface item path, Maximizeall sub palettes? (0:no, NonZero:yes)]
|
| Locates an interface item and (if possible) maximize its size. | |
Example:
Expand the TOOL palette and all of its sub palettes | |
| IMinimize | [IMinimize, Interface item path, Minimize all sub palettes? (0:no, NonZero:yes)]
|
| Locates an interface item and (if possible) minimize its size. | |
Example:
Closes the TOOL palette and all of its sub palettes | |
| IModGet | [IModGet, Interface item path]
|
| Returns the current modifiers binary state of a ZBrush or ZScript interface item Output: The item value | |
Example:
Returns the current modifiers of the Rotate slider in the Tool menu. Each modifier is identified by its binary value such as lst=1, 2nd=2, 3rd=4, 4th=8 | |
| IModSet | [IModSet, Interface item path, value]
|
| Sets the modifiers binary value of a ZBrush or a ZScript interface item | |
Example:
Sets the modifiers of the Rotate slider in the Tool menu to 2. Each modifier is identified by its binary value such as lst=1, 2nd=2, 3rd=4, 4th=8 | |
| IPress | [IPress, Interface item path]
|
| Presses a ZBrush or ZScript interface item (Sub-Level only). | |
Example:
Presses the Cube3D button in the Tool menu making the Cube3D the active tool | |
| IReset | [IReset, Optional item to reset (default:All). (0:All, 1:Interface, 2:Document, 3:Tools, 4:Lights, 5:Materials, 6:Stencil) , Optional ZBrush version-configuration]
|
| Interface Reset. Output: Returns the button that the user clicked ( 0=NO, 1=YES ) (Sub-Level only). | |
Example:
Resets the interface to a default state | |
| IsDisabled | [IsDisabled, Interface item path]
|
| Returns 1 if the specified ZBrush or ZScript interface item is currently disabled, returns 0 otherwise Output: The item 'Disabled' status (1=Disabled 0=Enabled) | |
Example:
Returns 1 if the "Transform:Move" interface item is currently disabled, returns 0 otherwise | |
| IsEnabled | [IsEnabled, Interface item path]
|
| Returns 1 if the specified ZBrush or ZScript interface item is currently enabled, returns 0 otherwise Output: The item 'Enabled' status (1=Enabled 0=Disabled) | |
Example:
Returns 1 if the "Transform:Move" interface item is currently enabled, returns 0 otherwise | |
| ISet | [ISet, Interface item path, value, Secondary value]
|
| Sets a new value to a ZBrush or ZScript interface item | |
Example:
Sets the Width slider in the Draw menu to 50 | |
| ISetHotkey | [ISetHotkey, Interface item path, Hotkey(0:no Hotkey)]
|
| Sets the hotkey of the specified interface item | |
Example:
Sets "k" as the hotkey for the specified windowID interface item | |
| ISetMax | [ISetMax, Interface item path, New max value]
|
| Sets the maximum value for an ISlider interface item (can only be used for ZScript-generated interface items) | |
Example:
Sets the maximum value of "ZScript:Counter" interface item to 10 | |
| ISetMin | [ISetMin, Interface item path, New min value]
|
| Sets the minimum value for an ISlider interface item (can only be used for ZScript-generated interface items) | |
Example:
Sets the minimum value of "ZScript:Counter" interface item to 10 | |
| IShow | [IShow, Interface item path, Show Zoom Rectangles?, Target parent window?]
|
| Locates an interface item and makes it visible. | |
Example:
Makes the "Draw:Width" item visible. If necessary the "Draw" palette will be opened | |
| IShowActions | [IShowActions, The ShowActions status.(0:Disable ShowActions, Positive value:enable show actions, Negative value:Reset ShowActions)]
|
| Temorarily sets the status of ShowActions | |
Example:
Temporarily disables ShowActions | |
| IsLocked | [IsLocked, Interface item path]
|
| Returns 1 if the specified ZBrush or ZScript interface item is currently locked, returns 0 otherwise
Output: The item 'Locked' status (1=Locked 0=Unlocked) | |
Example:
returns 1 if the "Transform:Move" interface item is locked, returns 0 otherwise (*ZBrush 3 only). | |
| IStroke | [IStroke, Interface item path, StrokeData]
|
| Emulates a brush stroke within an interface item | |
Example:
Loads the "Curvepoints.txt" file, creates a BrushStroke and applies it to the interface item | |
| IsUnlocked | [IsUnlocked, Interface item path]
|
| Returns 1 if the specified ZBrush or ZScript interface item is currently unlocked, returns 0 otherwise
Output: The item 'Unlocked' status (1=Unlocked 0=locked) | |
Example:
returns 1 if the "Transform:Move" interface item is unlocked, returns 0 otherwise (*ZBrush 3 only). | |
| IToggle | [IToggle, Interface item path]
|
| Toggles the state of a ZBrush or ZScript interface item | |
Example:
Toggles the ZAdd button in the Draw menu turning ZAdd mode on and off | |
| IUnlock | [IUnlock, Window path, Window ID or relative windowID(-100<->100)]
|
| Unlocks an interface item | |
Example:
unlocks the "DoIt" Zscript window interface item (*ZBrush 3 only).
unlocks the next interface item (*ZBrush 3 only). | |
| IUnPress | [IUnPress, Interface item path]
|
| Unpresses a ZBrush or ZScript interface item | |
Example:
Unpresses the W button in the Modifiers submenu of the Layer menu | |
| IUpdate | [IUpdate, Repeat count (default:1), Redraw UI? (default:no, 1:yes)]
|
| Updates the ZBrush interface. | |
Example:
Execute 5 interface-update cycles | |
| IVPos | [IVPos, Interface item path , Global coordinates? (set value to non-zero for global coordinates, default:Canvas coordinates)]
|
| Returns the V position of the interface item in Canvas or Global coordinates. Output: The V position of the interface item. | |
Example:
Returns the V position of the "Draw:Width" interface Item in Global coordinates | |
| IWidth | [IWidth, Interface item path]
|
| Returns the pixel-width of an interface item. Output: The width of the interface item. | |
Example:
with Returns the width of the "Tool:SimpleBrush" interface item. | |
| ZBrushInfo | [ZBrushInfo, The info type. (0:version number 1:Demo/Beta/Full 2:Runtime seconds 3:Mem use 4:VMem Use 5:Free Mem 6:operating system (0:PC 1:Mac 2:MacOSX) 7:Unique session ID 8:Total RAM)]
|
| Returns ZBrush info. Output: Result value | |
Example:
returns the user's operating system. Useful if there are different requirements for running the zscript on different operating systems. | |
| ZBrushPriorityGet | [ZBrushPriorityGet]
|
| Returns the task-priority of ZBrush. Output: The current task-priority | |
Example:
Returns current task-priority. | |
| ZBrushPrioritySet | [ZBrushPrioritySet , The priority. -2:Low, -1:BelowNormal, 0:normal, 1:Above Normal, 2:High]
|
| Sets the task-priority of ZBrush. | |
Example:
sets ZBrush priority to above normal. | |
Reading the Mouse
| MouseHPos | [MouseHPos, Global coordinates? (set value to non-zero for global coordinates, default:Canvas coordinates)]
|
| Returns the current H position of the mouse in Canvas or Global coordinates. Output: The H position of the mouse | |
Example:
Returns the current H position of the mouse | |
| MouseLButton | [MouseLButton]
|
| Returns the current state of the left mouse button Output: Returns 1 if mouse button is pressed, returns zero if unpressed | |
Example:
Returns 1 if mouse button is pressed, returns zero if unpressed | |
| MouseVPos | [MouseVPos, Global coordinates? (set value to non-zero for global coordinates, default:Canvas coordinates)]
|
| Returns the current V position of the mouse in Canvas or Global coordinates. Output: The V position of the mouse | |
Example:
Returns the current V position of the mouse | |
Display in the ZScript Tutorial Window
| BackColorSet | [BackColorSet, Red, Green, Blue]
|
| Sets the pen background color (Top Level). | |
Example:
sets the pen background color to yellow | |
| Caption | [Caption, Text]
|
| Displays a text line using the current Caption settings (Top Level). | |
Example:
displays "ThisIsACaption" using the Caption settings
| |
| FontSetColor | [FontSetColor, Red, Green, Blue]
|
| Sets the color of the zscript window font (Top Level). | |
Example:
sets zscript window font to red
sets zscript window font to white | |
| FontSetOpacity | [FontSetOpacity, Opacity]
|
| Sets the opacity of the zscript window font (Top Level). | |
Example:
sets zscript window font opacity to 25%
sets zscript window font opacity to 100% | |
| FontSetSize | [FontSetSize, Size: 1:Small 2:Med 3:Large]
|
| Sets the intensity of the zscript window font (Top Level). | |
Example:
sets zscript window font size to medium
| |
| FontSetSizeLarge | [FontSetSizeLarge]
|
| Sets the size of the zscript window font to large (Top Level). | |
Example:
sets zscript window font size to large | |
| FontSetSizeMedium | [FontSetSizeMedium]
|
| Sets the size of the zscript window font to medium (Top Level). | |
Example:
sets zscript window font size to medium | |
| FontSetSizeSmall | [FontSetSizeSmall]
|
| Sets the size of the zscript window font to small. | |
Example:
sets zscript window font size to small | |
| FrontColorSet | [FrontColorSet, Description Text, Red, Green, Blue, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled)]
|
| Sets the main interface color to a new value (Top Level). | |
Example:
sets the ZBrush interface main front color to black | |
| HotKeyText | [HotKeyText, Interface item path]
|
| Displays a hot-key for the specified interface item (Top Level). | |
Example:
displays the hot key of the DOCUMENT:UNDO button using the Hotkey text settings | |
| Image | [Image, FileName (.psd .bmp + .pct for Mac Systems), Align (0:center 1:left 2:right), Resized Width]
|
| Loads and displays an image (Top Level). | |
Example:
Loads and displays TestImage.psd in the zscript window, center-aligned (default) in its original size | |
| ISetStatus | [ISetStatus, Interface item path, New status ( 0:Disable NotZero:Enable )]
|
| Enables or Disables a ZScript interface item (can only be used for ZScript-generated interface items). | |
Example:
Enables the "DoIt" ZScript interface item
Disables the "DoIt" ZScript interface item | |
| PageSetWidth | [PageSetWidth, Preferred PageWidth]
|
| Sets the width of the page (Top Level). | |
Example:
sets the zscript window display page width to a maximum of 300 pixels | |
| PaintBackground | [PaintBackground, Red, Green, Blue]
|
| Paints the background using the current background color (Top Level). | |
Example:
Fills the zscript window background with a dark gray color | |
| PaintBackSilver | [PaintBackSliver, height, Red, Green, Blue]
|
| Draws a full page-width rectangle using the current background color (Top Level). | |
Example:
Draws a yellow rectangle in the zscript window, full page-width and 20 pixels tall. | |
| PaintPageBreak | [PaintPageBreak]
|
| Draws a visual page-break (Top Level). | |
Example:
Draws a default page break in the zscript window, which is a special case of the PaintBackSliver command | |
| PaintRect | [PaintRect, Width, height, Red, Green, Blue]
|
| Draws a rectangle (in the ZScript window) using the current pen color (Top Level). | |
Example:
Draws a rectangle in the zscript window, 80 pixels wide and 100 pixels tall using the current pen color. | |
| PaintTextRect | [PaintTextRect, Width, Height, Text]
|
| Draws a rectangle with imbedded text (Top Level). | |
Example:
Draws a rectange in the zscript window, 200 pixels wide and 100 tall with "This is an Example" inside it. | |
| PD | [PD]
|
| Moves the pen position to the beginning of the next line (Same as PenMoveDown). | |
Example:
moves the pen to the beginning of the next line of the zscript window. | |
| PenMove | [PenMove, Horizontal Offset, Vertical Offset]
|
| Moves the pen a relative distance. | |
Example:
moves the pen 40 pixels to the right and 80 pixels down in the zscript window. Note: useful for arranging interface items in the zscript window. | |
| PenMoveCenter | [PenMoveCenter]
|
| Moves the pen position to the horizontal center of the page . | |
Example:
moves the pen to the center of the zscript window. | |
| PenMoveDown | [PenMoveDown]
|
| Moves the pen position to the beginning of the next line . | |
Example:
moves the pen to the beginning of the next line in the zscript window. | |
| PenMoveLeft | [PenMoveLeft]
|
| Moves the pen position to the left side of the page . | |
Example:
moves the pen to the left of the zscript window. | |
| PenMoveRight | [PenMoveRight]
|
| Moves the pen position to the right side of the page . | |
Example:
moves the pen to the right of the zscript window. | |
| PenSetColor | [PenSetColor, Red, Green, Blue]
|
| Sets the pen main color . | |
Example:
sets pen color to medium gray. | |
| SectionBegin | [SectionBegin, Section Title, Initial state (1:Expanded, 0:Collapsed ), Popup Info Text, Commands group to execute when expanding to reveal content, Commands group to execute when collapsing to hide content, Initially Disabled? (0:Enabled(ByDefault) NonZero:Disabled)]
|
| Begins a collapsible section . | |
Example:
Begins a collapsible section in the zscript window with "Chapterl2" as the Title which will expand/collapse to reveal/hide its contents when pressed. | |
| SectionEnd | [SectionEnd]
|
| Ends a collapsible section . | |
Example:
ends a previously defined collapsible section in the zscript window. | |
| SubTitle | [SubTitle, Text]
|
| Displays a text line using the current SubTitle settings . | |
Example:
displays "Chapter 23" in the zscript window using the SubTitle settings. | |
| TextCalcWidth | [TextCalcWidth, The text to be evaluated]
|
| Calculates the pixel-width of the specified string Output: Width of text in pixels . | |
Example:
returns the width in pixels of the string "Test". | |
| Title | [Title, Text]
|
| Displays a text line using the current Title settings . | |
Example:
displays "Hello" in the zscript window using the Title settings. | |
Variables
| VarDef | [VarDef, Variable name, Variable defaultValue]
|
| Defines a variable (advised Top Level). | |
Example:
Defines a variable with the name "xPos" and initializes it to 1.
Defines a list variable named "xPos" with 100 items. Note: the list index starts at 0, so xPos(99) is the hundredth item. | |
| VarSet | [VarSet, Variable name, New Value]
|
| Sets the value of a named variable (can be placed anywhere). | |
Example:
sets variable "xPos" to 42.
sets variable "xPos" to Document:Width multiplied by 0.5. | |
| VarListCopy | [VarListCopy, Destination list, Destination initial index, Source list, Source initial index, Number of items to copy.(if omitted or it is 0, then all items will be copied)]
|
| Copies items from a source list to a destination list | |
Example:
copies items 4-6 from sourceList to items 0-2 of destList. | |
| VarLoad | [VarLoad, Variable name, FileName, Verify only (1:Only Verify that a proper saved variable file exists, 0:(default)Verifies and loads values)]
|
| Loads variable/s from a file Output: Number of loaded or verfied values | |
Example:
Sets variable named "userData" to value/s loaded from the "tempFile.zvr" file. | |
| VarSave | [VarSave, Variable name, FileName]
|
| Saves variable value/s to file Output: Number of saved values | |
Example:
Saves the current value/s of "userData" variable to "tempFile.zvr" file. | |
Strings
| StrAsk | [StrAsk, Initial string, Title]
|
| Asks user to input a string. Output: Returns the text typed by user or an empty string if canceled. | |
Example:
Displays a text input dialog and returns the string typed by user. Note: include both initial string and title. | |
| StrExtract | [StrExtract, Input string, Start character index (0:left), End character index (0:left)]
|
| Returns specified portion of the input string Output: The extracted portion of the input string. | |
Example:
Returns the "def" portion of the input string. | |
| StrFind | [StrFind, find this string, in this string, Optional start search index (default:0)]
|
| Locate a string within a string. Output: Returns the starting index of the 1st string within the 2nd string. returns -1 if not found. | |
Example:
Searches for "Br" within "ZBrush" and returns 1.
Searches for "Br" within "ZBrush" and returns -1 (not found). | |
| StrFromAsc | [StrFromAsc, Input Ascii value]
|
| Returns the character of the specified Ascii value. Output: The character of the specified Ascii value. | |
Example:
returns "A". | |
| StrLength | [StrLength, String to evaluate]
|
| Returns the number of characters in the input string. Output: Number of characters in the input string. | |
Example:
Returns 5 as the number of characters in "Hello". | |
| StrLower | [StrLower, Input string]
|
| Returns the lowercase version of the input string. Output: The lowercase version of the input string. | |
Example:
returns "zbrush". | |
| StrMerge | [StrMerge, Str 1, Str 2, Optional Str 3, Opt Str 4, Opt Str 5, Opt Str 6, Opt Str 7, Opt Str 8, Opt Str 9, Opt Str 10, Opt Str 11, Opt Str 12]
|
| Combines two (or more) strings into one string. Output: The combined string. Note: result string will not exceed 255 characters in length | |
Example:
returns the merged string: "Texture number 15 is selected".
returns the merged string: "ZTool27.ztl". | |
| StrToAsc | [StrToAsc, Input string, Optional character offset (default:0)]
|
| Returns the Ascii value of a character. Output: The Ascii value of a character. | |
Example:
returns the Ascii value of "Z".
returns the Ascii value of "r". | |
| StrUpper | [StrUpper, Input string]
|
| Returns the uppercase version of the input string. Output: The uppercase version of the input string. | |
Example:
returns "ZBRUSH". | |
Files and Filenames
| FileExecute | [FileExecute, File name including the extension (such as plugin.dll ), Routine to call, Optional text input, Optional number input, Optional memory block input, Optional memory block output]
|
| Executes the specified plugin file (DLL). Output: Returns the result value which was returned by the executed routine. Returns zero if error | |
Example:
Executed the "ShowMsg" routine of the "PluginTest.dll" plugin | |
| FileExists | [FileExists, File name including the extension (such as brush1.ztl )]
|
| Check if a specific file exists. Output: Returns 1 if file exists. Returns zero if does not exists | |
Example:
Returns 1 if "LargeImage.psd" exists or zero if file does not exists | |
| FileNameAdvance | [FileNameAdvance, Base file name, Number of digits (0-4) (i.e. 3: 001 ), Add 'Copy' string?(0:no, NonZero:yes)]
|
| Increments the index value contained within a filename string Output: Updated file Name. | |
Example:
Adds 1 to the index of the string, i.e. if filename was image0l.psd it will be modified to image02.psd | |
| FileNameAsk | [FileNameAsk, Extension list (up to 3 extensions), Default fileName for SaveDialog. Name should be omitted for OpenDialog, Optional dialog title]
|
| Asks user for a file name Output: Result file name or an empty string if user canceled operation (Sub-Level only). | |
Example:
Activates OpenDialog for a *.dxf or *.obj file to load. Sets the dialog title to "Please select a file to load..."
Activates SaveDialog with default "tempFile.zvr" file name. | |
| FileNameExtract | [FileNameExtract, File name (Full path), Component specifier (1:path, 2:name, 4:ext)]
|
| Extracts filename components. Output: The extracted filename component/s. | |
Example:
returns the name component of the input file path
returns the name+extension components of the input file path | |
| FileNameGetLastTyped | [FileNameGetLastTyped]
|
| Retrieves the latest file name that was typed by the user in a Save/Load action Output: Latest file name that was typed by the user. Returned string will be empty if the user has canceled the action. | |
Example:
Returns a string with the latest typed filename | |
| FileNameGetLastUsed | [FileNameGetLastUsed]
|
| Retrieves the latest file name that was used (by the user or by ZBrush) in a Save/Load action Output: Latest file name that was used. Returned string will be empty if the user has canceled the action. | |
Example:
Returns a string with the latest used filename | |
| FileNameMake | [FileNameMake, Base file name, Index, Number of numeric digits to use]
|
| Combines a base filename with an index number Output: Combined file name Variable | |
Example:
Creates a string with "Image12.psd" as its value | |
| FileNameResolvePath | [FileNameResolvePath, Local File Name]
|
| Resolves local path to full path Output: Full path. | |
Example:
returns the full path of the "LargeImage.psd" file which is located within the same directory as the executing ZScript
returns the full path to the executing ZScript | |
| FileNameSetNext | [FileNameSetNext, File name including the extension (such as .psd ). If omitted the stored file name will be cleared.]
|
| Pre-sets the file name that will be used in the next Save/Load action | |
Example:
sets "LargeImage.psd" as the next file name that will be used in a Save/Load action
sets "Image0023.psd" as the next file name that will be used in a Save/Load action | |
Calculations
| Interpolate | [Interpolate, Time (0:AtStart 0.5:half 1:AtEnd), Value1 (Num, VarName or ListName), Value2 (Num, VarName or ListName), Value3 (Num, VarName or ListName), Value4 (Num, VarName or ListName), Angle interpolation (0:no(default), 1:yes )]
|
| Performs time-based interpolation Output: Interpolated value or list | |
Example:
returns an interpolated value (startX*(1.0-0.25))+(endX*0.25)
returns an interpolated list calculated as a spline at t=.25 | |
| Math Operators | [ - * / ^^
|
Note: Unlike some programming languages, calculations are always evaluated from left to right. That means
To make sure certain parts of the calculation are evaluated first, place them inside parentheses:
| |
| Logical Operators | && !
|
Note: When evaluating several conditions, group using parentheses:
| |
| Math Functions | |
| |
| Randomize | [Randomize, Optional seed value (0 to 32767)]
|
| Resets the Rand generator. | |
Example:
Resets Random generator. | |
| RGB | [RGB, Red, Green, Blue]
|
| Combines 3 color-components into one RGB value Output: Combined RGB | |
Example:
calculates and returns (20*65536 + 40*256 + 80) as a combined RGB value to be used in functions that need combined RGB input. | |
| Val | [Val, Variable name]
|
| Evaluates the input and returns a numerical value Output: Value of the named variable | |
Example:
returns the value of variable "xPos" multiplied by 2, then added to 4. | |