this function was made by lee to help me with a DT limb bug.
Perhaps this modified source will help you as well.
sync on : sync rate 60
set text size 18 : set text font "verdana"
set text to bold : set text opaque
color backdrop rgb(0,0,0) : set ambient light 10
ink rgb(255,255,255),1
load object "my model.x",1
position object 1,0,0,0
perform checklist for object limbs 1
total_limbs = checklist quantity()
disable escapekey
while escapekey()=0
text 10,10,"total limbs "+STR$(total_limbs)
set cursor 0,100
showlimbhierarchy(1,0)
fastsync
endwhile
delete object 1
end
function showlimbhierarchy(limb,sp)
print space$(sp);limb-1;" ";checklist string$(limb)
chd=checklist value d(limb) : if chd>0 then showlimbhierarchy(1+chd,sp+1)
syb=checklist value c(limb) : if syb>0 then showlimbhierarchy(1+syb,sp)
endfunction