ZBrushCentral

questions: varset subtool visibility value

So I’m playing around with zscript a bit more(still new in coding in general). Right now I want to set the visibility value of a subtool to a variable. Based on what i got from a macro, it seems like the visibility of a subtool is toggled through the values 9 and 25? So here is my first failed attempt at setting the visibility value of a subtool to the “SubtoolValue” variable:

[VarDef,SubtoolValue, 0] [VarDef,SubtoolNames, "PM3D_Sphere3D_12"] [VarSet, SubtoolValue, [IModGet,Tool:SubTool:SubtoolNames]] [note, SubtoolValue,,3]

this obviously doesn’t work. Zbrush is telling me that the “interface value” for “SubtoolsNames” in line 3 was not found. Any ideas how to fix this? thx

What you are trying to do is really quite complex. For a start, you can’t add a variable straight into an interface path like that, you need to split it up so that ZBrush can parse the variable separately. So that this can happen you use the [StrMerge] command something like this:

[VarDef,SubtoolNames, “PM3D_Sphere3D_12”]
[IPress,[StrMerge,“Tool:Sub Tool:”, SubtoolNames]]

Also the [IModSet] command will not work for subtools so you need to find a different way. ([IModGet] is all right to find the value - if it’s >=16 then the subtool is visible. You need to find the Flags if you want the selected subtool, using [IGetFlags] and >=9 gives the selected subtool.)

There’s some information that will help you in this thread:

http://www.zbrushcentral.com/showthread.php?162766-Hide-subtool-under-mouse

and towards the bottom of this thread:

http://www.zbrushcentral.com/showthread.php?163020-compare-two-strings-vars

HTH,

Hey Marcus. Sorry if I’m not getting some of the stuff you posted. But now I’m getting another error related to my first post. Here’s the code:

[VarDef,SubtoolValue(2), 0]
[VarDef,SubtoolName(2), “”]

[varset, SubtoolName(1), [IgetTitle, Tool:Current Tool]]
[VarSet, SubtoolValue(1), [IModGet,[StrMerge,“Tool:SubTool:”, SubtoolName(1)]]]

[note, SubtoolValue(1),3]
[vardef, test, 0]
[varset, test, SubtoolValue(1)]
[note, test,3]

so in this case, i’m creating two list variables and setting them appropriately. In zbrush, the value of subtoolvalue(1) shows up, but the value of “test” gives me an error: “ambiguous input. input can be preceded by…”. Can you tell me why that is, and how I can set SubtoolValue(1) value to “test” variable?

There’s nothing obviously wrong with the code you’ve posted. If you attach the whole of your code I’ll take a look.

Sometimes ZBrush can be funny with zscript and it can be useful to specify that you are getting the value of another variable like this:

[Varset, test, [Var,SubtoolValue(1)]]
[Note, test,3]

And sometimes you need to use the [Val] command the get the numerical value of a variable. For example, if using the loop counter variable ‘n’ in the code snippet below:

[Loop,10,
[VarSet,subToolPath,[StrMerge,"Tool:Sub Tool ",[Val,n]]]
,n]

Also note that list variables start from 0 not 1, so if you declare a list variable like this:

[VarDef,myList(2),0]

it will have two variables like this:

myList(0)
myList(1)

HTH,