Oh wait, I'm stupid... you should use atkanimation instead of argument0 when reading the animation length (I was looking at skelani_set_animation when giving you advice for psm_melee). psm_melee has no arguments so argument0 is undefined when it's run, the attack animation in use is in the atkanimation variable.
(So replace the global.skelani_animation_length[argument0] with global.skelani_animation_length[atkanimation] everywhere in psm_melee and it should work)