If I remember correctly, the Samurai animations are saved separately. So to get the number of keyframes, simply get them by using the command
total object frames(obj).
Something like
load object "Walk.x", 1
WalkEnd = total object frames(1)
append object "Idle.x", 1, WalkEnd
IdleEnd = total object frames(1)
* not tested
After you did this, the walking animation = 1 -> WalkEnd and the Idle animation ranges from WalkEnd -> IdleEnd
One more thing though, I used that object too once, and I thought the limb numbers did not match, and therefor, the object did not animate correctly...
If that occurs, try to avoid the
append object command. (Load as 2 seperate models and hide one of the 2 every time)
It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.