To make a button toggle between two actions you simply need to include an If command in your button. This checks a condition to see if it is true, then carries out one set of commands if it is true, and another set of commands if it is false.
[If,/*test for true or false*/ ,
/*commands if true*/
,
/*commands if false*/
] /*end of If command*/
The condition can be pretty much whatever you want. To find the state of a ZBrush interface item, you can use the [IGet command with the button path. (To find the button path for any item on the interface, place the cursor over the item and hold down Ctrl on the keyboard. A descriptive note will appear and the button path is given at the bottom of the descriptive note.)
But for something like your curve toggle suggestion you would need to use a slightly different approach, as there would be no way of testing which curve was already loaded. The simplest way would be to create a memory block when one curve was loaded, and delete it when loading the other:
[If,[MemGetSize,SB_CurveTest]/*test for memory - a size of 0 means it doesn't exist*/ ,
[MemDelete,SB_CurveTest]/*deletes memory block*/
/*commands to load Curve B*/
,
[MemCreate,SB_CurveTest,1]/*creates memory block*/
/*commands to load Curve A*/
] /*end of If command*/
(The point of using a memory block is that it is persistent throughout a ZBrush session, so your macro button will always find it. ZScript variables only last as long as the zscript/macro is active, so would be no good for a test of this sort.)
On highlighting macro buttons: I don’t think there is a way. The problem is that you can’t dynamically assign colors or images to buttons on the ZBrush interface - they simply won’t update. (Macros are also incredibly touchy and will cause problems with any adventurous code!) There is also a problem with zplugin switches (which do change color) in that currently only the off commands work. You could use a switch as a sort of indicator, switching it on or off with your button but that’s not much of a solution if you are trying to cut down on interface clutter. There may be another way; if I think of something I’ll let you know.