ZBrushCentral

On() method in ZBrush

Is there something like On() method in ZBrush?
For example:
OnButtonPressed
OnProjectStateChange
OnTransform
OnDeform

That is, if the method OnButtonPressed() is defined, then each time you press any button, a certain action would be performed etc.

The zscript [Sleep] command can monitor user actions to a certain extent (though only button presses and so on). But it is unreliable because it only works while that zscript is running. The moment the user uses another plugin or macro the functionality is lost.

Apart from that there is nothing, I’m afraid.

Thanks)
Is it possible for example to use Sleep inside a loop?
I tried, but it seems the macro stops working after the first iteration in this case.
Or maybe something like that.

I need to make some defer macros, for example “auto select subtool under mouse”.

One more question: in what situations can “sleep again” be used? when can it be useful?

PS: I think it makes no sense to create a new thread (if I’m wrong, correct me please).