ZBrushCentral

Toggle some basic actions - Macro Button cant be pressed

hello, I wanted to toggle some actions and after some research, i came up with this script, it seems logical but the macro is grayed out in Zbrush Ui and i can’t click on it, wondering if someone can suggest something in regard, much appreciation

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

[VarSet,action_1,“Brush:ZModeler”]
[VarSet,action_2,“Brush:Move”]

[VarSet,curBrush,[IGetTitle,Brush:Current Brush,1]]
[If,([StrFind,action_1,curBrush]==0)&&([StrFind,curBrush,action_1]==0),

[IPress,action_2]
,//else
[If,([StrFind,action_2,curBrush]==0)&&([StrFind,curBrush,action_2]==0),

[IPress,action_1]

,//else select first brush

[IPress,action_1]
]
]
,0.5]

Hi,

Your macro has a comma missing before the button width (0.5). This is what is disabling the button. The end of the macro should be like this:

[IPress,action_1]
]
]
,,0.5]

Marcus

hello Marcus, thank you for your response, as you highlighted indeed when adding that comma now the macro can be pressed, but i have a second issue that been the macro does nothing, the goal was to have a macro to switch between 2 brushes (Move-Zmodler) regardless of whatever brush is been used at the time. im assuming that i have something wrong in the macro somewhere!

It works OK for me and I can’t see anything obviously wrong. Though you can simplify the code a bit:

//ZBRUSH MACRO - Recorded in ZBrush version 2022
[IButton,???,"Press to run this macro. Macros can be aborted by pressing the ëescí key.",
	[IShowActions,0]
	
	[VarSet,action1,"Brush:ZModeler"]
	[VarSet,action2,"Brush:Move"]
	
	[VarSet,curBrush,[IGetTitle,Brush:Current Brush,1]]	
	[If,([StrFind,action1,curBrush]==0)&&([StrFind,curBrush,action1]==0),	
		[IPress,action2]
	,//else		
		[IPress,action1]			
	]

,,0.5]

You don’t need to test if action2 is selected because you want to switch to action1 regardless.

I removed the underscores from the variable names. I think they are best avoided - I seem to remember them causing problems in the past, though they are OK in memory block names.

Are you using a hotkey or pressing the button? Also, you should have a model in Edit mode before using. (Again, although the brushes will switch it is best avoided.)

Marcus

Oh, also make sure you are not using “smart quotes” around the button paths etc. The file should be plain text.

I use underscore a lot, all i know is that it better to avoid them if the script is a macro, scripts and plugins are find with underscore in routines or variables names.

Hope it helps,
Nicolas

Thank you Nicolas, your version of the script works just fine, its more simple i guess i was over complicating things, to answer your previous questions i was using the script both by mouse and with hotkey but no luck, eather way thanks again and have a nice day/night :pray:

1 Like