[MaxScript] Weird "Bug"/Behaviour & Other questions

Hi!
I’m new here, and fairly new to maxscript (about a month and a half) :slight_smile: I’m managing to do quite a lot with it, and i’ve coding for quite some time on other languages before. anyway. My current script is having a really strange bug…
It doesn’t crash or anything, except that it blocks the whole interface except for the script editor… and it does the “ping” sound when you click anywhere.
It basically acts as if there was a modal dialog window opened somewhere, but doesn’t show it. Pressing enter or esc doesn’t do anything.
And my script isn’t in a loop, it’s an empty scene as well.
I did register some callback events and I’m thinking it might be coming from here ( cause before i registered them, it used to work fine )

It doesn’t “hang” right after the start of the script, but after I used some features of my script, but I’ve checked that my GUI isn’t blocked in one of its event handler. it’s Idling afaik and exiting the handler fine.
So you have to kill max if you want to do anything with it.

I’ll update this thread if I manage to solve my problem before anyone answers.

EDIT 01- I commented the CallBacks and the bug disappears completely… now let’s try to identify which of them is messing with us

       
                 LayerSortInst = ACxM_SortLayers Layers:Layers
		
		/*
		fn CallbackRenamed ev nd = (
			MarioPlumber.LayerSortInst.ProcessOne (GetByHandle nd[1])
		)
		callbackItem = NodeEventCallback mouseUp:true delay:1000 nameChanged:CallbackRenamed 
		callbacks.addScript #nodeCreated "MarioPlumber.LayerSortInst.ProcessOne (callbacks.notificationParam())" id:#ACxMulti_SortObj
		callbacks.addScript #filePostMerge "MarioPlumber.LayerSortInst.ProcessAll()" id:#ACxMulti_SortObj
		callbacks.addScript #postImport "MarioPlumber.LayerSortInst.ProcessAll()" id:#ACxMulti_SortObj
		callbacks.addScript #NodeCloned "MarioPlumber.LayerSortInst.ProcessOne (callbacks.notificationParam())" id:#ACxMulti_SortObj
                */

(this basically aims to sort any node into the right layer, whenever we create, add(merge/import), clone, rename a node. )

Edit 02 -
Ok I think I’ve fixed it… Doesn’t happen anymore, (so far)
I added at the very start of the script a “removeCallback” just to be sure they’re not already registered.
uncommented my callbacks, one by one, trying the script, and it works…
So weird…
gonna keep testing.

Edit 03 - GAAAAAh the little B****** he’s back, and my code hasn’t changed >_< since edit 2… just been playing with the script to test it. now it Randomly happens.

Can you post your current iteration of code, and/or recreate your code and the bug without having to supply his with the MarioPlumber struct?

Ah I’m not at work right now :confused: I’ll do it tomorrow asap in the morning. (europe here)
I’ll try to recreate it with some new code(which is actually a good idea), and if i can, then post it here.
Since it’s some inhouse stuff I don’t know if I can post the script source, I’ll have to ask my lead.

(and wooooo you’re working at Vigil >____< (total darksiders fanboy here))

Ok, This time I think I got it :slight_smile:
It wasn’t so much because of the callbacks. but more of using “modal:true” on a dialog. that was created by function called by the callbacks.
if the code executed in the dialog happened to crash ( as the code was executed on the dialog being opened ), the dialog wouldn’t display, being “half created”, but as it was set as modal=true and would block the UI still.
I understood this while factoring some code on a test script doing a similar thing, and when it’d crash, the same thing would almost happen.

As I’ve completely changed this process, I think I’m sorted now.