I don't know if that specific script suggested above even exists, but there are three ways around the battle end problem that are know to work.
All solutions require that in every troop you have one event for every enemy that gets triggered on HP=0 and counts up the variable (and whatever else you want).
This will get you most of the count, but the last enemy killed in every battle will not trigger its troop event by default. Solutions around this problem are:
1) a temporary immortal state
you need a state that grants immunity to the death state (#1). Then you need a troop event that automatically applies this state to all enemies on turn #0.
And you change the troop events above to remove the immortal state after the kill variable has been counted up.
That will result in the enemies only dying after the variable is counted.
2) Tsukihime's battle conditions
I don't have the link but Tsukihime wrote a script with additional conditions for troop events especially to counter the problem of troop events not triggering at battle end.
3) using battle processing with the escape and win options triggered.
If the party has won, you'll know that they have killed the last enemy that hasn't triggered and simply increase the kill count by 1.
If they escaped, the kill count will be correct and needs to remain unchanged.
This solution has some drawbacks in the form that all battles need to be evented (no random battles) and that it only works with a single counter for all enemies (the other solutions could count different variables like "slimes killed" "undead killed" etc)