ZBrushCentral

Question : Script won't press the button it's told toPl

Hey I’m working on a script to switch all surface noise off when it’s on and on when it’s off. Everything works except when it’s suppose to be turned off it just won’t press the noise button. It runs the note in the if statement tho. I have no idea what I’m doing wrong here.

[ISwitch, “Noise”,0, “Switches all surface noises”,

[VarSet, sBtoolsLC,[SubToolGetActiveIndex]]

[SubToolSelect, 0] //_____saves current subtool.


[VarSet, sBtoolsL,[SubToolGetCount]]


[Loop, sBtoolsL,


[If, Tool:Surface:Noise == 0,



[IPress, Tool:Surface:Noise]




]



[SubToolSelect, [SubToolGetActiveIndex] +1]



]


[SubToolSelect, sBtoolsLC]


,

//_____________________________________________________________________noise off

[VarSet, sBtoolsLC,[SubToolGetActiveIndex]]

[SubToolSelect, 0] //_____saves current subtool.


[VarSet, sBtoolsL,[SubToolGetCount]]


[Loop, sBtoolsL,


[If, Tool:Surface:Noise == 1,



[Note, “Loop Activated”]




[IPress, Tool:Surface:Noise]




]



[SubToolSelect, [SubToolGetActiveIndex] +1]



]


[SubToolSelect, sBtoolsLC]



]

You just need to use

[IUnPress, Tool:Surface:Noise]

when you want to turn Noise off. (It’s a switch so IPress only turns it ON.)

O wow sorry haha took some time off zscripting small mistake:o