Jump to content

How to gracefuly deal with "no native object bound to the script object"?


onspey

Recommended Posts

I know there is no way to avoid having to deal with scripts bound to ActiveMagicEffects getting orphaned while still running. But is there a way to catch this situation from within the orphaned script itself? I tried testing for Self == None, but that doesn't seem do it.

 

The scripts getting orphaned in itself is not a problem. I'm basically simply looking for a way to prevent the error message from getting thrown into the log file and confusing the casual modders.

 

Anyone know how?

Link to comment
Share on other sites

  • 2 years later...

There seems to be a way after all. While you can't test Self == None, you can cast Self to a string and look for a sub-string '<None>', like so:

If StringUtil.Find(Self As String, "<None>") < 0 Then
; Code that would throw 'No object bound' error, if script is no longer attached
EndIf

At least this is how I currently deal with this issue.

Edited by onspey
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...