To use it properly, you need to pre-create all the variables as global variables except for the "digit" variable, which must be local. If you don't, the script will not work! All by me.