ZBrushCentral

Help with setting up TWO values within a script

I’m trying to create a script that will control the Mask by Polygroup value. I set the script up to change the value to “100” but I would like it to change back to “0” if it were to be pressed again. It looks like this so far:

//ZBRUSH MACRO - Recorded in ZBrush version 4.8
[IButton,???,“Press to run this macro. Macros can be aborted by pressing the ëescí key.”,
[IShowActions,0]
[IConfig,4.8]
[ISet,Brush:Auto Masking:Mask By Polygroups,100]
]

Thanks

Hi! I’m very new to zscripting myself, but I think you’ll want to do an If command. it might look something like this:

//ZBRUSH MACRO - Recorded in ZBrush version 4.8
[IButton,???,“Press to run this macro. Macros can be aborted by pressing the ëescí key.”,
[IShowActions,0]
[IConfig,4.8]

[VarDef,MBPvalue,0] //creates variable to hold current slider value
[VarSet,MBPvalue,[IGet,Brush:Auto Masking:Mask By Polygroups]] //assigns current slider value to variable

[If,MBPvalue<100, //if the current value is less than 100…
[ISet,Brush:Auto Masking:Mask By Polygroups,100] //set value to 100
,//if not less than 100…
[ISet,Brush:Auto Masking:Mask By Polygroups,0] //then set to 0
]//end If command
]

I haven’t tested it out, but this seems useful to me as 99.999999% of the time you’ll either want this slider set to 0 or 100.

good luck! let me know how it goes

Thanks a lot this worked now I assigned a hotkey to it so I can turn it on or off, you’re right it’s seldom when a user would need values between 0 and 100, which makes that script perfect.

glad it worked!