ZBrushCentral

How to stop dynamics simulation within a script?

basically what the title says. I want to have a script run dynamics simulation and then after x seconds have it stop and then do some other things. As it is now, if the user hits ESC it stops not only the sim but also the script. I tried :

[sleep,3,[IKeyPress, 27]]
[ipress,dynamics:run simulation]

and:
[sleep,3,[CanvasClick,-4096,-4096,-4000,-4000]]
[ipress,dynamics:run simulation]

and :
[sleep,3,[iunpress,dynamics:run simulation]]
[ipress,dynamics:run simulation]

to no avail. If I click in the canvas while the sim is running, it will stop the dynamics and continue with the script, but I would really like it to do it automatically after x time. any ideas?

I don’t think this can be got to work. It seems that while the simulation is running zscript code is blocked.

It might be possible by using a dynamic library that runs a separate thread which interrupts the simulation, perhaps by simulating a mouse click but I’ve not tried that.