Forums > Javascript

Using valid property of max object to test for existence

Mar 26 2011 | 9:10 pm

I’m scripting a patch to instantiate multiple objects. I’ve succeeded to that extent but when I start removing objects and start referring to objects that don’t exist, the patch crashes. I’ve been trying to figure out how to use the valid property of maxobj in order to to test for an object’s existence before my script tries to remove it. But when I try to access the valid property of an object that doesn’t exist, of course I get an error saying that the object doesn’t exist. Is there any way around this?

  1. AutoInstantiate.js
Apr 13 2011 | 10:53 pm

I tinkered with your patch to see what the problem was. I made a few changes to the code to make it more readable but I don’t think I changed the functionality and it seemed to be working just fine for me. The only problem I experience is that if you use the mouse to change the [number] box and you scroll fast enough for it to skip values then the related group(s) of generated objects will not be deleted. This shouldn’t cause issues if the only way these are created is by stepping the [counter] up or down by a value of one each time though.

Viewing 2 posts - 1 through 2 (of 2 total)

Forums > Javascript