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:
[VarSet, SubtoolValue, [IModGet,Tool:SubTool:SubtoolNames]]
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
Last edited by zbag; 11-29-11 at 12:40 PM.
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:
[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:
and towards the bottom of this thread:
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:
[varset, SubtoolName(1), [IgetTitle, Tool:Current Tool]]
[VarSet, SubtoolValue(1), [IModGet,[StrMerge,"Tool:SubTool:", SubtoolName(1)]]]
[vardef, test, 0]
[varset, test, SubtoolValue(1)]
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?
Last edited by zbag; 11-30-11 at 03:09 PM.
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)]]
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:
[VarSet,subToolPath,[StrMerge,"Tool:Sub Tool ",[Val,n]]]
Also note that list variables start from 0 not 1, so if you declare a list variable like this:
it will have two variables like this: