Stamina not working

With render stepped, and any other yielding function you could obtain the time the “step” took as a return value. You could then use this to calculate how much stamina consumed.

The quoted code below could lead you in the right direction.