Page 1 of 1
Find broken behaviours
Posted: Thu Apr 01, 2021 2:52 pm
by trevix
I have a stack with several nested objects that use behaviours, since group of them share the same scripts.
Now, I was able to mess things up and found that, here and there, there are objects that don't link anymore to an existing behaviour (red on the project browser).
Is there a way to obtain a list of these unlinked objects, so that I can fix them? (that is, put the correct path for the behaviour)
Thanks
Re: Find broken behaviours
Posted: Thu Apr 01, 2021 4:36 pm
by jmburnod
Hi,
One way i use to find broken behaviors path for one card
Code: Select all
function getListControlsBadBEH
put empty into rListControlsBadBEH
repeat with i = 1 to the num of controls
put the short name of control i into tName
put the behavior of control i into tBEH
if tBEH = empty then next repeat
if there is a tBEH then
next repeat
else
put the short name of this cd &"," & tName & "," & tBEH & cr after rListControlsBadBEH
end if
end repeat
return rListControlsBadBEH
end getListControlsBadBEH
Best regards
Jean-Marc
Re: Find broken behaviours
Posted: Thu Apr 01, 2021 8:53 pm
by kdjanz
You can also look in the project browser.
Objects with a behaviour script have an extra icon over on the right hand side, which will let you edit the script if you double click it.
If it doesn't have the icon and it should, you can go into the property inspector and link it back up.
Good Luck
Kelly
Re: Find broken behaviours
Posted: Thu Apr 01, 2021 8:56 pm
by trevix
Thanks Kelly, I knew about that.
But when they are deeply nested it is a pain to find them, particularly because the project browser is so crude
Re: Find broken behaviours
Posted: Thu Apr 01, 2021 9:03 pm
by kdjanz
Then a script would be the route to go. The script could check if the control is on a list of objects that need behaviour 1 or 2 and then set the behaviour accordingly in the script. If you don't want to make a list of objects, you could use a custom property in each object with the name of the behaviour it should have. The script could then loop through every object, and if it had the magic property it would be reconnected to it's behaviour automagically.
An "automated" repair button if you will.