I was thinking you put it in the settings tab of the script. I noticed if often runs out of run energy, and just keep walking around instead.
My idea would be, that you let us set a option where I as an example, can put the number 47, when I get 47 run energy, the script turns it on. if it doable you could make it a range instead, so it would be bite more random