By static variables I'll assume you're talking about my constants, and they're not strictly needed, but they make it easier to look at.
Where are my braces not consistent? I'm not seeing it
My walking method is far from perfect, this is a tutorial for learning purposes, so I'm not going to write some sophisticated walking method that the new scripters here won't understand.
The API's walking will keep clicking the same spot (not because I'm calling it 100 times, you only have to call it once and it just spam clicks the position).
There's no need to check if the object is on screen, because the interact function handles that.
I agree it could get in an infinite loop, but once again, this is just a beginners tutorial so it'll work for learning purposes.
Thanks for reading.