Notifications
Clear all

[Closed] Crashing smoothly

I have evolved a fairly large and complex tool -one that draws on multiple sub-tools scripts. Sometimes errors occur due to external data that require a restart of the tool.

I’ve was abusing the exit command to halt everything and force my tool to crash,
but this leaves the dialog box open so the crash (and the need to restart)is not 100% obvious to my users.

I’m trying to code a smoother option, that simply closes the dialoge with a message window.

The problem: some of the scripts keep running after the tool dialog closes. I still need something that can halt any max script activity…


fn crash = 
( 
  destroyDialog myToolDialog 
  myToolDialog =undefined 
  local str="myToo has crashed. 
 check Max Script Listener for details." 
  messagebox (str) title:("FORGE v"+this.version)
  --need something here  to stop all the scripts running
)

3 Replies
1 Reply
(@batigolnguyen)
Joined: 10 months ago

Posts: 0

yes, all global function and variable still there event to you destroy your dialog.
If you want to clear them all, you have to clear all function and variable by setting them as undefined

can you not use a try catch?

thanks for your response

try/catch works in very specific situations.
My issue is that the tool loads external data -from among hundreds of assets -and sometimes that data is bad in ways I can’t anticipate. Sometimes the bad data is sneakily bad, and can be passed between tools and functions for a while before thigns go kablooey. It is for these circumstances that I could use something that puts the brakes on every script and neatly closes out of the tool interface.