Table of Contents
Introduction
Displaying/Formatting ZScript Window Items
Creating Clickable Buttons and Sliders
Displaying Messages
Painting and Working in the Canvas
Working With ZBrush and Its Interface
Reading the Mouse
Working With Files and Filenames
Calculations
Manipulating Variables
Manipulating Strings
Using Memory Blocks
Special 3D Tool Commands
Structuring the Flow
Index
| Introduction |
| ZScripts are pretty simple to create -- all you have to do is type some stuff into a text file. Anything that doesn't fall within square brackets ( [ ] ) is simply displayed as regular text.
The ZScript commands are mixed in with regular text, and they're all placed within square brackets.
Even though they're simple to create, there are over 180 commands, so there is virtually no limit to the ZScripted features you can invent. Some of these commands are very easy to understand, a few might take some practice to get used to.
Whenever you load or reload a ZScript text file, ZBrush automatically copies it to an optimized version (a '.zsc' file) which runs more efficiently and can't be read or modified using a text editor. If a PSD image file with the same name exists in the same folder, the image becomes embedded into the .zsc file as the file's icon. Also, any ZBrush or ZScript features which load image files can interpret this embedded data from the .zsc file.
To help you digest the commands, I've broken them up into categories. For an alphabetical list linking to the commands, you can view the Index at the bottom of this page. Also, within ZBrush, you can press the "CMD" button in the ZScript:Modifiers palette to view this entire list, with explanations, alphabetized.
You don't need to worry about upper/lowercase when writing ZScript commands. [PenMoveDown] is the same as [penmovedown] or [pEnMOvedOWn].
In this reference guide, I've used some special markers to cross-reference the commands; here's what my special markers mean: |
| Asterisk* |
Commands marked with an asterisk are "containers" for other groups of ZScript commands. You'll see some explanations that refer to "commands group to execute..."; these are the commands which can contain these commands groups. |
| Light Blue |
These are commands that stand alone in a ZScript; they cannot be placed inside "container" commands. They're sometimes called "Top Level commands". |
| Pink |
These are commands which can either be placed inside "container" commands, or stand alone in a ZScript. |
| No Color (white) |
These cannot stand alone, they must be placed inside "container" commands. If you place them outside of a "container", you'll get an error and your ZScript won't run. Sometimes called "Sub-Level commands". |
Return to top
| Displaying/Formatting ZScript Window Items |
| Caption |
[Caption,Text]
Displays a text line using the current Caption settings (can be changed by PropertySet)
|
| SubTitle |
[SubTitle,Text]
Displays a text line using the current SubTitle settings (can be changed by PropertySet)
|
| Title |
[Title,Text]
Displays a text line using the current Title settings (can be changed by PropertySet)
|
| Image |
[Image,FileName (.psd .bmp + .pct for Mac Systems),Align (0=center 1=left 2=right),Resized Width]
Loads and displays an image
|
| FontSetColor |
[FontSetColor,Red,Green,Blue]
Sets the color of the text-flow font
Tip: There is a shorthand way to assign color to your text, using HTML-style colors, if you're familiar with them (ffffff = white, 000000 = black, ff0000 = red, etc.). Use the special characters \C, followed by the six-letter color. For example:
\Cff0000This text is red.\Ca0a0a0
makes your text red. The default text-flow color is a0a0a0.
This tip also applies to changing the color of text within Notes.
|
| FontSetOpacity |
[FontSetOpacity,Opacity]
Sets the opacity of the text-flow font. 1 = completely opaque, 0 = completely transparent. Half intensity is written as .5, quarter-intensity is written as .25, and so on.
|
| FontSetSize |
[FontSetSize,Size: 1=Small 2=Med 3=Large]
Sets the size of the text-flow font
|
| FontSetSizeLarge |
[FontSetSizeLarge]
Sets the size of the text-flow font to large (same as FontSetSize, 3)
|
| FontSetSizeMedium |
[FontSetSizeMedium]
Sets the size of the text-flow font to medium (same as FontSetSize, 2)
|
| FontSetSizeSmall |
[FontSetSizeSmall]
Sets the size of the text-flow font to small (same as FontSetSize, 1)
|
| PaintBackground |
[PaintBackground,Red,Green,Blue]
Paints the ZScript window background using this color
|
| PaintBackSliver |
[PaintBackSliver,height,Red,Green,Blue]
Draws a full page-width rectangle using this color
|
| PaintPageBreak |
[PaintPageBreak]
Draws a visual page-break
|
| PaintRect |
[PaintRect,Width,height,Red,Green,Blue]
Draws a rectangle using the current pen main color See PenSetColor.
|
| PaintTextRect |
[PaintTextRect,Width,Height,Text]
Draws a rectangle with imbedded text
|
| PenSetColor |
[PenSetColor,Red,Green,Blue]
Sets the pen main color
Note: the Pen is the invisible tool that is "writing" everything in the ZScript window. When you change the position or color of the Pen, you're changing the starting point or color of the displayed items that come afterward.
|
| BackColorSet |
[BackColorSet,Red,Green,Blue]
Sets the pen background color
|
| PageSetWidth |
[PageSetWidth,Preferred PageWidth]
Sets the width of the page for all subsequently-displayed items. The size of the window does not change.
|
| PenMoveCenter |
[PenMoveCenter]
Moves the pen position to the horizontal center of the page
|
| PenMoveDown |
[PenMoveDown]
Moves the pen position to the beginning of the next line
|
| PD |
[PD]
Moves the pen position to the beginning of the next line (Same as PenMoveDown)
|
| PenMoveLeft |
[PenMoveLeft]
Moves the pen position to the left side of the page
|
| PenMoveRight |
[PenMoveRight]
Moves the pen position to the right side of the page
|
| PenMove |
[PenMove,Horizontal Offset,Vertical Offset]
Moves the pen a relative distance
|
| PropertySet |
[PropertySet,The base command name (Title,SubTitle,Caption),Property Index,The new Value]
Modifies the setting of Title, SubTitle and Caption text
Here are the Property Indexes you can use, their meanings and possible values:
0 = Font Size (can be 1 = small, 2 = medium or 3 = large)
1 = Alignment (0 for Center, 1 for Left, 2 for Right)
2 = Intensity (0 = no intensity, 1 = full intensity, .5 = half intensity, any decimal inbetween)
3 = Text Color (Red X 65536 + Green X 256 + Blue, see RGB)
4 = Rectangular Border Size (Number of pixels surrounding text)
5 = Gradient Color 1 (Red X 65536 + Green X 256 + Blue, see RGB)
6 = Gradient Type (0 = none, 1 = horizontal, 2 = vertical, 3 = double horizontal, 4 = double vertical)
7 = Gradient Color 2 (Red X 65536 + Green X 256 + Blue, see RGB)
You don't need to issue this command before displaying a Caption, SubTitle or Title -- they have default attributes built into them. To change the attributes, issue this command as many times as needed. This command only affects Captions, SubTitles and Titles appearing later in the ZScript. Example:
[PropertySet, Title, 0, 2] (font size)
[PropertySet, Title, 1, 0] (alignment)
[PropertySet, Title, 2, .5] (intensity)
[PropertySet, Title, 3, [RGB,0,0,0]] (text color)
[PropertySet, Title, 4, 3] (border size)
[PropertySet, Title, 5, [RGB,255,255,255]] (gradient color 1)
[PropertySet, Title, 6, 1] (gradient type)
[PropertySet, Title, 7, [RGB,0,0,0]] (gradient color 2)
sets all Titles appearing thereafter to appear as medium-sized text, centered, half-intensity, in a box that blends from white to black horizontally.
|
| 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
Tip: Sections are unique ways to break up the text in your ZScript window. They are displayed as clickable buttons that "expand", when clicked, to reveal everything through the SectionEnd command.
|
| SectionEnd |
[SectionEnd]
Ends a collapsible section
|
| TextCalcWidth |
[TextCalcWidth,The text to be evaluated]
Output: Width of text in pixels
Calculates the pixel-width of the specified string
Tip: use TextCalcWidth to make buttons fit neatly underneath text.
Example:
Hello There
[IButton,Button,,,,[TextCalcWidth,"Hello There"]]
See IButton.
|
| HotKeyText |
[HotKeyText,Interface item path]
Displays a hot-key for the specified interface item
|
Return to top
| Creating Clickable Buttons and Sliders |
| ButtonFind |
[ButtonFind,Interface item path,Button Text,Initially Disabled? (0=Enabled(ByDefault) NonZero=Disabled)]
Creates a green button that simply locates a ZBrush interface item
Note: This, and all other "Button..." commands, only perform one action at a time. To create a button that performs several commands when you click it, use IButton.
Tip: The Interface item path can locate another ZScript button. As you'd expect, you can use the name of the button, or its popup text, to reference it. For example, suppose there's another ZScript button labeled "Click Me" with a popup of "Click This Button". You could locate that button either of these two ways:
[ButtonFind,ZScript:Click Me, ... ]
[ButtonFind,ZScript:Click This Button, ... ]
There is a third way: use a number that tells ZBrush how far away that button is from the current button. That is, to locate the next button in the ZScript, use the number 1. to locate the previous button, use the number -1. To locate the button after the next button, use the number 2, and so on. For example:
[ButtonFind,1, ... ]
locates the next button, slider or switch. The number 0 means "this button". Maximum allowable values are -99 to 99.
This also works for any other command which locates interface items, like the Note and IPress commands.
|
| ButtonPress |
[ButtonPress,Interface item path,Button Text,Initially Disabled? (0=Enabled(ByDefault) NonZero=Disabled)]
Creates a red button that locates and presses a ZBrush interface button
|
| ButtonSet |
[ButtonSet,Interface item path,Value,Button Text,Initially Disabled? (0=Enabled(ByDefault) NonZero=Disabled)]
Creates a red button that locates and sets a new value to a ZBrush slider
|
| ButtonUnPress |
[ButtonUnPress,Interface item path,Button Text,Initially Disabled? (0=Enabled(ByDefault) NonZero=Disabled)]
Creates a red button that locates and unpresses a ZBrush interface button
|
| FrontColorSet |
[FrontColorSet,Description Text,Red,Green,Blue,Initially Disabled? (0=Enabled(ByDefault) NonZero=Disabled)]
Creates a red button that sets the main interface color to a new value
|
| IButton* |
[IButton,Button Text,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]
Creates an interactive red button that can perform numerous actions.
See IKeyPress for an explanation of how to specify the HotKey.
The button width is expressed in pixels, unless the button is located inside an ISubPalette. In that case it's a fraction of the palette's width, from 0 (no width) to 1 (full width).
|
| ISlider* |
[ISlider,Slider Text,CurValue,Resolution,MinValue,MaxValue,Popup info Text,Commands group to execute when value is changed,Initially Disabled? (0=Enabled(ByDefault) NonZero=Disabled),Button width in pixels (0=AutoWidth NonZero=Specified width)]
Creates an interactive slider
|
| ISwitch* |
[ISwitch,Button Text,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),Button width in pixels (0=AutoWidth NonZero=Specified width)]
Creates an interactive switch
|
| ISubPalette |
[ISubPalette, SubPalette name, Title mode, 8-bit grayscale icon filename, left inset, right inset, left top, right bottom]
Output: 1 if subpalette created successfully; 0 if it could not be added or already exists.
Creates a subpalette in a ZBrush palette
The SubPalette name should be the path to the enclosing palette plus the new name. For example:
[ISubPalette,ZPlugin:MySubPalette]
creates a subpalette in the ZPlugin palette.
Note that a subpalette is created only if another interface item is created within it. So the above example would produce a subpalette if followed by an IButton, ISwitch, or something like it, i.e.:
[ISubPalette,ZPlugin:MySubPalette]
[IButton,"ZPlugin:MySubPalette:Sample Button", "This is a sample button", [Note,"You pressed the sample button."]]
Remember to enclose the subpalette's name, or item's name, in quotes if you intend to include spaces within it.
The inset values are expressed in pixels.
|
| IDialog |
This command is not currently functional and is intended for future expansion. |
Return to top
| Displaying Messages |
| Note |
[Note,Message,
Optional path of an interface item to be pointed out. (default=none),
Display Duration (in seconds) (zero=default=wait for user action, -1=combine with next note command),
Popup background color. (blue + (green*256) + (red*65536) ) (default=96+(96*256)+(96*65536)),
Preferred distance of the note from the specified interface item (default=48),
Preferred Note width (in pixels, default=400)
Optional marked windows fill color,
Frame horizontal size (1=default=item width),
Frame vertical size (1=default=item height),
Frame left side (0=default=left, .5=center, 1=right),
Frame top (0=default=top, .5=center, 1=bottom),
Optional icon file name]
Output: if the note has NoteIButtons, the index value of the button pressed, otherwise 0.
Displays a note to the user.
Tip: Insert a hard line break into the Message by typing the special characters \n .
See FontSetColor for an explanation of changing text color within a Note.
If the path to an item is specified, the note is displayed with a pointer indicating that item. By default an orange rectangle is drawn around the borders of the item. This rectangle can be adjusted using the Frame horizontal size, Frame vertical size, Frame left side and Frame top. This is especially useful for pointing out items on the canvas (Item ID number 1004). Each value is expressed as a fraction of the item's width/height. If Marked windows fill color is specified, this rectangle is filled with a translucent color.
|
| NoteIButton |
[NoteIButton, Button Text,
Optional button icon file name
Initially pressed? (default=0=unpressed)
Initially disabled? (default=0=enabled)
Button H relative position (default=0=centered)
Button V relative position (default=0=automatic near bottom)
Button width in pixels (default=0=automatic text width)
Button height in pixels (default=0=automatic text height)
Button color (red*65536 + green*256 + blue)
Text color (red*65536 + green*256 + blue)
Background opacity (0 to 1, default=1)
Text opacity (0 to 1, default=1)
Image opacity (0 to 1, default=1)]
Defines a clickable button, image or text region inside a Note.
NoteIButton enables you to define clickable buttons within Notes. It also provides a versatile means of laying out text and images, even if they're not clickable (Initially disabled set to 1). The NoteIButton commands precede the Note command in which they're intended to appear.
Clicking a NoteIButton closes the Note. By placing the NoteIButtons and Note command in a Loop, and changing text or other values, it can appear that NoteIButtons are acting as switches (see also the NoteISwitch command).
By default, buttons are centered and fall at the bottom of the Note, beneath the Note text. The button's position can be specified using these special rules:
Setting H relative position to 0 centers horizontally; setting to a positive number N places its left edge N pixels from the left side of the Note; setting to a negative number -N places its right edge N pixels from the right side of the Note.
Setting V relative position is similar: 0 places it near the bottom; positive N places its top edge N pixels from the top of the Note; negative -N places its bottom edge N pixels from the bottom of the Note.
The Button Text can be the name of an existing memory block. In this case, the text displayed is the contents of the memory block (as long as the memory block already contains data by the time of this command's execution).
When placing a number of buttons in a Note, it's often a good idea to first create an invisible NoteIButton that is invisible and disabled, with the desired width and height of the entire Note. For example, if you wish to display a Note that's 500x350, the first NoteIButton should look like this:
[NoteIButton,,,0,1,1,1,500,350,,,0,0,0]
If you intend to display text using NoteIButtons, positioning is often easier if the enclosing Note's text is left empty.
To determine which NoteIButton has been clicked, set a variable to the Note command which encloses it. A value of 0 means the user pressed the Enter key instead of clicking any buttons. Higher numbers correspond to the NoteIButtons in the order of definition, whether disabled or not. For example:
[NoteIButton,,,0,1,1,1,500,350,,,0,0,0]
[NoteIButton,"First Choice",,0,0,4]
[NoteIButton,,"image.psd",0,1,4,2]
[NoteIButton,"Second Choice",,0,0,-4]
[VarSet,NoteResult,[Note,""]]
The value of NoteResult is 2 if the First Choice is selected, and 4 if the Second Choice is selected. The first and third buttons are not clickable but are counted when determining the output value.
|
| NoteISwitch |
[NoteISwitch, Switch Text,
Optional icon file name
Initially pressed? (default=0=unpressed)
Initially disabled? (default=0=enabled)
Switch H relative position (default=0=centered)
Switch V relative position (default=0=automatic near bottom)
Switch width in pixels (default=0=automatic text width)
Switch height in pixels (default=0=automatic text height)
Switch color (red*65536 + green*256 + blue)
Text color (red*65536 + green*256 + blue)
Background opacity (0 to 1, default=1)
Text opacity (0 to 1, default=1)
Image opacity (0 to 1, default=1)]
Defines a clickable switch inside a Note.
NoteISwitch enables you to define clickable switches within Notes. When clicked, they toggle on and off, without exiting the Note.
The value of a NoteISwitch can be retrieved using NoteIGet.
|
| NoteIGet |
[NoteIGet, Note-switch index (or name)]
Output: the note-switch status
Returns the status of a NoteISwitch shown in the last displayed Note.
|
| NoteBar |
[NoteBar,Message,optional progress-bar value (0-1)]
Displays a message in the progress bar.
The progress bar, located just above the canvas, is cleared from time to time, but you can clear it immediately by issuing a NoteBar with empty quotes ("") as the Message.
The Progress-bar value yields a "thermometer" effect giving the user an indication of an action's progress. This is especially useful in loops:
[Loop,100,
[NoteBar,"Processing...",IndexCount/100]
[some commands...
,IndexCount]
|
| MessageOK |
[MessageOK,The Message that will be shown,The Title of the message]
Displays a user message with a single OK button
|
| MessageOKCancel |
[MessageOKCancel,The Message that will be shown,The Title of the message]
Output: Returns the button that the user clicked. (0=CANCEL, 1=OK)
Displays a user message with CANCEL and OK buttons
Tip: You can use this inside an [If... command to give the user a choice. Example:
[If,[MessageOKCancel,"Are You Sure?","Warning"],
[commands if OK ],
[commands if Canceled ]
]
The same is true of MessageYesNo and MessageYesNoCancel. See the If command.
|
| MessageYesNo |
[MessageYesNo,The Message that will be shown,The Title of the message]
Output: Returns the button that the user clicked. (0=NO, 1=YES)
Displays a user message with YES and NO buttons
|
| MessageYesNoCancel |
[MessageYesNoCancel,The Message that will be shown,The Title of the message]
Output: Returns the button that the user clicked. (0=NO, 1=YES CANCEL=-1)
Displays a user message with YES, NO and CANCEL buttons
|
Return to top
| Painting and 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
Note: you can perform one click, or one click with up to seven drags, like a mini-stroke. This is perfect for placing a 3D object on the canvas -- once it's selected, you can click once in the middle of the canvas, and drag downward. Example:
[IPress,Tool:Sphere3D]
[CanvasClick,320,240,320,340]
|
| CanvasGyroHide |
[CanvasGyroHide]
Hides the Transformation Gyro
Note: Good for creating splashy moving displays in the ZBrush window. Caution: if you use CanvasGyroHide more than once, you'll have to issue a CanvasGyroShow command that many times before it'll show again (until the ZScript finishes running, or is aborted).
|
| CanvasGyroShow |
[CanvasGyroShow]
Shows the Transformation Gyro
|
| CanvasStroke |
[CanvasStroke,StrokeData,Delayed update until end of stroke,Rotation,HScale,VScale,HOffset,VOffset]
Emulates a brush stroke within the current canvas area
Note: StrokeData can be a filename, or can be copied & pasted from a Stroke file. To create a Stroke file, press the "Export Last" button in the Stroke:Inventory palette.
Here are some options for the CanvasStroke command:
[CanvasStroke, (ZObjStrokeV02n5=YH9FV7CPXHA1V7FHA7V84HAFV8AHB7V90)]
[CanvasStroke,[StrokeLoad,[Brushstroke.txt]]]
[CanvasStroke,[StrokeGetLast]]
CanvasStroke can only draw one brushstroke, from the mouse/tablet click to its release. To draw multiple brushstrokes, use CanvasStrokes. See StrokeLoad, StrokeGetLast.
|
| 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
Note: Similar to CanvasStroke, with multiple brushstrokes. To create a Strokes file, first press the "Record" button in the ZScript:Inventory palette, then draw the brushstrokes, then press "Export All".
|
| PixolPick |
[PixolPick,Component Index,H Position,V Position]
Output: The value of the specified Pixol
Retrieves information about a specified Pixol (depending on the ComponentIndex)
Component Index can be 0 through 8:
0 = CompositeColor (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 = Material ItemInfo
6 = Horiz. Normal (orientation information)
7 = Vert. Normal
8 = Z Normal
|
| StrokeGetInfo |
[StrokeGetInfo, Stroke-type Variable, Info number, Point index (0 based)]
Output: StrokeInfo result
Retrieves the information from a specified Stroke (depending on the Info Number)
Info Number can be 0 through 9:
0 = Total Number of Points
1 = Indexed H Position
2 = Indexed V Position
3 = Indexed Pressure
4 = Minimum H Position Overall
5 = Minimum V Position Overall
6 = Maximum H Position Overall
7 = Maximum V Position Overall
8 = Maximum Radius
9 = Index of Point at Maximum Radius
10 = Maximum Horizontal Distance Traveled
11 = Maximum Vertical Distance Traveled
12 = Total Distance
13 = Twirl Count
14 = Indexed Z (deduced)
15 = Indexed Key Press
The Point Index is the sequential number of the point you wish to study. A Point Index of 0 means the first point in the stroke. Supply a Point Index only if Info Number is "Indexed", that is 1, 2, 3, 14 or 15.
Note: StrokeGetInfo only works on a single stroke, created by pressing "Export Last" in the "Stroke:Inventory" palette, by using StrokeGetLast, or by loading from a file with StrokeLoad.
Example:
[StrokeGetInfo,[StrokeGetLast],0]
gives you the total number of points in the last stroke drawn.
|
| StrokeGetLast |
[StrokeGetLast]
Output: StrokeData
Retrieves the last drawn brush stroke
|
| TransformGet |
[TransformGet, X Position, Y Position, Z Position, X Size, Y Size, Z Size, X Rotation, Y Rotation, Z Rotation]
Gets current transformation values for the active 3D object.
Note: These nine transformation values are displayed in the Transform:Info sliders when the "Move", "Resize", and "Rotate" buttons are pressed. Replace each of the components with variable names to place these values into the variables.
|
| TransformSet |
[TransformSet,xPos,yPos,zPos,xScale,yScale,zScale,xRotate,yRotate,zRotate]
Sets new transformation values for the active 3D object.
|
Return to top
| Working with ZBrush and Its Interface |
| IPress |
[IPress,Interface item path]
Presses a ZBrush or ZScript interface item
See ButtonFind for notes on locating other ZScript buttons, sliders and switches.
|
| IUnPress |
[IUnPress,Interface item path]
Unpresses a ZBrush or ZScript interface item
|
| IGet |
[IGet,Interface item path]
Output: The item value
Returns the current value of a ZBrush or ZScript slider. Returns 1 for a pressed button, 0 for an unpressed button.
|
| ISet |
[ISet,Interface item path,value]
Sets a new value to a ZBrush or ZScript slider.
|
| IColorSet |
[IColorSet,Red (0-255),Green (0-255),Blue (0-255)]
Sets the active color to a new value
|
| IReset |
[IReset,Optional item to reset (default=All). 0=All,1=Interface,2=Document,3=Tools,4=Lights,5=Materials,6=Stencil]
Output: Returns the button that the user clicked. ( 0=NO, 1=YES )
Interface Reset
Note: When you record ZScripts, you are asked if you'd like to reset the interface ([IReset,0]). This is because the result of running a ZScript can be unpredictable unless you're sure ZBrush settings are the same each time it is run.
This means all customized tools, materials or stencils are deleted if the appropriate palette is reset, and the document is wiped clean.
You can use IReset inside an [If... statement in the same way as you'd use one of the Message... commands. See MessageOKCancel.
|
| IConfig |
[IConfig,ZBrush version-configuration (1.232=v1.23b, 1.5=v1.5 and newer.)]
Sets ZBrush internal version-configuration. This command is provided for optimum compatibility when newer versions of ZBrush introduce changes to tools and features. When ZBrush encounters an [IConfig... command, it causes these tools and features to behave the same way as in the version specified.
|
| IShow |
[IShow,Interface item path,Show Zoom Rectangles?]
Locates an interface item and makes it visible.
|
| IHide |
[IHide,Interface item path,Show Zoom Rectangles?, Target parent window? (0 or 1)]
Hides an interface item.
|
| IMaximize |
[IMaximize,Interface item path,Maximizeall sub palettes? (0=no, NonZero=yes)]
Locates an interface item and (if possible) maximizes its size.
|
| IMinimize |
[IMinimize,Interface item path,Minimize all sub palettes? (0=no, NonZero=yes)]
Locates an interface item and (if possible) minimizes its size.
|
| IClose |
[IClose, Interface item path, Show zoom rectangles? (0 or 1), Target parent window (0 or 1)]
Closes an interface item.
|
| 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
|
| IStroke |
[IStroke,Interface item path,StrokeData]
Emulates a brush stroke within an interface item
Note: This is useful for manipulating ZCurves, like the ones inside Material modifiers.
|
| IToggle |
[IToggle,Interface item path]
Toggles the state of a ZBrush or ZScript interface item. Presses a button if unpressed, and vice-versa.
|
| IGetMax |
[IGetMax,Interface item path]
Output: The item maximum value
Returns the maximum possible value of a ZBrush or ZScript interface item
|
| IGetMin |
[IGetMin,Interface item path]
Output: The item minimum value
Returns the minimum possible value of a ZBrush or ZScript 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)
|
| 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)
|
| 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)
|
| 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)
Note: In the section Creating Clickable Buttons and Sliders, notice that each command has an option listed as "Initially Disabled?". A value greater than zero in this position means the button is disabled until you enable it with IEnable.
|
| IExists |
[IExists,Interface item path]
Output: 1 if item exists,0 otherwise
Verifies that a specified interface item exists.
Note: When doesn't an interface item exist? For instance, when a 3D object is selected in the Tool palette, the sliders in the Tool:Modifiers:Deformation sub-palette exist. However, they don't exist when a painting tool (such as SimpeBrush) is selected.
|
| IsDisabled |
[IsDisabled,Interface item path]
Output: The item 'Disabled' status (1=Disabled 0=Enabled)
Returns 1 if the specified ZBrush or ZScript interface item is currently disabled, returns 0 otherwise
|
| IsEnabled |
[IsEnabled,Interface item path]
Output: The item 'Enabled' status (1=Enabled 0=Disabled)
Returns 1 if the specified ZBrush or ZScript interface item is currently enabled, returns 0 otherwise
|
| 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)
|
| IGetStatus |
[IGetStatus,Interface item path]
Output: The item status: 0=Disabled, 1=Enabled
Returns the Enabled/Disabled status of a ZBrush or ZScript interface item. Usually the same as IsEnabled.
|
| IShowActions |
[IShowActions, show actions?]
Temporarily sets the status of Show Actions during ZScript playback
You can control whether actions are shown for certain blocks of ZScript code, regardless of the status of the ZScript:Show Actions button. Setting Show Actions? to 0 turns it off; setting to a positive number turns it on, and setting to a negative number resets to the status of the Show Actions button.
IShowActions is especially useful when building tutorial ZScripts. You may perform a series of actions which might confuse novice users or distract from the central point of the tutorial, and this provides a way of suppressing highlighting and animation during playback.
|
| IFreeze* |
[IFreeze,Commands group to be executed without updating the interface]
Disables interface updates while executing commands. [IFreeze... is useful when performing lengthy tasks, and you'd prefer the user sees only the finished product.
An added bonus to freezing the interface is that the process executes more quickly.
Tip: While the interface is frozen, ZBrush still displays information using the NoteBar command. Thus you can provide a 'thermometer' indicating the operation's progress.
|
| IUpdate |
[IUpdate, Repeat count (default=1), Redraw UI? (default=no, 1=yes)]
Updates the ZBrush interface
IUpdate refreshes the ZBrush interface while within an IFreeze commands group.
|
| IModGet |
[IModGet,Interface item path]
Output: The item value
Returns the current modifiers binary state of a ZBrush or ZScript interface item
The Modifiers in ZBrush 1.23b are the tiny X, Y and Z buttons in the Tool:Modifiers:Deformation sliders when a 3D object is selected. IModGet returns the following values when these modifiers are pressed:
0 = (all off)
1 = X
2 = Y
3 = X+Y
4 = Z
5 = X+Z
6 = Y+Z
7 = X+Y+Z
Use these values to set the appropriate modifiers with IModSet.
|
| IModSet |
[IModSet,Interface item path,value]
Sets the modifiers binary value of a ZBrush or a ZScript interface item
See IModGet.
|
| IWidth |
[IWidth, Interface item path]
Output: The width of the interface item
Returns the width, in pixels, of the specified interface item |
| IHeight |
[IHeight, Interface item path]
Output: The height of the interface item
Returns the height, in pixels, of the specified interface item
IHeight is good for checking if a palette is expanded, collapsed, in novice mode or in expert mode.
|
| IHPos |
[IHPos, Interface item path, Global coordinates? (0=default=canvas coordinates, nonzero=global coordinates)]
Output: The horizontal position of the interface item
Returns the horizontal position of an interface item
If Global coordinates is blank or set to 0, the value represents the horizontal postion relative to the left edge of the canvas. If the interface item is to the left of the canvas, the value will be negative. Otherwise, the value is the position from the left of the ZBrush window (normally the left edge of your monitor).
|
| IVPos |
[IVPos, Interface item path, Global coordinates? (0=default=canvas coordinates, nonzero=global coordinates)]
Output: The vertical position of the interface item
Returns the vertical position of an interface item |
| IGetID |
[IGetID,Interface item path]
Output: The interface item ID number
Returns the ID number of the interface item specified by path/name |
| IGetTitle |
[IGetTitle, Interface item ID number, return full path? (0=no, nonzero=yes)]
Output: The title of the specified item
Returns the name, and optionally the path of the interface item specified by ID number |
| IGetInfo |
[IGetInfo,Interface item path]
Output: The popup info
Retrieves the main popup info about an interface item as a string |
| IGetSecondary |
[IGetInfo,Interface item path]
Output: The secondary popup info
Retrieves the secondary popup info about an interface item as a string
Certain interface items display useful information in the "secondary" portion of the popup window. For example, 3D tools display information about point and polygon counts, among other things.
|
| IGetHotkey |
[IGetHotkey,Interface item path]
Output: The ASCII/keyboard value of the item's hotkey
Retrieves the hotkey (key shortcut) of an interface item |
| ISetHotkey |
[ISetHotkey,Interface item path, Hotkey (0=no hotkey)]
Sets the hotkey (key shortcut) of an interface item
Using this command, you can customize hotkeys for any interface item. The value of Hotkey should be an ASCII value or keyboard number, which can be determined using the Preferences:Utilities:View Keyboard Status slider.
|
| 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
Examples:
[IKeyPress, 'N', ... ]
[IKeyPress, ALT, ... ]
[IKeyPress, ALT+'N', ... ]
[IKeyPress, ALT+SHIFT+'N', ... ]
Tip: Useful for simulating an ALT key press while drawing in the canvas area with CanvasStrokes. The 'key to press' can be a number representing certain characters (the ASCII number, if you're familiar with the term). For an Enter key, the number is 13, for a Spacebar, the number is 32. The same is true for any commands which can have a HotKey assigned to them, like IButton.
This makes IKeyPress useful for bringing up the coin controller when the Stencil is active:
[IKeyPress,32,[some actions ],320,240]
IKeyPress can also be used to suppress a message that usually comes up when a certain action is performed:
[IKeyPress,13,[IPress,Layer:Inventory:MRG]]
merges layers without bringing up the usual confirmation dialog box.
|
| IGetFlags |
[IGetFlags, Interface item path]
Output: interface item's status flags
Returns the status flags of the specified interface item.
IGetFlag's output is a single number which is the sum of all set flag bits. This is a useful way to get information about an interface item which might otherwise be difficult to find. Values for any iterface item can be determined by experimenting.
For example, you can determine if a light switch is pressed and/or turned on. Here are samples for the first light switch (interface item number 1556)
[IGetFlags,1556] returns:
11 if the light is selected and turned on
9 if the light is not selected but turned on
10 if the light is selected but not turned on
8 if the light is not selected nor turned on
|
| CanvasPanGetH |
[CanvasPanGetH]
Output: the current H pan value
Returns the horizontal pan value of the active document view
If you think of an imaginary crosshairs fixed in the center of the document window, CanvasPanGetH and CanvasPanGetV return the coordinates of the pixol which falls under the crosshairs. When the canvas is panned all the way to the right and down, these commands return 0 (h) and 0 (v).
|
| CanvasPanGetV |
[CanvasPanGetV]
Output: the current V pan value
Returns the vertical pan value of the active document view |
| CanvasPanSet |
[CanvasPanSet, H value, V value]
Pans the canvas within the document window
H value and V value are set to the coordinates of the pixol which will fall in the center of the window. Thus a 640x480 canvas can be centered by entering
[CanvasPanSet,320,240]
The left- and topmost pixol in the canvas is 0,0.
|
| CanvasZoomGet |
[CanvasZoomGet]
Output: the current zoom value
Returns the zoom value of the active document view
A zoom value of 1 indicates the canvas is being viewed at actual size. A smaller value indicates the canvas is zoomed out, and a larger value indicates the canvas is zoomed in.
|
| CanvasZoomSet |
[CanvasZoomSet,Zoom value]
Sets the zoom value of the active document view |
| ZBrushInfo |
[ZBrushInfo, The info type]
Output: a numeric value indicating the type of info queried
Returns information about ZBrush and the filesystem.
The info type can be:
0: The ZBrush version number
1: Demo/Beta/Commercial version (returns 0 for demo, 1 for beta, 2 for commercial)
2: Runtime in seconds (including millisecond fractions)
3: Memory usage
4: VMemory usage
5: Free Memory
6: Operating system (0=PC, 1=Mac, 2=MacOSX)
7: Unique session ID (useful for determining if the user has restarted ZBrush)
8: Total RAM
|
| ZBrushPrioritySet |
[ZBrushPriorityGet]
Sets the task priority for ZBrush (Windows only).
The priority can be:
0: Normal
1: A little more
2: Much more
-1: A little less
-2: Much less
This command is ignored on Mac filesystems.
|
| ZBrushPriorityGet |
[ZBrushPriorityGet]
Output: the task priority
Returns the task priority for ZBrush (Windows only).
See ZBrushPrioritySet for a description of this command's numeric values.
|
Return to top
| Reading the Mouse |
| MouseHPos |
[MouseHPos]
Output: The H position of the mouse
Returns the current H position of the mouse in Canvas coordinates
You cannot set MouseHPos or MouseVPos to other values. However, you can emulate a key press at a specific horizontal and vertical position, by using IKeyPress.
|
| MouseVPos |
[MouseVPos]
Output: The V position of the mouse
Returns the current V position of the mouse in Canvas coordinates
|
| MouseLButton |
[MouseLButton]
Output: Returns 1 if mouse button is pressed, returns zero if unpressed
Returns the current state of the left mouse button
|
Return to top
| Working With Files and Filenames |
| 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
Tip: Load or import an item into a palette by setting a filename, then pressing the appropriate button. For example, to import a texture (making sure the texture is in the same folder as the ZScript first):
[FileNameSetNext,MyTexture.bmp]
[IPress,Texture:Inventory:Import]
This imports the texture named 'MyTexture.bmp', without showing a dialog box to the user. If you later wish to show a dialog box to the user when such a button is pressed, use [FileNameSetNext,""].
|
| FileNameAsk |
[FileNameAsk,Extension list (up to 3 extensions),Default FileName for SaveDialog. Name should be omitted for Open Dialog]
Output: Result file name or an empty string if user canceled operation.
Presents the standard 'Save' dialog and asks user for a file name
|
| FileNameGetLastTyped |
[FileNameGetLastTyped]
Output: Latest file name that was typed by the user. Returned Variable will be empty if the user has canceled the action.
Retrieves the latest file name that was typed by the user in a Save/Load action
|
| FileNameGetLastUsed |
[FileNameGetLastUsed]
Output: Latest file name that was used. Returned Variable will be empty if the user has canceled the action.
Retrieves the latest file name that was used (by the user or by ZBrush) in a Save/Load action
|
| FileNameExtract |
[FileNameExtract,FileName (Full path),Component specifier (1=path, 2=name, 4=ext)]
Output: The extracted filename component/s.
Given a FileName (from a string or from the result of a FileNameGetLast...), provides the path, name and/or extension
Tip: Get more than one of these components by adding specifiers together. For example, to extract both the name and extension, use [FileNameExtract, FileName, 6]
|
| FileNameMake |
[FileNameMake,Base file name,Index,Number of numeric digits to use]
Output: Combined file name Variable
Combines a base filename with an index number
|
| FileNameAdvance |
[FileNameAdvance,base file name,Number of digits (0-4) (i.e. 3= 001 ),Add 'Copy' string? (0=no, NonZero=yes)]
Output: Updated file Name
Increments the index value contained within a filename string
|
| FileExists |
[FileExists, File name including the extension (such as brush1.ztl)]
Output: Returns 1 if the file exists, 0 if it does not exist
Checks if a specific file exists |
| FileNameResolvePath |
[FileNameResolvePath, Local file name]
Output: Full system path to a file
Resolves the full system path to a local file
Given a simple file name which exists in the same folder as your ZScript, FileNameResolvePath returns the full system path to the file. Using string-manipulation commands, you can extract parts of the path to use in other operations.
You can also specify nested folders within the current folder, such as "images/filename.ext".
To refer to paths starting at the "root" ZBrush directory, use "ZBRUSH_folder/subfolder...". For example, referring to a file called "MyZScript.txt" in the ZScripts folder would read
[FileNameResolvePath, "ZBRUSH_ZScripts/MyZScript.txt"]
|
| StrokeLoad |
[StrokeLoad,FileName (.txt)]
Output: StrokeData
Loads a brush-stroke text file
|
| StrokesLoad |
[StrokesLoad,FileName (.txt)]
Output: StrokesData
Loads a brush-strokes text file
|
| VarSave |
[VarSave, Variable name, Filename]
Output: Number of saved values (1 unless the variable is a list)
Saves a variable to a file
VarSave stores a varaiable's data for later loading using VarLoad. It's a good way to store a user's preferences, for example.
If you intend to read the saved file in another program (such as a text editor), it's better to define a Memory Block and use MemSaveToFile.
|
| VarLoad |
[VarLoad, Variable name, Filename, Verify only? (0=default=read file, 1=only check existence/number of values)]
Output: Number of loaded or verified values (1 unless the variable is a list)
Reads the value of a variable or list from a file; optionally verifies the existence and quantity of saved value(s). |
| FileExecute |
[FileExecute, Filename, Routine to call, Optional text input, Option numeric input, Optional memory block input, Optional memory block output]
Output: The result value defined by the specified file/routine
Calls a plugin library file
FileExecute provides a way to call plugin library files. The types of input, output and result values are defined by the library files themselves.
An example of a library file which is included by default in ZBrush's release is WebZPlug.dll, responsible for opening a webpage from a ZScript. Here's an example which shows how you might open the user's default browser to access ZBrushCentral:
[FileExecute,"ZBRUSH_ZData\ZPlugs\WebZPlug.dll",HTTP_Browse,"http://www.zbrushcentral.com"]
To avoid errors when calling, it's good practice to first ensure the library file exists, using FileExists.
|
Return to top
| Calculations |
| VarAdd |
[VarAdd,Variable name,Value To Add]
Adds a value to an existing variable
|
| VarSub |
[VarSub,Variable name,Value To Subtract]
Subtracts a value from an existing variable
|
| VarMul |
[VarMul,Variable name,Value to Multiply]
Multiplies an existing variable by a value
|
| VarDiv |
[VarDiv,Variable name,Value to Divide By]
Divides an existing variable by a value |
| VarInc |
[VarInc,Variable name]
| |