ZBrushCentral

Macro for to toggle Button pressing

Hello,

a small scripting question:
I wanted to have a macro to toggle a button (for the purpose to assign a second hotkey to that action).

I found a desccription in an older post, but I am not firm enough in scripting to translate it for my task:
http://www.zbrushcentral.com/showthread.php?49892-toggleable-macros-how-to

My Button, which I want to toggle is the ViewMask:

[IUnPress,Tool:Masking:ViewMask]

How do I get the actual state?
I tried this following, but the Macro-Button disappeared after “Reload Macros” :wink:

//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]
[If,[IUnPress,Tool:Masking:ViewMask]=1,
[IPress,Tool:Masking:ViewMask]
,
[IUnPress,Tool:Masking:ViewMask]
]

Thanks!

You can use [IGet] to get the current state but you actually don’t need to for this. You can use [IToggle] which does the work for you:

//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]
[IToggle,Tool:Masking:ViewMask]
]

:+1: thanks