Stamina Drain System

I'm attempting to make a stamina drain system using the SP as a stamina gague. One method that will be used to deplete stamina is by reading the steps taken. I want it to subtract 1 sp after a given number of steps. I have a close facsimile here but it's very imprecise. Is there a better way of doing this?

[IMG]http://i179.photobucket.com/albums/w284/tetsuo180/StamDrain.png[/IMG]

Original thread: https://forums.rpgmakerweb.com/threads/stamina-drain-system.24160/